sdr 0.7

Package net.cscott.sdr.calls

This package contains the square dance choreography engine, and the basic types and interfaces required to communicate with it.

See:
          Description

Interface Summary
Dancer Dancer objects represent a dancer (real or phantom).
 

Class Summary
Action The Action class represents dancer actions, such as bowing, arm turns, handholds, and sound effects.
Breather The Breather class contains methods to reassemble and breathe formations.
Breather.FormationPiece A component to be breathed into a complete formation.
Call The Call class includes 'simple calls' (like HINGE) which take no arguments, 'complex calls' (like SQUARE THRU) which take a numerical argument, and 'concepts' (like AS COUPLES) which take another call or calls as arguments.
CallDB CallDB holds all the calls and concepts we know about.
DanceProgram DanceProgram captures all the static information about a dance which a Predicate might need to know.
DancerBezierPath Low-level version of DancerPath which explicitly represents the Bezier paths for the dancer to follow.
DancerPath A DancerPath is the result of evaluating a call for a specific dancer in a formation.
DanceState DanceState captures all the dynamic information about a dance: the current formation and the queues of dancer actions and calls.
EvalPrim Apply a Prim to a Dancer's Position to yield a DancerPath (which contains a new Position).
Evaluator An Evaluator represents a current dance context.
Evaluator.EvaluatorChain Chains multiple evaluators together.
Evaluator.Standard This is the standard top level evaluator.
ExactRotation Rotations are represented as fractions, where '0' is facing north (away from the caller), and '1/4' is facing east.
ExprFunc<T> An ExprFunc is responsible for evaluating the value of an Expr.
ExprList The ExprList contains ExprFunc definitions and the basic machinery used to evaluate generic Exprs.
Formation A Formation is a set of dancers and positions for them.
FormationList A list of common formations, specified with phantoms.
FormationListJS Javascript thunk to work around problem using Rhino to peer at FormationListFast/FormationListSlow via reflection.
FormationMatch A successful attempt to match one or more instances of a given formation against the current setup yields a FormationMatch object.
GeneralFormationMatcher GeneralFormationMatcher produces a FormationMatch given an input Formation and a goal TaggedFormation.
Matcher A Matcher takes a formation and pulls out all instances of a sub-formation.
MatcherList The MatcherList contains matchers for various formations.
NamedTaggedFormation Associates a name with a canonical formation.
Permutation A Permutation represents a reordering of dancers.
PhantomDancer An object representing a phantom dancer.
Position Position objects represent the position and orientation of a dancer.
Predicate A Predicate is a boolean test on the current formation and dance state, or else an operator on such boolean tests.
PredicateList This class contains all the predicates known to the system.
Rotation Rotations are represented as fractions, where '0' is facing north (that is, away from the caller), and '1/4' is facing east.
Selector Mechanism to select certain dancers from a Formation.
SelectorList List of useful Selectors.
TaggedFormation A TaggedFormation is a set of dancers and positions for them.
Tagger Helper class to add common TaggedFormation.Tags automatically to TaggedFormations.
Timed<T extends Timed<T>> Abstract superclass for TimedAction, TimedPosition, and TimedFormation, which pair a Action, Position, or Formation with a specific time at which it occurs.
TimedAction A TimedAction combines an Action with a timestamp indicating notionally when that particular action should occur, although the exact timing and duration depends on the action: some actions may begin at the specified time, with others (for example) may be centered on the time given.
TimedFormation A TimedFormation combines a Formation with a timestamp indicating when that particular formation should be reached.
TimedPosition A TimedPosition combines a Position with a timestamp indicating when that particular position should be reached.
 

Enum Summary
DancerPath.Flag Special movement properties of a DancerPath.
DancerPath.PointOfRotation In order to have a method of discussing the various motions encountered in square dance choreography, Lynette Bellini identified several points of rotation: A single dancer: the point of rotation is about the center of a single dancer, as in the call roll.
Position.Flag Various flags describing boolean properties of a Position.
Program Enumeration of square dance programs.
StandardDancer An object representing one of the eight real dancers.
TaggedFormation.Tag Dancer descriptions based on position in the Formation.
 

Exception Summary
BadCallException This exception indicates that a call was invalid.
ExprFunc.EvaluationException Thrown to indicate an unexpected problem evaluating an Expr, for example a type mismatch.
NoMatchException NoMatchException is thrown when a necessary formation can't be found in the given setup.
 

Package net.cscott.sdr.calls Description

This package contains the square dance choreography engine, and the basic types and interfaces required to communicate with it.

Tests:
Test basic call database functionality:
js> CallDB.INSTANCE.parse(Program.BASIC, "double pass thru").
  >     evaluator(null).simpleExpansion()
(In '4 (Seq (Apply (Expr tandem 'pass thru))))
Calls with arguments:
js> importPackage(net.cscott.sdr.util) // for Fraction
js> importPackage(net.cscott.sdr.calls.ast) // for Apply
js> sqthr = CallDB.INSTANCE.lookup("square thru")
square thru[basic]
js> ds = new DanceState(new DanceProgram(Program.C4), Formation.SQUARED_SET); undefined;
js> def = sqthr.getEvaluator(ds, java.util.Arrays.asList(Expr.literal("1 1/2"))).simpleExpansion()
(Opt (From 'ANY (If 'BEFORE (Expr and (Expr greater '1 1/2 '0) (Expr not (Expr greater '1 1/2 '1))) (Seq (Apply (Expr _fractional '1 1/2 (Expr _in '2 'pull by)))))) (From 'ANY (If 'BEFORE (Expr greater '1 1/2 '1) (Seq (Part 'INDIVISIBLE '1 (Seq (Apply (Expr and (Expr _in '2 '_square thru part) (Expr left (Expr square thru (Expr _subtract num '1 1/2 '1)))))))))))
Call fractionalization:
js> importPackage(net.cscott.sdr.util) // for Fraction
js> importPackage(net.cscott.sdr.calls.ast) // for Apply
js> a = new Apply(new Expr("run", Expr.literal("boy")))
(Apply (Expr run 'boy))
js> a.evaluator(null).simpleExpansion()
(In '4 (Opt (From (Expr or '1 x4 '2 x4 'BOX (Expr mixed 'COUPLE 'RH MINIWAVE 'LH MINIWAVE) '1 x2) (Seq (Apply (Expr _with designated 'boy '_designees run))))))
js> a = new Apply(new Expr("_fractional", Expr.literal("1/2"), a.call))
(Apply (Expr _fractional '1/2 (Expr run 'boy)))
js> a.evaluator(null).simpleExpansion()
(In (Expr _multiply num '1/2 '4) (Opt (From (Expr or '1 x4 '2 x4 'BOX (Expr mixed 'COUPLE 'RH MINIWAVE 'LH MINIWAVE) '1 x2) (Seq (Apply (Expr _with designated 'boy (Expr _fractional '1/2 '_designees run)))))))

sdr 0.7

Copyright © 2006-2009 C. Scott Ananian