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