|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectmovements.TransitionGenerator
This class takes as input a series of movements that may be disjointed in space. That is, one movement may end with a participant at one place on the dance floor but the next movement may start with the dancer in a different place on the dance floor. Without the transitional processing done by this class the dancer would appear to be making sudden jumps.
Data is input by making calls to the addSubMovement and the addTransition methods. Movements are appended using the addSubMovement method. If two movements are disjointed then a call to addTransition must come between the two calls to addSubMovement. The addTransition method takes as parameters the number of prior ticks and the number of following ticks in the transition period.
Once the movements and transition points have been added, getMovement will get a PersonMovement object that makes the series of movements with smooth transitioning between the disjointed movements.
| Field Summary | |
private PersonMovementList |
movementList
Sub movements are initially added to this list. |
private int |
previousTransitionFollowingTicks
If there is an outstanding transition then this contains the number of ticks in the second part of the transition, i.e. |
private PersonMovement |
previousTransitionPriorMovement
If there is an outstanding transition then this contains the movement for the first part of the transition, i.e. |
private int |
previousTransitionType
If there is an outstanding transition then this contains the type of that transition. |
private PersonMovementList |
resultMovement
|
private int |
totalTickLength
Total length of all movements passed to the object so far |
| Constructor Summary | |
(package private) |
TransitionGenerator()
Construct an empty list of movements. |
| Method Summary | |
(package private) void |
addSubMovement(PersonMovement movement)
|
(package private) void |
addTransition(int priorTicks,
int followingTicks,
int transitionType)
|
(package private) void |
getCurrentPosition(ParticipantPosition position)
Returns the position of the participant when the last movement ended. |
(package private) PersonMovement |
getMovement()
This method must not be called until all calls to addSubMovement and addTransition have been made. |
(package private) int |
getTickLength()
|
(package private) boolean |
isValidStartPosition(ParticipantPosition followingPosition)
Determines if the given position is a valid starting point for the next movement. |
private void |
processPreviousTransition()
There may be a previous transition that has not been appended to the output movement. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
private PersonMovementList resultMovement
private PersonMovementList movementList
private PersonMovement previousTransitionPriorMovement
private int previousTransitionFollowingTicks
private int previousTransitionType
private int totalTickLength
| Constructor Detail |
TransitionGenerator()
| Method Detail |
void addSubMovement(PersonMovement movement)
int getTickLength()
private void processPreviousTransition()
void addTransition(int priorTicks,
int followingTicks,
int transitionType)
throws TransitionStartsBeforeFigureStarts,
TransitionNotCompletedException
TransitionStartsBeforeFigureStarts
TransitionNotCompletedException
PersonMovement getMovement()
throws TransitionNotCompletedException
TransitionNotCompletedException
void getCurrentPosition(ParticipantPosition position)
throws PositionRequiredButNoPriorMovementException,
PositionRequiredButImmediatelyAfterTransitionException
Certain movements, such as the 'move' or the 'shift' elements, do not define the starting position but use the position where the previous movement left the participant. This method provides that position.
The method will raise an exception if it is called immediately after a call to addTransition. The reason it does this is because a transition implies a disjoint, the position after a disjoint is not the same as the position before a disjoint so it would be incorrect to return the position before the transtion point. This exception will be raised if the XML specification has a 'transition' element followed by, say, a 'move' element.
PositionRequiredButNoPriorMovementException
PositionRequiredButImmediatelyAfterTransitionExceptionboolean isValidStartPosition(ParticipantPosition followingPosition)
If the last method called was addTransition then any point is a valid starting point because this object will figure out how to transition to it. If the last method called was addSubMovement then the next movement must start at the same point where the previous movement ended.
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||