|
sdr 0.5 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnet.cscott.sdr.calls.transform.Evaluator
public abstract class Evaluator
An Evaluator
represents a current dance context.
Evaluators are usually stacked: the standard evaluator
might call down into a child evaluator for the "tandem"
concept, for example, which will then reinvoke the standard
evaluator to evaluate "trade". Evaluators keep a continuation
context, since each call to evaluate(net.cscott.sdr.calls.DanceState)
does
only "one part" of a call — the remaining parts go
in the continuation.
As the Evaluator
s operate, they accumulate dancer movements
and actions in a DanceState
.
js> importPackage(net.cscott.sdr.calls); js> ds = new DanceState(new DanceProgram(Program.C4), Formation.SQUARED_SET); undefined; js> ds.currentFormation().toStringDiagram("|"); | 3Gv 3Bv | |4B> 2G< | |4G> 2B< | | 1B^ 1G^ js> comp = CallDB.INSTANCE.parse(ds.dance.program, "heads start"); (Apply heads start) js> comp = new net.cscott.sdr.calls.ast.Seq(comp); (Seq (Apply heads start)) js> e = new Evaluator.Standard(comp); net.cscott.sdr.calls.transform.Evaluator$Standard@166cb16 js> e.evaluateAll(ds); js> Breather.breathe(ds.currentFormation()).toStringDiagram("|"); |4B> 3Gv 3Bv 2G< | |4G> 1B^ 1G^ 2B<
js> importPackage(net.cscott.sdr.calls); js> ds = new DanceState(new DanceProgram(Program.C4), Formation.SQUARED_SET); undefined; js> ds.currentFormation().toStringDiagram("|"); | 3Gv 3Bv | |4B> 2G< | |4G> 2B< | | 1B^ 1G^ js> comp = CallDB.INSTANCE.parse(ds.dance.program, "heads pair off"); (Apply heads pair off) js> comp = new net.cscott.sdr.calls.ast.Seq(comp); (Seq (Apply heads pair off)) js> e = new Evaluator.Standard(comp); net.cscott.sdr.calls.transform.Evaluator$Standard@166cb16 js> e.evaluateAll(ds); js> Breather.breathe(ds.currentFormation()).toStringDiagram("|"); |4B> 3G< 3B> 2G< | |4G> 1B< 1G> 2B<
js> importPackage(net.cscott.sdr.calls); js> ds = new DanceState(new DanceProgram(Program.C4), Formation.FOUR_SQUARE); undefined; js> Breather.breathe(ds.currentFormation()).toStringDiagram("|"); |3Gv 3Bv | |1B^ 1G^ js> Evaluator.parseAndEval(ds, "boys walk girls dodge"); js> Breather.breathe(ds.currentFormation()).toStringDiagram("|"); |1B^ 3Gv | |1G^ 3Bv js> Evaluator.parseAndEval(ds, "girls walk others dodge"); js> Breather.breathe(ds.currentFormation()).toStringDiagram("|"); |1G^ 1B^ | |3Bv 3Gv js> Evaluator.parseAndEval(ds, "trade", "roll"); js> Breather.breathe(ds.currentFormation()).toStringDiagram("|"); |1B> 1G< | |3G> 3B<
js> importPackage(net.cscott.sdr.calls); js> ds = new DanceState(new DanceProgram(Program.C4), Formation.FOUR_SQUARE); undefined; js> Breather.breathe(ds.currentFormation()).toStringDiagram("|"); |3Gv 3Bv | |1B^ 1G^ js> Evaluator.parseAndEval(ds, "square thru three and a half"); js> Breather.breathe(ds.currentFormation()).toStringDiagram("|"); |3G< | |3B> | |1B< | |1G>
Nested Class Summary | |
---|---|
static class |
Evaluator.EvaluatorChain
Chains multiple evaluators together. |
static class |
Evaluator.Standard
This is the standard top level evaluator. |
Constructor Summary | |
---|---|
Evaluator()
|
Method Summary | |
---|---|
abstract Evaluator |
evaluate(DanceState ds)
Do "one part" of the continuation, and return an Evaluator
which will do the remaining parts, or null if there are no
additional parts to evaluate. |
void |
evaluateAll(DanceState ds)
|
static void |
parseAndEval(DanceState ds,
String... calls)
Convenience method for easy testing. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public Evaluator()
Method Detail |
---|
public abstract Evaluator evaluate(DanceState ds)
Evaluator
which will do the remaining parts, or null if there are no
additional parts to evaluate.
ds
- The dynamic dance state. Accumulates dancer actions and
movements and tracks static dance information like the level of the
dance.
Evaluator
for the remaining parts, or null.public final void evaluateAll(DanceState ds)
public static void parseAndEval(DanceState ds, String... calls)
|
sdr 0.5 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |