dods.dap.Server
Class ClauseFactory

java.lang.Object
  extended by dods.dap.Server.ClauseFactory

public class ClauseFactory
extends Object

Represents a source of Clause objects for the constraint expression parser. By inheriting from this class and overriding the "newX" methods, you can create a factory that provides your own Clause objects instead of the default ones. This custom factory can be given to the parser via the CEEvaluator interface.

See Also:
CEEvaluator

Field Summary
protected  FunctionLibrary functionLibrary
           
 
Constructor Summary
ClauseFactory()
          Creates a new clause factory with a blank function library.
ClauseFactory(FunctionLibrary functionLibrary)
          Creates a clause factory which uses the specified function library.
 
Method Summary
 TopLevelClause newBoolFunctionClause(String functionName, List children)
          Generates a clause which invokes a function that returns a boolean value.
 SubClause newBTFunctionClause(String functionName, List children)
          Generates a clause which invokes a function that returns a BaseType.
 SubClause newDereferenceClause(String url)
          Generates a clause representing a remote value, referenced by a URL.
 TopLevelClause newRelOpClause(int operator, SubClause lhs, List rhs)
          Generates a clause which which compares subclauses, using one of the relative operators supported by the Operator class.
 SubClause newValueClause(dods.dap.BaseType value, boolean constant)
          Generates a clause representing a simple value, such as "var1" or "19".
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

functionLibrary

protected FunctionLibrary functionLibrary
Constructor Detail

ClauseFactory

public ClauseFactory()
Creates a new clause factory with a blank function library. This constructor is sufficient for servers with no server side functions.

See Also:
FunctionLibrary

ClauseFactory

public ClauseFactory(FunctionLibrary functionLibrary)
Creates a clause factory which uses the specified function library. This constructor allows you to parse CE's using a customized function library.

Parameters:
functionLibrary - The function library that will be used when creating clauses that invoke server-side functions.
Method Detail

newRelOpClause

public TopLevelClause newRelOpClause(int operator,
                                     SubClause lhs,
                                     List rhs)
                              throws SDODSException
Generates a clause which which compares subclauses, using one of the relative operators supported by the Operator class.

Throws:
SDODSException

newBoolFunctionClause

public TopLevelClause newBoolFunctionClause(String functionName,
                                            List children)
                                     throws SDODSException,
                                            dods.dap.NoSuchFunctionException
Generates a clause which invokes a function that returns a boolean value.

Throws:
SDODSException
dods.dap.NoSuchFunctionException
See Also:
BoolFunctionClause

newValueClause

public SubClause newValueClause(dods.dap.BaseType value,
                                boolean constant)
                         throws SDODSException
Generates a clause representing a simple value, such as "var1" or "19".

Throws:
SDODSException
See Also:
ValueClause

newBTFunctionClause

public SubClause newBTFunctionClause(String functionName,
                                     List children)
                              throws SDODSException,
                                     dods.dap.NoSuchFunctionException
Generates a clause which invokes a function that returns a BaseType.

Throws:
SDODSException
dods.dap.NoSuchFunctionException
See Also:
BTFunctionClause

newDereferenceClause

public SubClause newDereferenceClause(String url)
                               throws SDODSException
Generates a clause representing a remote value, referenced by a URL. Note that dereferencing is not currently supported, and the default implementation of this clause type throws an exception when it is evaluated.

Throws:
SDODSException
See Also:
DereferenceClause