dods.dap.Server
Class BoolFunctionClause

java.lang.Object
  extended by dods.dap.Server.AbstractClause
      extended by dods.dap.Server.BoolFunctionClause
All Implemented Interfaces:
Clause, TopLevelClause

public class BoolFunctionClause
extends AbstractClause
implements TopLevelClause

Represents a clause which invokes a function that returns a boolean value.

Author:
joew
See Also:
ClauseFactory

Field Summary
protected  BoolFunction function
           
protected  boolean value
           
 
Fields inherited from class dods.dap.Server.AbstractClause
children, constant, defined
 
Constructor Summary
protected BoolFunctionClause(BoolFunction function, List children)
          Creates a new BoolFunctionClause.
 
Method Summary
 boolean evaluate()
          Evaluates the clause, first calling evaluate() on any sub-clauses it contains.
 BoolFunction getFunction()
          Returns the server-side function invoked by this clause
 boolean getValue()
          Returns the current value of the clause.
 String toString()
          Prints the original string representation of this clause.
 
Methods inherited from class dods.dap.Server.AbstractClause
getChildren, isConstant, isDefined
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface dods.dap.Server.Clause
getChildren, isConstant, isDefined
 

Field Detail

function

protected BoolFunction function

value

protected boolean value
Constructor Detail

BoolFunctionClause

protected BoolFunctionClause(BoolFunction function,
                             List children)
                      throws SDODSException
Creates a new BoolFunctionClause.

Parameters:
function - The function invoked by the clause
children - A list of SubClauses, to be given as arguments to the function. If all the arguments are constant, the function clause will be flagged as constant, and evaluated immediatelyx.
Throws:
SDODSException - Thrown if either 1) the function does not accept the arguments given, or 2) the clause is constant, and the attempt to evaluate it fails.
Method Detail

getValue

public boolean getValue()
Description copied from interface: TopLevelClause
Returns the current value of the clause. The value of non-constant Clauses is undefined until the evaluate() method has been called.

Specified by:
getValue in interface TopLevelClause

evaluate

public boolean evaluate()
                 throws SDODSException
Description copied from interface: TopLevelClause
Evaluates the clause, first calling evaluate() on any sub-clauses it contains. Implementations of this method should flag the clause as "defined" if the evaluation is successful.

Specified by:
evaluate in interface TopLevelClause
Throws:
SDODSException - Thrown if the evaluation fails for any reason.

getFunction

public BoolFunction getFunction()
Returns the server-side function invoked by this clause


toString

public String toString()
Prints the original string representation of this clause. For use in debugging.

Overrides:
toString in class Object