org.geotools.filter.function
Class Collection_MaxFunction

java.lang.Object
  extended byorg.geotools.filter.expression.ExpressionAbstract
      extended byorg.geotools.filter.DefaultExpression
          extended byorg.geotools.filter.FunctionExpressionImpl
              extended byorg.geotools.filter.function.Collection_MaxFunction
All Implemented Interfaces:
org.opengis.filter.expression.Expression, Expression, ExpressionType, Factory, org.opengis.filter.expression.Function, FunctionExpression

public class Collection_MaxFunction
extends FunctionExpressionImpl
implements FunctionExpression

Calculates the maximum value of an attribute for a given FeatureCollection and Expression.

Since:
2.2M2
Author:
Cory Horner

Field Summary
 
Fields inherited from class org.geotools.filter.DefaultExpression
expressionType, permissiveConstruction
 
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
Collection_MaxFunction()
          Creates a new instance of Collection_MaxFunction
 
Method Summary
static CalcResult calculateMax(FeatureCollection collection, Expression expression)
          Calculate maximum (using FeatureCalc) - only one parameter is used.
 java.lang.Object evaluate(Feature feature)
          Evaluates the expression against an instance of Feature.
 int getArgCount()
          Returns the number of arguments this requires.
 Expression[] getArgs()
          Should be an xPath of the form: featureMembers/asterisk/NAME
 java.lang.String getName()
          Gets the name of this function.
 void setArgs(Expression[] args)
          The provided arguments are evaulated with respect to the FeatureCollection.
 void setExpression(Expression e)
           
 java.lang.String toString()
          Return this function as a string.
 
Methods inherited from class org.geotools.filter.FunctionExpressionImpl
accept, getImplementationHints, getParameters, getType, setName, setParameters
 
Methods inherited from class org.geotools.filter.DefaultExpression
accept, evaluate, getValue, isAttributeExpression, isExpression, isGeometryExpression, isLiteralExpression, isMathExpression, isMathExpression
 
Methods inherited from class org.geotools.filter.expression.ExpressionAbstract
eval
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.geotools.filter.expression.FunctionExpression
getType
 
Methods inherited from interface org.geotools.filter.expression.Expression
accept, getValue
 
Methods inherited from interface org.opengis.filter.expression.Expression
accept, evaluate
 
Methods inherited from interface org.geotools.factory.Factory
getImplementationHints
 
Methods inherited from interface org.opengis.filter.expression.Function
getParameters, setName, setParameters
 

Constructor Detail

Collection_MaxFunction

public Collection_MaxFunction()
Creates a new instance of Collection_MaxFunction

Method Detail

getName

public java.lang.String getName()
Description copied from interface: FunctionExpression
Gets the name of this function.

Specified by:
getName in interface FunctionExpression
Overrides:
getName in class FunctionExpressionImpl
Returns:
the name of the function.

getArgCount

public int getArgCount()
Description copied from interface: FunctionExpression
Returns the number of arguments this requires. For example [arg1][arg2]. This function must have EXACTLY 2 arguments, so this function would return 2. The parser might use this information to ensure validity, and its also for reporting capabilities. NOTE: this was previously javadoc-ed incorrectly, please note the new definition. NOTE: you cannot have a function with a variable number of arguments.

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

calculateMax

public static CalcResult calculateMax(FeatureCollection collection,
                                      Expression expression)
                               throws IllegalFilterException,
                                      java.io.IOException
Calculate maximum (using FeatureCalc) - only one parameter is used.

Parameters:
collection - collection to calculate the maximum
expression - Single Expression argument
Returns:
An object containing the maximum value of the attributes
Throws:
IllegalFilterException
java.io.IOException

setArgs

public void setArgs(Expression[] args)
The provided arguments are evaulated with respect to the FeatureCollection.

For an aggregate function (like max) please use the WFS mandated XPath syntax to refer to featureMember content.

To refer to all 'X': featureMember/asterisk/X

Specified by:
setArgs in interface FunctionExpression
Overrides:
setArgs in class FunctionExpressionImpl
Parameters:
args - DOCUMENT ME!
Throws:
java.lang.IllegalArgumentException - DOCUMENT ME!

evaluate

public java.lang.Object evaluate(Feature feature)
Description copied from interface: Expression
Evaluates the expression against an instance of Feature.

Specified by:
evaluate in interface Expression
Overrides:
evaluate in class DefaultExpression
Parameters:
feature - Specified feature to use when returning value.
Returns:
The value of this expression based on the feature.

setExpression

public void setExpression(Expression e)

getArgs

public Expression[] getArgs()
Should be an xPath of the form: featureMembers/asterisk/NAME

Specified by:
getArgs in interface FunctionExpression
Overrides:
getArgs in class FunctionExpressionImpl
Returns:

toString

public java.lang.String toString()
Return this function as a string.

Returns:
String representation of this max function.


Copyright © GeoTools. All Rights Reserved.