org.geotools.filter
Class RecodeFunction

Object
  extended by RecodeFunction
All Implemented Interfaces:
Expression, Function

public class RecodeFunction
extends Object
implements 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.

Author:
Johann Sorel (Geomatys), Michael Bedward
Module:
modules/library/render (gt-render.jar)

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

Field Detail

NAME

public static final FunctionName NAME
Make the instance of FunctionName available in a consistent spot.

Constructor Detail

RecodeFunction

public RecodeFunction()

RecodeFunction

public RecodeFunction(List<Expression> parameters,
                      Literal fallback)
Method Detail

getName

public String getName()
Specified by:
getName in interface Function

getParameters

public List<Expression> getParameters()
Specified by:
getParameters in interface Function

accept

public Object accept(ExpressionVisitor visitor,
                     Object extraData)
Specified by:
accept in interface Expression

evaluate

public Object evaluate(Object object)
Specified by:
evaluate in interface Expression

evaluate

public <T> T evaluate(Object object,
                      Class<T> context)
Specified by:
evaluate in interface Expression

getFallbackValue

public Literal getFallbackValue()
Specified by:
getFallbackValue in interface Function


Copyright © 1996-2010 Geotools. All Rights Reserved.