|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectmovements.MovementGenerator
DOCUMENT ME!
| Nested Class Summary | |
private class |
MovementGenerator.FigurePlacement
Defines where a figure is placed on the dance floor. |
private class |
MovementGenerator.HandHoldRange
Each object of this class represents a period of time over which all the hands in the hand hold are 'in range'. |
private class |
MovementGenerator.IntermediateHandHold
DOCUMENT ME! |
class |
MovementGenerator.ParticipantData
DOCUMENT ME! |
| Field Summary | |
private int[] |
comfortableHandPositionForwards
|
private int[] |
comfortableHandPositionSideways
|
private DanceDefinition |
danceDefinition
The XML tree returned by the XML parser. |
private HandMovements[][] |
handMovementsByHand
|
private java.util.Vector[][] |
intermediateHandHoldsByHand
A two dimensional array of Vectors where each vector contains a list of hand holds. |
private java.util.Vector |
intermediateHandHoldsForAllPeople
A Vector containing a list of all hand holds in the dance. |
private int |
numberOfTicksInDance
|
private ParticipantMovements[] |
peopleMovements
|
(package private) int |
ticksPerBar
The number of time ticks in each bar. |
private java.util.Vector |
warningMessages
The warnings that were generated during the previous call to the buildDanceDataFromXML method. |
| Constructor Summary | |
MovementGenerator()
|
|
| Method Summary | |
private void |
AddHandMovements()
Calculates the actual hand movements. |
private void |
AddHandMovementsStep1()
When hands are taken, that means hands are to be taken only if the people taking hands are 'in range'. |
private void |
AddHandMovementsStep2()
When a hand is involved in two different hand holds then there is a transition period of at least half a bar. |
DanceData |
buildDanceDataFromXML(org.xml.sax.InputSource source,
int ticksPerBar)
Creates a DanceData object from a dance specification given in XML format. |
private PersonMovement[] |
calculateMovementsInFigure(FigureDefinition figureDefinition,
MovementGenerator.FigurePlacement figurePlacement,
MovementGenerator.ParticipantData[] participantsData,
int figureStartTick)
|
private int |
Degrees(double radians)
|
private DanceData |
generateMovements(DanceDefinition danceDefinition,
int ticksPerBar)
DOCUMENT ME! |
java.util.Iterator |
getWarningsIterator()
Get the warnings, if any, that were generated during the previous call to the buildDanceDataFromXML method. |
private double |
Radians(int degrees)
Convert degrees to radians. |
private void |
StandStill(TransitionGenerator transitionGenerator,
int ticks)
Make a participant stand still for a while. |
private java.lang.String |
ticksToString(int ticks)
Helper function to format a bar count for messages. |
void |
Trace()
|
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
private int[] comfortableHandPositionForwards
private int[] comfortableHandPositionSideways
private DanceDefinition danceDefinition
private java.util.Vector warningMessages
buildDanceDataFromXML method.
This is a collection of String objects.
private java.util.Vector[][] intermediateHandHoldsByHand
Each element in the vectors is of type IntermediateHandHold.
private java.util.Vector intermediateHandHoldsForAllPeople
Each element in the vector is of type IntermediateHandHold.
private ParticipantMovements[] peopleMovements
private HandMovements[][] handMovementsByHand
private int numberOfTicksInDance
int ticksPerBar
| Constructor Detail |
public MovementGenerator()
| Method Detail |
private double Radians(int degrees)
parsedtree package
are in degrees but all angles in this package are in radians.
private int Degrees(double radians)
private java.lang.String ticksToString(int ticks)
ticks - The number of ticks into the dance or the figure.
public DanceData buildDanceDataFromXML(org.xml.sax.InputSource source,
int ticksPerBar)
throws org.xml.sax.SAXException,
java.io.IOException,
AnimationException,
MusicException
source - The XML input. The XML must contain a dance specification.ticksPerBar - All times are given using a 'tick'. It is recommended
that you use 24 ticks per bar.
org.xml.sax.SAXException - An error occured parsing the XML. Either the XML is not well
formed or it did not pass the initial parsing.
java.io.IOException - An error occured reading the input.
AnimationException - An error occured in the XML. This error prevents animation.
Errors of this kind tend to be more complex. These errors are generated during
the final process of creating the DanceData object from the XML tree.
MusicException - An error occured in the music. The music is contained
in an public java.util.Iterator getWarningsIterator()
buildDanceDataFromXML method.
String objects.
Each String object contains the text for a single warning.
If there were no warnings then the iterator will iterate over an empty collection.
The iterator will remain valid even if a subsequent call to buildDanceDataFromXML
is made. The iterator will continue to iterate over the original collection of warnings.
private DanceData generateMovements(DanceDefinition danceDefinition,
int ticksPerBar)
throws AnimationException,
MusicException
danceDefinition - DOCUMENT ME!ticksPerBar - DOCUMENT ME!
AnimationException - DOCUMENT ME!
MusicException - DOCUMENT ME!
private PersonMovement[] calculateMovementsInFigure(FigureDefinition figureDefinition,
MovementGenerator.FigurePlacement figurePlacement,
MovementGenerator.ParticipantData[] participantsData,
int figureStartTick)
throws AnimationException
AnimationException
private void AddHandMovementsStep1()
throws AnimationException
AnimationException - DOCUMENT ME!
private void AddHandMovementsStep2()
throws AnimationException
AnimationException - DOCUMENT ME!
private void AddHandMovements()
throws AnimationException
A list of hand holds was built when calculating the movements for each person. However a number of steps must be taken to get the actual hand movements from the list of hand holds. We must determine the ranges during which the hands are in fact able to take hands, we must calculate the transitions of the hands into and out of the hand holds, and we must calculate the positions of the hand holds.
AnimationException - At this time this exception is never thrown. Amazingly enough,
no invalid hand hold details in the specification can make it to this function.
It may be that two people are never close enough for a hand hold to take place
but that is not an error, it simply results in the hands never being taken.public void Trace()
private void StandStill(TransitionGenerator transitionGenerator,
int ticks)
throws PositionRequiredButNoPriorMovementException,
PositionRequiredButImmediatelyAfterTransitionException
transitionGenerator - DOCUMENT ME!ticks - DOCUMENT ME!
PositionRequiredButNoPriorMovementException - DOCUMENT ME!
PositionRequiredButImmediatelyAfterTransitionException - DOCUMENT
ME!
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||