net.cscott.sdr.calls
Class Matcher
java.lang.Object
net.cscott.sdr.calls.ExprFunc<FormationMatch>
net.cscott.sdr.calls.Matcher
public abstract class Matcher
- extends ExprFunc<FormationMatch>
A Matcher
takes a formation and pulls out all instances of
a sub-formation. For example, given facing lines, the
FACING_COUPLES matcher would extract the two instances of facing
couples. Each instance of a facing couple could then be
decomposed into two FACING_DANCERS. Subformations are in standard
orientations (see FormationList
) and the dancers can be
numbered in a standard left-to-right top-to-bottom order using
Formation.sortedDancers()
.
Matcher
public Matcher()
match
public abstract FormationMatch match(Formation f)
throws NoMatchException
- Match sub-formations from a formation. The
subformation may be as large as the original formation -- or even
larger, if phantoms are generated; it may also be as small as a
single dancer. If the given formation can't be matched from
the current dancer configuration, throws
NoMatchException
.
- Throws:
NoMatchException
evaluate
public final FormationMatch evaluate(Class<? super FormationMatch> type,
DanceState ds,
List<Expr> args)
throws ExprFunc.EvaluationException
- Implement the
ExprFunc
contract.
- Specified by:
evaluate
in class ExprFunc<FormationMatch>
- Throws:
ExprFunc.EvaluationException
- on type mismatch or other unexpected
conditions.
toString
public String toString()
- Overrides:
toString
in class Object
valueOf
public static Matcher valueOf(String s)
- Throws:
IllegalArgumentException
- if the matcher is unknown.
Copyright © 2006-2009 C. Scott Ananian