org.openanzo.glitter.expression
Class PolymorphicFunction

java.lang.Object
  extended by org.openanzo.glitter.expression.PolymorphicFunction
All Implemented Interfaces:
Function, FunctionOnValues
Direct Known Subclasses:
PolymorphicEq, PolymorphicGe, PolymorphicGt, PolymorphicLe, PolymorphicLt, PolymorphicNe

public abstract class PolymorphicFunction
extends java.lang.Object
implements FunctionOnValues

Base class for functions that have different behavior (corresponding to different Functions) depending on the arguments given.

Author:
lee

Constructor Summary
PolymorphicFunction(FunctionOnValues[] functions)
           
 
Method Summary
 RDFTerm call(java.util.List<RDFTerm> arguments)
          See FunctionOnValues.call(List)
 java.net.URI getIdentifier()
          All of SPARQL's spec'ed out polymorphic functions are actually operators without a URI.
 boolean operatesOnTypeErrors()
           
 boolean operatesOnValues()
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PolymorphicFunction

public PolymorphicFunction(FunctionOnValues[] functions)
Parameters:
functions - An ordered list of functions that implement this polymorphic function.
Method Detail

call

public RDFTerm call(java.util.List<RDFTerm> arguments)
             throws ExpressionEvaluationException
See FunctionOnValues.call(List)

Specified by:
call in interface FunctionOnValues
Parameters:
arguments - The (evaluated) RDF terms being passed to the function
Returns:
The return value of the first function that comprise this polymorphic function that does not result in an ExpressionEvaluationException when invoked.
Throws:
ExpressionEvaluationException - For invalid types, or other expression evalutaion problems

getIdentifier

public java.net.URI getIdentifier()
All of SPARQL's spec'ed out polymorphic functions are actually operators without a URI.

Specified by:
getIdentifier in interface Function
Returns:
The identifier for this function

operatesOnTypeErrors

public boolean operatesOnTypeErrors()
Specified by:
operatesOnTypeErrors in interface Function
Returns:
true if the function can process type errors as arguments; false if the function simply propagates type errors

operatesOnValues

public boolean operatesOnValues()
Specified by:
operatesOnValues in interface Function
Returns:
true if this function's arguments should be values evaluated in the context of the environment created from each set of bindings (solution); false if the function operates directly on the surface term (e.g. a hypothetical function isVariable would operate on terms and return false)


Copyright © 2007 Cambridge Semantics Inc.. All Rights Reserved.