0022904: Clean up sccsid variables
[occt.git] / src / Expr / Expr_LessThan.cxx
1 // Copyright:   Matra-Datavision 1991
2 // File:        Expr_LessThan.cxx
3 // Created:     Thu Jun 13 13:50:04 1991
4 // Author:      Arnaud BOUZY
5 //              <adn>
6
7 #include <Expr_LessThan.ixx>
8 #include <Expr_NumericValue.hxx>
9 #include <Expr.hxx>
10
11 Expr_LessThan::Expr_LessThan (const Handle(Expr_GeneralExpression)& exp1, const Handle(Expr_GeneralExpression)& exp2)
12 {
13   SetFirstMember(exp1);
14   SetSecondMember(exp2);
15 }
16
17 Standard_Boolean Expr_LessThan::IsSatisfied () const
18 {
19   Handle(Expr_GeneralExpression) fm = FirstMember();
20   Handle(Expr_GeneralExpression) sm = SecondMember();
21   fm = fm->Simplified();
22   sm = sm->Simplified();
23   if (fm->IsKind(STANDARD_TYPE(Expr_NumericValue))) {
24     if (sm->IsKind(STANDARD_TYPE(Expr_NumericValue))) {
25       Handle(Expr_NumericValue) nfm = Handle(Expr_NumericValue)::DownCast(fm);
26       Handle(Expr_NumericValue) nsm = Handle(Expr_NumericValue)::DownCast(sm);
27       return (nfm->GetValue() < nsm->GetValue());
28     }
29   }
30   return Standard_False;
31 }
32
33 Handle(Expr_GeneralRelation) Expr_LessThan::Simplified () const
34 {
35   Handle(Expr_GeneralExpression) fm = FirstMember();
36   Handle(Expr_GeneralExpression) sm = SecondMember();
37   return new Expr_LessThan(fm->Simplified(),sm->Simplified());
38 }
39
40 void Expr_LessThan::Simplify ()
41 {
42   Handle(Expr_GeneralExpression) fm = FirstMember();
43   Handle(Expr_GeneralExpression) sm = SecondMember();
44   SetFirstMember(fm->Simplified());
45   SetSecondMember(sm->Simplified());
46 }
47
48 Handle(Expr_GeneralRelation) Expr_LessThan::Copy () const
49 {
50   return new Expr_LessThan(Expr::CopyShare(FirstMember()),
51                            Expr::CopyShare(SecondMember()));
52 }
53
54 TCollection_AsciiString Expr_LessThan::String() const
55 {
56   return FirstMember()->String() + " < " + SecondMember()->String();
57 }