net.cscott.sdr.calls
Class Predicate
java.lang.Object
net.cscott.sdr.calls.ExprFunc<Boolean>
net.cscott.sdr.calls.Predicate
public abstract class Predicate
- extends ExprFunc<Boolean>
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 predicates to yield a boolean result. The
Expr
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
Predicate
public Predicate()
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.
- Specified by:
getName
in class ExprFunc<Boolean>
evaluate
public abstract boolean evaluate(DanceState ds,
List<Expr> args)
throws ExprFunc.EvaluationException
- Evaluates this predicate with the arguments given in the list of
Expr
nodes, returning a boolean.
- Throws:
ExprFunc.EvaluationException
evaluate
public Boolean evaluate(Class<? super Boolean> type,
DanceState ds,
List<Expr> args)
throws ExprFunc.EvaluationException
- Description copied from class:
ExprFunc
- Perform the operation of the
ExprFunc
on the given list of
arguments args
, yielding a value of the specified type
.
The DanceState
ds
is used as context for the
evaluation.
- Specified by:
evaluate
in class ExprFunc<Boolean>
- Throws:
ExprFunc.EvaluationException
- on type mismatch or other unexpected
conditions.
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
.
Copyright © 2006-2009 C. Scott Ananian