deegree 2.3 (2010/04/09 10:10 build-4-official)

org.deegree.model.filterencoding
Class ArithmeticExpression

java.lang.Object
  extended by org.deegree.model.filterencoding.Expression
      extended by org.deegree.model.filterencoding.ArithmeticExpression

public class ArithmeticExpression
extends Expression

Encapsulates the information of a <Add> / <Sub>/ <Mul> or <DIV> element as defined in the Expression DTD.

Version:
$Revision: 18195 $, $Date: 2009-06-18 17:55:39 +0200 (Do, 18. Jun 2009) $
Author:
Markus Schneider, last edited by: $Author: mschneider $

Field Summary
(package private)  Expression expr1
          The first operand.
(package private)  Expression expr2
          The second operand.
 
Fields inherited from class org.deegree.model.filterencoding.Expression
id
 
Constructor Summary
ArithmeticExpression(int id, Expression expr1, Expression expr2)
          Constructs a new ArithmeticExpression.
 
Method Summary
static Expression buildFromDOM(Element element)
          Given a DOM-fragment, a corresponding Expression-object is built.
 Object evaluate(Feature feature)
          Returns this ArithmeticExpression/tt>'s value (to be used in the evaluation of complex Expressions).
 Expression getFirstExpression()
          returns the first expression
 Expression getSecondExpression()
          returns the second expression
 StringBuffer toXML()
          Produces an indented XML representation of this object.
 
Methods inherited from class org.deegree.model.filterencoding.Expression
getExpressionId, getExpressionName
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

expr1

Expression expr1
The first operand.


expr2

Expression expr2
The second operand.

Constructor Detail

ArithmeticExpression

public ArithmeticExpression(int id,
                            Expression expr1,
                            Expression expr2)
Constructs a new ArithmeticExpression.

Parameters:
id -
expr1 -
expr2 -
Method Detail

buildFromDOM

public static Expression buildFromDOM(Element element)
                               throws FilterConstructionException
Given a DOM-fragment, a corresponding Expression-object is built. This method recursively calls other buildFromDOM () - methods to validate the structure of the DOM-fragment.

Parameters:
element -
Returns:
the new instance
Throws:
FilterConstructionException - if the structure of the DOM-fragment is invalid

toXML

public StringBuffer toXML()
Produces an indented XML representation of this object.

Specified by:
toXML in class Expression
Returns:
XML representation of this object.

evaluate

public Object evaluate(Feature feature)
                throws FilterEvaluationException
Returns this ArithmeticExpression/tt>'s value (to be used in the evaluation of complex Expressions). TODO: Improve datatype handling.

Specified by:
evaluate in class Expression
Parameters:
feature - that determines the concrete values of PropertyNames in the expression
Returns:
the resulting value (as Double)
Throws:
FilterEvaluationException - if the expressions are not numerical

getFirstExpression

public Expression getFirstExpression()
returns the first expression

Returns:
the first expression

getSecondExpression

public Expression getSecondExpression()
returns the second expression

Returns:
the second expression

deegree 2.3 (2010/04/09 10:10 build-4-official)

an open source project founded by lat/lon, Bonn, Germany.
For more information visit: http://www.deegree.org