Package org.geotools.filter
Class MathExpressionImpl
Object
ExpressionAbstract
DefaultExpression
MathExpressionImpl
- All Implemented Interfaces:
BinaryExpression
,Expression
- Direct Known Subclasses:
AddImpl
,DivideImpl
,MultiplyImpl
,SubtractImpl
Holds a mathematical relationship between two expressions. Note that the sub expressions must be math expressions. In
other words, they must be a math literal, another math expression, or a feature attribute with a declared math type.
You may create math expressions of arbitrary complexity by nesting other math expressions as sub expressions in one
or more math expressions. This filter defines left and right values to clarify the sub expression precedence for
non-associative operations, such as subtraction and division. For example, the left value is the numerator and the
right is the denominator in an ExpressionMath division operation.
- Author:
- Rob Hranac, Vision for New York
-
Field Summary
Fields inherited from interface Expression
NIL
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
No argument constructor.protected
MathExpressionImpl
(Expression e1, Expression e2) -
Method Summary
Modifier and TypeMethodDescriptionprotected abstract Object
doArithmeticOperation
(Double operand1, Double operand2) protected void
Convenience method which ensures that both expressions have been set.Gets the left or first expression.Gets the second expression.protected Object
handleCollection
(Object value1, Object value2) protected Object
number
(double number) void
setExpression1
(Expression expression) Gets the left or first expression.void
setExpression2
(Expression expression) Gets the second expression.Methods inherited from class DefaultExpression
isAttributeExpression, isExpression, isFunctionExpression, isGeometryExpression, isLiteralExpression, isMathExpression
Methods inherited from class ExpressionAbstract
evaluate, evaluate
Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface Expression
accept, evaluate, evaluate
-
Constructor Details
-
MathExpressionImpl
protected MathExpressionImpl()No argument constructor. -
MathExpressionImpl
-
-
Method Details
-
getExpression1
Gets the left or first expression.- Specified by:
getExpression1
in interfaceBinaryExpression
- Returns:
- the expression on the first side of the comparison.
-
setExpression1
Gets the left or first expression. -
getExpression2
Gets the second expression.- Specified by:
getExpression2
in interfaceBinaryExpression
- Returns:
- the expression on the second side of the comparison.
-
setExpression2
Gets the second expression. -
ensureOperandsSet
Convenience method which ensures that both expressions have been set. If any of operands not set an exception is thrown.- Throws:
IllegalArgumentException
-
number
-
handleCollection
-
doArithmeticOperation
-