org.geotools.filter
Class DefaultExpression

java.lang.Object
  extended byorg.geotools.filter.expression.ExpressionAbstract
      extended byorg.geotools.filter.DefaultExpression
All Implemented Interfaces:
org.opengis.filter.expression.Expression, Expression, ExpressionType
Direct Known Subclasses:
AttributeExpressionImpl, AttributeExpressionImpl2, FunctionExpressionImpl, GeometryExpressionImpl, LiteralExpressionImpl, MapScaleDenominatorImpl, MathExpressionImpl

public abstract class DefaultExpression
extends ExpressionAbstract
implements Expression

Implements a default expression, with helpful variables and static methods.

Version:
$Id: DefaultExpression.java 18021 2006-02-14 20:36:18Z jdeolive $
Author:
Rob Hranac, Vision for New York

Field Summary
protected  short expressionType
          Defines the type of this expression.
protected  boolean permissiveConstruction
          Defines the type of this expression.
 
Fields inherited from interface org.geotools.filter.expression.ExpressionType
ATTRIBUTE, ATTRIBUTE_DOUBLE, ATTRIBUTE_GEOMETRY, ATTRIBUTE_INTEGER, ATTRIBUTE_STRING, ATTRIBUTE_UNDECLARED, FUNCTION, LITERAL_DOUBLE, LITERAL_GEOMETRY, LITERAL_INTEGER, LITERAL_STRING, MATH_ADD, MATH_DIVIDE, MATH_MULTIPLY, MATH_SUBTRACT
 
Constructor Summary
DefaultExpression()
           
 
Method Summary
 void accept(FilterVisitor visitor)
          Used by FilterVisitors to perform some action on this filter instance.
 java.lang.Object evaluate(Feature feature)
          Returns a value for this expression.
 java.lang.Object evaluate(java.lang.Object object)
          This method checks if the object is an instance of Feature and if so, calls through to evaluate(Feature).
 short getType()
          Gets the type of this expression.
 java.lang.Object getValue(Feature feature)
          Deprecated. use evaluate(Feature).
protected static boolean isAttributeExpression(short expressionType)
          Checks to see if passed type is attribute.
protected static boolean isExpression(short expressionType)
          Checks to see if passed type is geometry.
protected static boolean isGeometryExpression(short expressionType)
          Checks to see if passed type is geometry.
protected static boolean isLiteralExpression(short expressionType)
          Checks to see if passed type is geometry.
protected static boolean isMathExpression(org.opengis.filter.expression.Expression expression)
          Checks to see if this expression is a math expresson based on its type.
protected static boolean isMathExpression(short expressionType)
          Deprecated. use {@link #is
 
Methods inherited from class org.geotools.filter.expression.ExpressionAbstract
accept, eval
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.opengis.filter.expression.Expression
accept
 

Field Detail

expressionType

protected short expressionType
Defines the type of this expression.


permissiveConstruction

protected boolean permissiveConstruction
Defines the type of this expression.

Constructor Detail

DefaultExpression

public DefaultExpression()
Method Detail

getType

public short getType()
Gets the type of this expression.

Specified by:
getType in interface Expression
Returns:
The short representation of the expression type.

getValue

public final java.lang.Object getValue(Feature feature)
Deprecated. use evaluate(Feature).

This method calls evaluate(Feature).

Specified by:
getValue in interface Expression
Parameters:
feature - Specified feature to use when returning value. Some expressions, such as LiteralExpressions, may ignore this as it does not affect their return value.
Returns:
Value of the expression, evaluated with the feature object if necessary.

evaluate

public java.lang.Object evaluate(Feature feature)
Returns a value for this expression. If the expression is an attribute expression then the attribute of the feature should be returned. If a literal then the feature is ignored, the literal is returned as it has no relation to the feature.

Specified by:
evaluate in interface Expression
Overrides:
evaluate in class ExpressionAbstract
Parameters:
feature - Specified feature to use when returning value.
Returns:
The value of this expression based on the feature.
Task:
REVISIT: make abstract?

evaluate

public java.lang.Object evaluate(java.lang.Object object)
This method checks if the object is an instance of Feature and if so, calls through to evaluate(Feature). This is done to maintain backwards compatability with previous version of Expression api which depended on Feature. If the object is not an instance of feature the super implementation is called.

Specified by:
evaluate in interface org.opengis.filter.expression.Expression
Overrides:
evaluate in class ExpressionAbstract

accept

public final void accept(FilterVisitor visitor)
Deprecated. use Expression.accept(ExpressionVisitor, Object)

Description copied from interface: Expression
Used by FilterVisitors to perform some action on this filter instance. Typicaly used by Filter decoders, but may also be used by any thing which needs infomration from filter structure. Implementations should always call: visitor.visit(this); It is importatant that this is not left to a parent class unless the parents API is identical.

Specified by:
accept in interface Expression
Parameters:
visitor - The visitor which requires access to this filter, the method must call visitor.visit(this);

isAttributeExpression

protected static boolean isAttributeExpression(short expressionType)
Checks to see if passed type is attribute.

Parameters:
expressionType - Type of expression for check.
Returns:
Whether or not this is an attribute expression type.

isMathExpression

protected static boolean isMathExpression(short expressionType)
Deprecated. use {@link #is

Checks to see if passed type is math.

Parameters:
expressionType - Type of expression for check.
Returns:
Whether or not this is a math expression type.

isMathExpression

protected static boolean isMathExpression(org.opengis.filter.expression.Expression expression)
Checks to see if this expression is a math expresson based on its type.

Parameters:
expression - expression to check.
Returns:
Whether or not this is a math expression.

isLiteralExpression

protected static boolean isLiteralExpression(short expressionType)
Checks to see if passed type is geometry.

Parameters:
expressionType - Type of expression for check.
Returns:
Whether or not this is a geometry expression type.

isGeometryExpression

protected static boolean isGeometryExpression(short expressionType)
Checks to see if passed type is geometry.

Parameters:
expressionType - Type of expression for check.
Returns:
Whether or not this is a geometry expression type.

isExpression

protected static boolean isExpression(short expressionType)
Checks to see if passed type is geometry.

Parameters:
expressionType - Type of expression for check.
Returns:
Whether or not this is a geometry expression type.


Copyright © GeoTools. All Rights Reserved.