sdr 0.7

net.cscott.sdr.calls
Class Matcher

java.lang.Object
  extended by net.cscott.sdr.calls.ExprFunc<FormationMatch>
      extended by 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().


Nested Class Summary
 
Nested classes/interfaces inherited from class net.cscott.sdr.calls.ExprFunc
ExprFunc.EvaluationException
 
Constructor Summary
Matcher()
           
 
Method Summary
 FormationMatch evaluate(Class<? super FormationMatch> type, DanceState ds, List<Expr> args)
          Implement the ExprFunc contract.
abstract  FormationMatch match(Formation f)
          Match sub-formations from a formation.
 String toString()
           
static Matcher valueOf(String s)
           
 
Methods inherited from class net.cscott.sdr.calls.ExprFunc
getName, isConstant
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Matcher

public Matcher()
Method Detail

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.

sdr 0.7

Copyright © 2006-2009 C. Scott Ananian