| 1 | // Copyright: Matra-Datavision 1991 |
| 2 | // File: Expr.cxx |
| 3 | // Created: Fri Sep 20 11:23:07 1991 |
| 4 | // Author: Arnaud BOUZY |
| 5 | // <adn> |
| 6 | |
| 7 | #include <Expr.hxx> |
| 8 | #include <Expr_NamedUnknown.hxx> |
| 9 | #include <Expr_GeneralExpression.hxx> |
| 10 | #include <Expr_GeneralRelation.hxx> |
| 11 | #include <Expr_UnknownIterator.hxx> |
| 12 | #include <Expr_RUIterator.hxx> |
| 13 | |
| 14 | Handle(Expr_GeneralExpression) Expr::CopyShare(const Handle(Expr_GeneralExpression)& exp) |
| 15 | { |
| 16 | if (exp->IsShareable()) { |
| 17 | return exp; |
| 18 | } |
| 19 | return exp->Copy(); |
| 20 | } |
| 21 | |
| 22 | Standard_Integer Expr::NbOfFreeVariables(const Handle(Expr_GeneralRelation)& rel) |
| 23 | { |
| 24 | Standard_Integer nbvar = 0; |
| 25 | Expr_RUIterator rit(rel); |
| 26 | while (rit.More()) { |
| 27 | if (!rit.Value()->IsAssigned()) { |
| 28 | nbvar++; |
| 29 | } |
| 30 | rit.Next(); |
| 31 | } |
| 32 | return nbvar; |
| 33 | } |
| 34 | |
| 35 | Standard_Integer Expr::NbOfFreeVariables(const Handle(Expr_GeneralExpression)& exp) |
| 36 | { |
| 37 | Standard_Integer nbvar = 0; |
| 38 | Expr_UnknownIterator uit(exp); |
| 39 | while (uit.More()) { |
| 40 | if (!uit.Value()->IsAssigned()) { |
| 41 | nbvar++; |
| 42 | } |
| 43 | uit.Next(); |
| 44 | } |
| 45 | return nbvar; |
| 46 | } |
| 47 | |
| 48 | Standard_Real Expr::Sign(const Standard_Real val) |
| 49 | { |
| 50 | return ::Sign(1.0,val); |
| 51 | } |