org.geotools.filter.visitor
Class IsStaticExpressionVisitor

java.lang.Object
  extended by org.geotools.filter.visitor.IsStaticExpressionVisitor
All Implemented Interfaces:
org.opengis.filter.expression.ExpressionVisitor

public class IsStaticExpressionVisitor
extends java.lang.Object
implements org.opengis.filter.expression.ExpressionVisitor

Check if an expression is static (ie does not contain a PropertyName expression).

This visitor will "short-circuit" the moment it finds a PropertyName expression and will not need to visit the entire data structure.

Example:


 if( filter.accepts( IsStaticExpressionVisitor.VISITOR, null ) ){
     Color color = expression.evaulate( null, Color.class );
     ...
 }
 

Author:
Jody

Field Summary
static IsStaticExpressionVisitor VISITOR
           
 
Constructor Summary
protected IsStaticExpressionVisitor()
          visit each expression and check that they are static
 
Method Summary
 java.lang.Boolean visit(org.opengis.filter.expression.Add expression, java.lang.Object data)
          visit each expression and check that they are static
 java.lang.Boolean visit(org.opengis.filter.expression.Divide expression, java.lang.Object data)
          visit each expression and check that they are static
 java.lang.Boolean visit(org.opengis.filter.expression.Function expression, java.lang.Object data)
          Visit each parameter and check if they are static
 java.lang.Boolean visit(org.opengis.filter.expression.Literal expression, java.lang.Object data)
          Literal expressions are always static.
 java.lang.Boolean visit(org.opengis.filter.expression.Multiply expression, java.lang.Object data)
          visit each expression and check that they are static.
 java.lang.Boolean visit(org.opengis.filter.expression.NilExpression expression, java.lang.Object data)
          visit each expression and check that they are static
 java.lang.Boolean visit(org.opengis.filter.expression.PropertyName expression, java.lang.Object data)
          If even a single PropertyName is found in the expression the expression is not static.
 java.lang.Boolean visit(org.opengis.filter.expression.Subtract expression, java.lang.Object data)
          visit each expression and check that they are static.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

VISITOR

public static final IsStaticExpressionVisitor VISITOR
Constructor Detail

IsStaticExpressionVisitor

protected IsStaticExpressionVisitor()
visit each expression and check that they are static

Method Detail

visit

public java.lang.Boolean visit(org.opengis.filter.expression.NilExpression expression,
                               java.lang.Object data)
visit each expression and check that they are static

Specified by:
visit in interface org.opengis.filter.expression.ExpressionVisitor

visit

public java.lang.Boolean visit(org.opengis.filter.expression.Add expression,
                               java.lang.Object data)
visit each expression and check that they are static

Specified by:
visit in interface org.opengis.filter.expression.ExpressionVisitor

visit

public java.lang.Boolean visit(org.opengis.filter.expression.Divide expression,
                               java.lang.Object data)
visit each expression and check that they are static

Specified by:
visit in interface org.opengis.filter.expression.ExpressionVisitor

visit

public java.lang.Boolean visit(org.opengis.filter.expression.Function expression,
                               java.lang.Object data)
Visit each parameter and check if they are static

Specified by:
visit in interface org.opengis.filter.expression.ExpressionVisitor

visit

public java.lang.Boolean visit(org.opengis.filter.expression.Literal expression,
                               java.lang.Object data)
Literal expressions are always static.

Specified by:
visit in interface org.opengis.filter.expression.ExpressionVisitor
Returns:
true

visit

public java.lang.Boolean visit(org.opengis.filter.expression.Multiply expression,
                               java.lang.Object data)
visit each expression and check that they are static.

Specified by:
visit in interface org.opengis.filter.expression.ExpressionVisitor
Returns:
true if getExpression1 and getExpression2 are static

visit

public java.lang.Boolean visit(org.opengis.filter.expression.PropertyName expression,
                               java.lang.Object data)
If even a single PropertyName is found in the expression the expression is not static.

Specified by:
visit in interface org.opengis.filter.expression.ExpressionVisitor
Returns:
false

visit

public java.lang.Boolean visit(org.opengis.filter.expression.Subtract expression,
                               java.lang.Object data)
visit each expression and check that they are static.

Specified by:
visit in interface org.opengis.filter.expression.ExpressionVisitor
Returns:
true if getExpression1 and getExpression2 are static


Copyright © 1996-2010 Geotools. All Rights Reserved.