dods.dap.Server
Class BTFunctionClause

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

public class BTFunctionClause
extends AbstractClause
implements SubClause

Represents a clause which invokes a function that returns a BaseType.

Author:
joew
See Also:
ClauseFactory

Field Summary
protected  BTFunction function
           
protected  Clause parent
           
protected  dods.dap.BaseType value
           
 
Fields inherited from class dods.dap.Server.AbstractClause
children, constant, defined
 
Constructor Summary
protected BTFunctionClause(BTFunction function, List children)
          Creates a new BTFunctionClause.
 
Method Summary
 dods.dap.BaseType evaluate()
          Evaluates the clause, first calling evaluate() on any sub-clauses it contains.
 BTFunction getFunction()
          Returns the server-side function invoked by this clause
 Clause getParent()
          Returns the Clause which contains this subclause.
 dods.dap.BaseType getValue()
          Returns a BaseType containing the current value of the sub-clause.
 void setParent(Clause parent)
          Sets the parent of this subclause.
 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

parent

protected Clause parent

function

protected BTFunction function

value

protected dods.dap.BaseType value
Constructor Detail

BTFunctionClause

protected BTFunctionClause(BTFunction function,
                           List children)
                    throws SDODSException
Creates a new BTFunctionClause.

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 immediately.
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

getParent

public Clause getParent()
Description copied from interface: SubClause
Returns the Clause which contains this subclause. The clause returned may be a TopLevelClause or another SubClause.

Specified by:
getParent in interface SubClause

getValue

public dods.dap.BaseType getValue()
Description copied from interface: SubClause
Returns a BaseType containing the current value of the sub-clause. Sub-clauses that are not constant have an undefined value until the evaluate() method has been called. However, in such circumstances this method is still useful, as it indicates which class of BaseType the sub-clause will evaluate to. Implementations of this method should never return null.

Specified by:
getValue in interface SubClause

evaluate

public dods.dap.BaseType evaluate()
                           throws SDODSException
Description copied from interface: SubClause
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 SubClause
Throws:
SDODSException - Thrown if the evaluation fails for any reason.

setParent

public void setParent(Clause parent)
Description copied from interface: SubClause
Sets the parent of this subclause. Used during parsing.

Specified by:
setParent in interface SubClause

getFunction

public BTFunction 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