sdr 0.21

net.cscott.sdr.calls
Class Predicate

java.lang.Object
  extended by net.cscott.sdr.calls.Predicate

public abstract class Predicate
extends Object

A Predicate is a boolean test on the current formation and dance state, or else an operator on such boolean tests. For example, there are simple predicates such as "PROGRAM AT LEAST(foo)" which takes as an argument some dance program foo, as well as "and" and "or" predicates which combine other predicate to yield a boolean result. The Condition object in the call tree represents the unevaluated arguments of a Predicate application.

Version:
$Id: Predicate.java,v 1.3 2006-10-17 16:29:01 cananian Exp $
Author:
C. Scott Ananian

Constructor Summary
Predicate()
           
 
Method Summary
 boolean equals(Object o)
           
abstract  boolean evaluate(DanceState ds, Formation f, Condition c)
          Evaluates this predicate with the arguments given in the Condition node, returning a boolean.
abstract  String getName()
          The name of this predicate, in our internal jargon.
 int hashCode()
           
static Predicate lookup(String s)
          Lookup a Predicate in the PredicateList.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Predicate

public Predicate()
Method Detail

getName

public abstract String getName()
The name of this predicate, in our internal jargon. This is meant to be human-readable, but is likely not exactly anything a caller would say.


evaluate

public abstract boolean evaluate(DanceState ds,
                                 Formation f,
                                 Condition c)
Evaluates this predicate with the arguments given in the Condition node, returning a boolean. Note that the predicate field of c should match @{link Predicate#getName(String) this.getName()}.


toString

public final String toString()
Overrides:
toString in class Object

hashCode

public final int hashCode()
Overrides:
hashCode in class Object

equals

public final boolean equals(Object o)
Overrides:
equals in class Object

lookup

public static Predicate lookup(String s)
Lookup a Predicate in the PredicateList.


sdr 0.21

Copyright (c) 2006 C. Scott Ananian