|
sdr 0.7 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object net.cscott.sdr.calls.ast.AstNode net.cscott.sdr.calls.ast.SeqCall net.cscott.sdr.calls.ast.Part
public class Part
Part
denotes an fractional part of a call. The Part
also denotes
timing: each part executes in the same amount of time (unless modified by
In
. Part
has exactly one child, which is a
Comp
. The howMany
argument is usually 1 but
allows non-standard divisions: for example, "swing and mix" is a three-part
call of which the final "mix" counts for two parts. The
howMany
argument may also be zero, which is used for "adjust"
calls, for example the initial step to a wave when doing a swing thru
from facing couples is specified as "0 parts" to ensure that "do 1/4 of
a swing thru" works correctly from facing couples.
The divisibility
argument has three values. If it is
Part.Divisibility.DIVISIBLE
, calls inside this Part
can be
further fractionalized. In the "swing and mix" example, both the "swing"
and the "mix" can be further divided, allowing "1/6 swing and mix" and
"2/3 swing and mix" to be valid. If divisibility
is
Part.Divisibility.INDIVISIBLE
, then the child
can not be
further divided. For example, "partner swing" can not be divided; it makes
no sense to "half swing your partner". Indivisible parts are also used
around Prim
s composing a call, to avoid exposing the implementation
of the dancer's path, where this is not well standardized, for example in
the definition of "flutterwheel".
The final possible value for divisibility
is
Part.Divisibility.INDETERMINATE
. This
allows the specification of calls with clear first and/or last parts, but
which can't be otherwise fractionalized. For example, a call which is
defined as:
(Part 'DIVISIBLE '1 ...) (Part 'INDETERMINATE '1 ...) (Part 'INDIVISIBLE '1 ...)can be used with "finish <anything>" and "like an <anything>", but "1/3 <anything>" and "interrupt after each part with <anything>" would both be invalid, because the number of parts in the middle is not defined. The
howMany
argument is still used internally to divide up
the timing of the call, but is otherwise overridden by
Part.Divisibility.INDETERMINATE
.
Nested Class Summary | |
---|---|
static class |
Part.Divisibility
Whether this Part can be fractionalized. |
Field Summary | |
---|---|
Comp |
child
|
Part.Divisibility |
divisibility
|
Expr |
howMany
|
Fields inherited from class net.cscott.sdr.calls.ast.AstNode |
---|
type |
Constructor Summary | |
---|---|
Part(Part.Divisibility divisibility,
Expr howMany,
Comp child)
|
|
Part(Part.Divisibility divisibility,
Fraction howMany,
Comp child)
|
Method Summary | ||
---|---|---|
|
accept(TransformVisitor<T> v,
T t)
Visitor pattern implementation for transformations. |
|
|
accept(ValueVisitor<RESULT,CLOSURE> v,
CLOSURE cl)
Visitor pattern implementation for computations. |
|
String |
argsToString()
|
|
Part |
build(Part.Divisibility divisibility,
Expr howMany,
Comp child)
Factory: creates new Part only if it would differ from this. |
|
boolean |
isIndeterminate()
True if the result of SeqCall.parts() can not be used for
fractionalization. |
|
Expr |
parts()
How many 'parts' are represented by this SeqCall . |
Methods inherited from class net.cscott.sdr.calls.ast.AstNode |
---|
toString, valueOf |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public final Part.Divisibility divisibility
public final Expr howMany
public final Comp child
Constructor Detail |
---|
public Part(Part.Divisibility divisibility, Expr howMany, Comp child)
public Part(Part.Divisibility divisibility, Fraction howMany, Comp child)
Method Detail |
---|
public Expr parts()
SeqCall
SeqCall
. Should
be Expr.literal(Fraction.ONE)
for all but Part
.
parts
in class SeqCall
public boolean isIndeterminate()
SeqCall
SeqCall.parts()
can not be used for
fractionalization.
isIndeterminate
in class SeqCall
public <T> SeqCall accept(TransformVisitor<T> v, T t)
AstNode
AstNode
accepts a TransformVisitor
and a
value, and returns an instance of its own type (ie,
Seq.accept(tv, "A")
returns a Seq
).
The 't' parameter is a closure.
accept
in class SeqCall
public <RESULT,CLOSURE> RESULT accept(ValueVisitor<RESULT,CLOSURE> v, CLOSURE cl)
AstNode
AstNode
accepts a ValueVisitor
and a closure,
and returns an object of the appropriate result type.
accept
in class AstNode
public Part build(Part.Divisibility divisibility, Expr howMany, Comp child)
public String argsToString()
argsToString
in class AstNode
|
sdr 0.7 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |