dods.dap.Server
Class AbstractClause

java.lang.Object
  extended by dods.dap.Server.AbstractClause
All Implemented Interfaces:
Clause
Direct Known Subclasses:
BoolFunctionClause, BTFunctionClause, DereferenceClause, RelOpClause, ValueClause

public abstract class AbstractClause
extends Object
implements Clause

Provides default implementations for the Clause interface methods. This eliminates redundant code and provides a starting point for new implementations of Clause.

Note that every Clause object is expected to implement either SubClause or TopLevelClause. No default implementations are provided for the methods of these subinterfaces

Also note that it is not necessary to use this class to create your own implementations, it's just a convenience.

The class has no abstract methods, but is declared abstract because it should not be directly instantiated.

Author:
joew

Field Summary
protected  List children
          A list of SubClause objects representing the sub-clauses of this clause.
protected  boolean constant
          Value to be returned by isConstant().
protected  boolean defined
          Value to be returned by isDefined().
 
Constructor Summary
AbstractClause()
           
 
Method Summary
 List getChildren()
          Returns an ordered list of this clause's sub-clauses.
 boolean isConstant()
          A clause is considered "constant" iff it and its subclauses do not refer to data values from the dataset being constrained.
 boolean isDefined()
          Returns whether or not the clause has a defined value.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

constant

protected boolean constant
Value to be returned by isConstant(). Should not change for the lifetime of the object.


defined

protected boolean defined
Value to be returned by isDefined(). May change during the lifetime of the object.


children

protected List children
A list of SubClause objects representing the sub-clauses of this clause. Use caution when modifying this list other than at the point of creation, since methods such as evaluate() depend on it.

Constructor Detail

AbstractClause

public AbstractClause()
Method Detail

getChildren

public List getChildren()
Description copied from interface: Clause
Returns an ordered list of this clause's sub-clauses. If the clause has no sub-clauses, an empty list will be returned.

Specified by:
getChildren in interface Clause

isConstant

public boolean isConstant()
Description copied from interface: Clause
A clause is considered "constant" iff it and its subclauses do not refer to data values from the dataset being constrained. A constant clause is defined as soon as it is created, and is guaranteed not to change its value during its lifetime.

Specified by:
isConstant in interface Clause

isDefined

public boolean isDefined()
Description copied from interface: Clause
Returns whether or not the clause has a defined value. Non-constant clauses do not have a defined value until they are evaluated for the first time. Methods for evaluating are found in the TopLevelClause and SubClause interfaces.

Specified by:
isDefined in interface Clause