org.geotools.filter
Class RecodeFunction

java.lang.Object
  extended by org.geotools.filter.RecodeFunction
All Implemented Interfaces:
org.opengis.filter.expression.Expression, org.opengis.filter.expression.Function

public class RecodeFunction
extends java.lang.Object
implements org.opengis.filter.expression.Function

This is an implemenation of the Recode function as defined by the OGC Symbology Encoding (SE) 1.1 specification.

The Recode function provides a lookup table facility (think HashTable) where both keys and values can be any Expression. The first parameter to the function specifies the source of the value to lookup, e.g. the name of a feature property as a Literal. The remaining parameters define the lookup table as key:value pairs. Thus there should be an odd number of parameters in total: the lookup value parameter plus the set of key value pairs.

Where the lookup involves String values, comparisons are done case-insensitively.

If the lookup value does not match any of the keys defined this function returns null.

Version:
$Id: RecodeFunction.java 35579 2010-05-25 10:39:16Z mbedward $
Author:
Johann Sorel (Geomatys), Michael Bedward

Nested Class Summary
static class RecodeFunction.Name
          Describe how this function works.
 
Field Summary
static org.opengis.filter.capability.FunctionName NAME
          Make the instance of FunctionName available in a consistent spot.
 
Fields inherited from interface org.opengis.filter.expression.Expression
NIL
 
Constructor Summary
RecodeFunction()
           
RecodeFunction(java.util.List<org.opengis.filter.expression.Expression> parameters, org.opengis.filter.expression.Literal fallback)
           
 
Method Summary
 java.lang.Object accept(org.opengis.filter.expression.ExpressionVisitor visitor, java.lang.Object extraData)
           
 java.lang.Object evaluate(java.lang.Object object)
           
<T> T
evaluate(java.lang.Object object, java.lang.Class<T> context)
           
 org.opengis.filter.expression.Literal getFallbackValue()
           
 java.lang.String getName()
           
 java.util.List<org.opengis.filter.expression.Expression> getParameters()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

NAME

public static final org.opengis.filter.capability.FunctionName NAME
Make the instance of FunctionName available in a consistent spot.

Constructor Detail

RecodeFunction

public RecodeFunction()

RecodeFunction

public RecodeFunction(java.util.List<org.opengis.filter.expression.Expression> parameters,
                      org.opengis.filter.expression.Literal fallback)
Method Detail

getName

public java.lang.String getName()
Specified by:
getName in interface org.opengis.filter.expression.Function

getParameters

public java.util.List<org.opengis.filter.expression.Expression> getParameters()
Specified by:
getParameters in interface org.opengis.filter.expression.Function

accept

public java.lang.Object accept(org.opengis.filter.expression.ExpressionVisitor visitor,
                               java.lang.Object extraData)
Specified by:
accept in interface org.opengis.filter.expression.Expression

evaluate

public java.lang.Object evaluate(java.lang.Object object)
Specified by:
evaluate in interface org.opengis.filter.expression.Expression

evaluate

public <T> T evaluate(java.lang.Object object,
                      java.lang.Class<T> context)
Specified by:
evaluate in interface org.opengis.filter.expression.Expression

getFallbackValue

public org.opengis.filter.expression.Literal getFallbackValue()
Specified by:
getFallbackValue in interface org.opengis.filter.expression.Function


Copyright © 1996-2010 Geotools. All Rights Reserved.