org.geotools.filter
Class FunctionExpressionImpl

Object
  extended by ExpressionAbstract
      extended by DefaultExpression
          extended by FunctionExpressionImpl
All Implemented Interfaces:
Factory, ExpressionType, FunctionExpression, Expression, Function
Direct Known Subclasses:
AreaFunction, AsMultiGeometryFunctionExpression, ClassifyFunction, Collection_AverageFunction, Collection_BoundsFunction, Collection_CountFunction, Collection_MaxFunction, Collection_MedianFunction, Collection_MinFunction, Collection_SumFunction, Collection_UniqueFunction, EnvFunction, FallbackFunction, FilterFunction_abs, FilterFunction_abs_2, FilterFunction_abs_3, FilterFunction_abs_4, FilterFunction_acos, FilterFunction_area, FilterFunction_asin, FilterFunction_atan, FilterFunction_atan2, FilterFunction_between, FilterFunction_boundary, FilterFunction_boundaryDimension, FilterFunction_buffer, FilterFunction_bufferWithSegments, FilterFunction_ceil, FilterFunction_centroid, FilterFunction_contains, FilterFunction_Convert, FilterFunction_convexHull, FilterFunction_cos, FilterFunction_crosses, FilterFunction_dateFormat, FilterFunction_dateParse, FilterFunction_difference, FilterFunction_dimension, FilterFunction_disjoint, FilterFunction_disjoint3D, FilterFunction_distance, FilterFunction_distance3D, FilterFunction_double2bool, FilterFunction_endAngle, FilterFunction_endPoint, FilterFunction_envelope, FilterFunction_equalsExact, FilterFunction_equalsExactTolerance, FilterFunction_equalTo, FilterFunction_exp, FilterFunction_exteriorRing, FilterFunction_floor, FilterFunction_geometryType, FilterFunction_geomFromWKT, FilterFunction_geomLength, FilterFunction_getGeometryN, FilterFunction_getX, FilterFunction_getY, FilterFunction_getZ, FilterFunction_greaterEqualThan, FilterFunction_greaterThan, FilterFunction_IEEEremainder, FilterFunction_if_then_else, FilterFunction_in10, FilterFunction_in2, FilterFunction_in3, FilterFunction_in4, FilterFunction_in5, FilterFunction_in6, FilterFunction_in7, FilterFunction_in8, FilterFunction_in9, FilterFunction_int2bbool, FilterFunction_int2ddouble, FilterFunction_interiorPoint, FilterFunction_interiorRingN, FilterFunction_intersection, FilterFunction_intersects, FilterFunction_intersects3D, FilterFunction_isClosed, FilterFunction_isEmpty, FilterFunction_isLike, FilterFunction_isNull, FilterFunction_isometric, FilterFunction_isRing, FilterFunction_isSimple, FilterFunction_isValid, FilterFunction_isWithinDistance, FilterFunction_isWithinDistance3D, FilterFunction_lessEqualThan, FilterFunction_lessThan, FilterFunction_list, FilterFunction_log, FilterFunction_max, FilterFunction_max_2, FilterFunction_max_3, FilterFunction_max_4, FilterFunction_min, FilterFunction_min_2, FilterFunction_min_3, FilterFunction_min_4, FilterFunction_minimumCircle, FilterFunction_minimumDiameter, FilterFunction_minimumRectangle, FilterFunction_not, FilterFunction_notEqualTo, FilterFunction_numberFormat, FilterFunction_numberFormat2, FilterFunction_numGeometries, FilterFunction_numInteriorRing, FilterFunction_numPoints, FilterFunction_octagonalEnvelope, FilterFunction_offset, FilterFunction_overlaps, FilterFunction_parseBoolean, FilterFunction_parseDouble, FilterFunction_parseInt, FilterFunction_parseLong, FilterFunction_pointN, FilterFunction_pow, FilterFunction_property, FilterFunction_random, FilterFunction_relate, FilterFunction_relatePattern, FilterFunction_rint, FilterFunction_round, FilterFunction_round_2, FilterFunction_roundDouble, FilterFunction_sdonn, FilterFunction_setCRS, FilterFunction_sin, FilterFunction_sqrt, FilterFunction_startAngle, FilterFunction_startPoint, FilterFunction_strCapitalize, FilterFunction_strConcat, FilterFunction_strEndsWith, FilterFunction_strEqualsIgnoreCase, FilterFunction_strIndexOf, FilterFunction_strLastIndexOf, FilterFunction_strLength, FilterFunction_strMatches, FilterFunction_strPosition, FilterFunction_strReplace, FilterFunction_strStartsWith, FilterFunction_strSubstring, FilterFunction_strSubstringStart, FilterFunction_strToLowerCase, FilterFunction_strToUpperCase, FilterFunction_strTrim, FilterFunction_strTrim2, FilterFunction_symDifference, FilterFunction_tan, FilterFunction_toDegrees, FilterFunction_toRadians, FilterFunction_touches, FilterFunction_toWKT, FilterFunction_union, FilterFunction_vertices, FilterFunction_within, IDFunction, IDFunctionExpression, LengthFunction, MaxFunction, MinFunction, PaletteFunction, PiFunction, PropertyExistsFunction, RescaleToPixelsFunction

public abstract class FunctionExpressionImpl
extends DefaultExpression
implements FunctionExpression

Abstract class for a function expression implementation

Author:
James Macgill, PSU

Field Summary
protected  Literal fallback
           
protected  FunctionName functionName
          FunctionName provided by subclass; or lazely created
protected  String name
          function name
protected  List<Expression> params
          function params
 
Fields inherited from class DefaultExpression
expressionType, permissiveConstruction
 
Fields inherited from interface ExpressionType
ATTRIBUTE, ATTRIBUTE_DOUBLE, ATTRIBUTE_GEOMETRY, ATTRIBUTE_INTEGER, ATTRIBUTE_STRING, ATTRIBUTE_UNDECLARED, FUNCTION, LITERAL_DOUBLE, LITERAL_GEOMETRY, LITERAL_INTEGER, LITERAL_LONG, LITERAL_STRING, LITERAL_UNDECLARED, MATH_ADD, MATH_DIVIDE, MATH_MULTIPLY, MATH_SUBTRACT
 
Fields inherited from interface Expression
NIL
 
Constructor Summary
protected FunctionExpressionImpl(FunctionName functionName)
          Preferred constructor to ensure name and functionName match.
protected FunctionExpressionImpl(Name name)
           
protected FunctionExpressionImpl(Name name, Literal fallback)
          Creates a new instance of FunctionExpression
protected FunctionExpressionImpl(String name)
           
protected FunctionExpressionImpl(String name, Literal fallback)
          Creates a new instance of FunctionExpression
 
Method Summary
 Object accept(ExpressionVisitor visitor, Object extraData)
          Accepts a visitor.
 boolean equals(Object obj)
           
protected static FunctionName functionName(String name, String ret, String... args)
          Convenience method for creating a function name.
 int getArgCount()
          Gets the number of arguments that are set.
 Expression[] getArgs()
          Deprecated. use getParameters().
protected  Expression getExpression(int index)
          Utility method for subclasses to ask for an argument at a given index
 Literal getFallbackValue()
          The value of the fallbackValue attribute is used as a default value, if the SE implementation does not support the function.
 FunctionName getFunctionName()
          Access to the FunctionName description as used in a FilterCapabilities document.
 Map<RenderingHints.Key,?> getImplementationHints()
          Returns the implementation hints.
 String getName()
          Gets the name of this function.
 List<Expression> getParameters()
          Returns the function parameters.
 short getType()
          Gets the type of this expression.
 void setArgs(Expression[] args)
          Deprecated. use setParameters(List)
 void setFallbackValue(Literal fallback)
           
 void setName(String name)
          Sets the name of the function.
 void setParameters(List params)
          Sets the function parameters.
 String toString()
          Creates a String representation of this Function with the function name and the arguments.
 
Methods inherited from class DefaultExpression
accept, evaluate, evaluate, getValue, isAttributeExpression, isExpression, isFunctionExpression, isGeometryExpression, isLiteralExpression, isMathExpression, isMathExpression
 
Methods inherited from class ExpressionAbstract
eval, eval, evaluate
 
Methods inherited from class Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface Expression
accept, evaluate, getValue
 
Methods inherited from interface Expression
evaluate, evaluate
 

Field Detail

name

protected String name
function name


params

protected List<Expression> params
function params


fallback

protected Literal fallback

functionName

protected FunctionName functionName
FunctionName provided by subclass; or lazely created

Constructor Detail

FunctionExpressionImpl

protected FunctionExpressionImpl(FunctionName functionName)
Preferred constructor to ensure name and functionName match.

Recommended use:

 import static org.geotools.filter.capability.FunctionNameImpl.*;
 public class AreaFunction extends FunctionExpressionImpl { 
     
   public static FunctionName NAME = new FunctionNameImpl("Area",
        parameter("area",Double.class),
        parameter("geometry",Geometry.class));
 
 public AreaFunction() {
     super(NAME);
 }
 

Parameters:
functionName - FunctionName describing subclass

FunctionExpressionImpl

protected FunctionExpressionImpl(String name)

FunctionExpressionImpl

protected FunctionExpressionImpl(Name name)

FunctionExpressionImpl

protected FunctionExpressionImpl(String name,
                                 Literal fallback)
Creates a new instance of FunctionExpression


FunctionExpressionImpl

protected FunctionExpressionImpl(Name name,
                                 Literal fallback)
Creates a new instance of FunctionExpression

Method Detail

getType

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

Specified by:
getType in interface FunctionExpression
Overrides:
getType in class DefaultExpression
Returns:
the short representation of a function expression.

getName

public String getName()
Gets the name of this function.

Specified by:
getName in interface FunctionExpression
Specified by:
getName in interface Function
Returns:
the name of the function.

getFunctionName

public FunctionName getFunctionName()
Description copied from interface: Function
Access to the FunctionName description as used in a FilterCapabilities document.

Specified by:
getFunctionName in interface Function
Returns:
FunctionName description, if available.

setName

public void setName(String name)
Sets the name of the function.


getFallbackValue

public Literal getFallbackValue()
Description copied from interface: Function
The value of the fallbackValue attribute is used as a default value, if the SE implementation does not support the function. If the implementation supports the function, then the result value is determined by executing the function.

Specified by:
getFallbackValue in interface Function
Returns:
Optional literal to use if an implementation for this function is not available.

setFallbackValue

public void setFallbackValue(Literal fallback)

getParameters

public List<Expression> getParameters()
Returns the function parameters.

Specified by:
getParameters in interface Function

setParameters

public void setParameters(List params)
Sets the function parameters.

Specified by:
setParameters in interface FunctionExpression

getArgs

public Expression[] getArgs()
Deprecated. use getParameters().

Since this class is heavily subclasses within the geotools toolkit itself we relax the 'final' restriction of this deprecated method.

Specified by:
getArgs in interface FunctionExpression
Returns:
an array of the args to be evaluated.

setArgs

public void setArgs(Expression[] args)
Deprecated. use setParameters(List)

Since this class is heavily subclassed within the geotools toolkit itself we relax the 'final' restriction of this deprecated method.

Specified by:
setArgs in interface FunctionExpression
Parameters:
args - an array of expressions to be evaluated.

getArgCount

public int getArgCount()
Gets the number of arguments that are set.

Specified by:
getArgCount in interface FunctionExpression
Returns:
the number of args.

accept

public Object accept(ExpressionVisitor visitor,
                     Object extraData)
Description copied from interface: Expression
Accepts a visitor. Subclasses must implement with a method whose content is the following:
return visitor.visit(this, extraData);

Specified by:
accept in interface Expression
See Also:
Expression.accept(ExpressionVisitor, Object)

getImplementationHints

public Map<RenderingHints.Key,?> getImplementationHints()
Returns the implementation hints. The default implementation returns an empty map.

Specified by:
getImplementationHints in interface Factory
Returns:
The map of hints, or an empty map if none.

functionName

protected static FunctionName functionName(String name,
                                           String ret,
                                           String... args)
Convenience method for creating a function name.

See Also:
FunctionImpl.functionName(String, String, String...)

toString

public String toString()
Creates a String representation of this Function with the function name and the arguments. The String created should be good for most subclasses

Overrides:
toString in class Object

getExpression

protected Expression getExpression(int index)
Utility method for subclasses to ask for an argument at a given index

Parameters:
index -
Returns:

equals

public boolean equals(Object obj)
Overrides:
equals in class Object


Copyright © 1996-2014 Geotools. All Rights Reserved.