com.cafesoft.cams.attr.func
Interface Function

All Known Implementing Classes:
AbstractFunction, MatchFunction

public interface Function

Function defines the interface for objects that take an ordered list of typed arguments and evaluates/returns a result.

Since:
4/14/2004

Method Summary
 void checkArgList(List argList)
          Checks that the given argList contains Evaluatables of the right types, in the right order, and are the right number for this function to evaluate.
 void checkArgListAllowBags(List argList)
          Checks that the given argList contains Evaluatables of the right types, in the right order, and are the right number for this function to evaluate.
 EvaluationResult evaluate(List argList, EvaluationContext evalContext)
          Evaluates the Function using the given list of arguments.
 int getFunctionId()
          Get the integer function identifier for this particular object.
 String getFunctionName()
          Get the name of the function for this particular object.
 URI getIdentifier()
          Get the identifier of this function.
 URI getReturnType()
          Get the type of AttributeValue that this function returns from a successful evaluate invocation.
 boolean returnsBag()
          Indicate whether this function will return a bag of values or just a single value.
 

Method Detail

evaluate

EvaluationResult evaluate(List argList,
                          EvaluationContext evalContext)
Evaluates the Function using the given list of arguments. The List contains Evaluatables which must be of the correct type. Each parameter should be evaluated by the Function, unless it does not need to evaluate all inputs to determine a result.

Parameters:
argList - the List of arguments for the function, which must be the appropriate number of Evaluatables of the correct type.
evalContext - the representation of the request
Returns:
a result containing the AttributeValue computed when evaluating the function, or Status specifying some error condition

getIdentifier

URI getIdentifier()
Get the identifier of this function.

Returns:
the function's identifier

getFunctionName

String getFunctionName()
Get the name of the function for this particular object.

Returns:
the function name.

getFunctionId

int getFunctionId()
Get the integer function identifier for this particular object.

Returns:
the integer function identifier.

getReturnType

URI getReturnType()
Get the type of AttributeValue that this function returns from a successful evaluate invocation.

Returns:
the type returned by this function

returnsBag

boolean returnsBag()
Indicate whether this function will return a bag of values or just a single value.

Returns:
true if evaluation will return a bag, else false.

checkArgList

void checkArgList(List argList)
                  throws IllegalArgumentException
Checks that the given argList contains Evaluatables of the right types, in the right order, and are the right number for this function to evaluate. If the function cannot accept the inputs for evaluation, an IllegalArgumentException is thrown.

Parameters:
argList - a List of Evaluatables
Throws:
IllegalArgumentException - if the arguments do match what the function accepts for evaluation

checkArgListAllowBags

void checkArgListAllowBags(List argList)
                           throws IllegalArgumentException
Checks that the given argList contains Evaluatables of the right types, in the right order, and are the right number for this function to evaluate. If the function cannot accept the arguments for evaluation, an IllegalArgumentException is thrown. This check allows arguments that evaluate to a bag and must be invoked by callers that invoke the function over a bag of arguments.

Parameters:
argList - a List of Evaluatables
Throws:
IllegalArgumentException - if the arguments do match what the function accepts for evaluation


Generated on 10:38:35 AM April 14, 2011, © 1996-2010 Cafésoft LLC. All rights reserved.