Class Figur
Class Figur
java.lang.Object
|
+----Figur
- class Figur
- extends Object
- implements Runnable
Figur is the main class for storing/displaying the dance figures.
It is (should be) an abstract class. Don't create an instance of
it. Create only objects of the classes SlowWaltz, Tango, SlowFox
and Quickstep.
- See Also:
- SlowWaltz, Tango, SlowFox, Quickstep
-
BPM
- beats per minute == Takte * Tempo
-
Takte
- Is this dance a 3/4 dance (e.g.
-
Figur(Dance)
- Constructor initialize some always needed variables.
-
BottomEdge()
- Return the bottom edge of the floors.
-
CalcWTime(float)
- Calculate waiting time.
-
Dance()
- Start the animation.
-
DoDStep()
- Does one step on the female (Lady) floor.
-
DoHStep()
- Does one step on the male (Gent) floor.
-
HideComStr()
- Hide the takt/time string (slow/quick or heel/toe) on both floors.
-
LeftEdge()
- Return the left edge of the male floor
-
NextNNTime()
- Next non zero (german: Null) time.
-
PrevNNTime()
- Previsious non zero (german: Null) waiting time.
-
RightEdge()
- Return the right edge of the female floor (plus some additional space
-
SetCounter(int)
- Set the time counter value.
-
ShowComStr()
- Show the takt/time string (slow/quick or heel/toe) on both floors.
-
StopDance()
- Stop the animation.
-
ThreadsAlive()
- Is at least one of the dancing threads (male/female) alive?
-
clearSteps()
- Clear all done steps.
-
drawNum(Graphics, boolean)
- Draw the time/takt number.
-
drawTitel(Graphics)
- Draw the dance and figur name on the top of the applet.
-
inSingleStep()
- Are we in single step mode?
-
leaveSingleStep()
- Leave the single step mode.
-
run()
- Main function for the animation feature.
-
stepBackw()
- Take one step backward (in single step mode).
-
stepForw()
- Does on step forward (in single step mode)
-
toString()
- Returns a String object representing.
-
useComStrHT()
- Use the heel/toe string for the comment field.
-
useComStrTime()
- Use the time (slow/quick) string for the comment field.
Takte
public int Takte
- Is this dance a 3/4 dance (e.g. slow waltz) (=> Takte = 3)
or a 4/4 dance (e.g. quickstep) (=> Takte = 4)
BPM
public int BPM
- beats per minute == Takte * Tempo
Figur
protected Figur(Dance app)
- Constructor initialize some always needed variables.
- Parameters:
- app - pointer to the main dance applet (e.g. needed
for Dance.engl
CalcWTime
public long CalcWTime(float time)
- Calculate waiting time.
Gets a float time number relative to the dance tact and
returns the waiting time in milli secs.
- Parameters:
- time - time relative to the dance tact
- Returns:
- waiting time in milli secs.
NextNNTime
public float NextNNTime()
- Next non zero (german: Null) time.
Looks from the current step forward for the next step with
waiting time greater zero.
- Returns:
- next non zero waiting time. If no such time exists,
return one.
PrevNNTime
public float PrevNNTime()
- Previsious non zero (german: Null) waiting time.
Looks from the current step backward to find the next (smalles)
waiting time greater zero.
- Returns:
- previsious waiting time greater zero. Returns zero, if no such
time exists.
DoHStep
public float DoHStep()
- Does one step on the male (Gent) floor.
- Returns:
- the waiting time until the next male step is to do
or -1 if there was no step to do. (The last step has a waiting
time > 0 too, so -1 comes, if there was already no step to do.)
DoDStep
public float DoDStep()
- Does one step on the female (Lady) floor.
- Returns:
- the waiting time until the next female step is to do
or -1 if there was no step to do. (The last step has a waiting
time > 0 too, so -1 comes, if there was already no step to do.)
stepForw
public void stepForw()
- Does on step forward (in single step mode)
stepBackw
public void stepBackw()
- Take one step backward (in single step mode).
If not in single step mode, do all steps and go into single step mode.
inSingleStep
public boolean inSingleStep()
- Are we in single step mode?
leaveSingleStep
public void leaveSingleStep()
- Leave the single step mode. Needed initializations does the Dance class
clearSteps
public void clearSteps()
- Clear all done steps. After the next repaint(), no feeds are on the floors.
ShowComStr
public void ShowComStr()
- Show the takt/time string (slow/quick or heel/toe) on both floors.
- See Also:
- ShowComStr
HideComStr
public void HideComStr()
- Hide the takt/time string (slow/quick or heel/toe) on both floors.
- See Also:
- HideComStr
useComStrHT
public void useComStrHT()
- Use the heel/toe string for the comment field.
- See Also:
- useComStrHT
useComStrTime
public void useComStrTime()
- Use the time (slow/quick) string for the comment field.
- See Also:
- useComStrTime
run
public void run()
- Main function for the animation feature.
This function will be started twice. As well for the male
thread (thread name "Herr") an for the female thread (thread name "Dame").
It does step by step and sleep() between the steps. repaint() is
only needed, if the waiting time is an fraction of the takt because
the sound thread already does a repaint every takt beat.
If all steps are set, the threads does kill themself and, if it was the
last thread, the sound thread will also be killed.
Dance
public synchronized void Dance()
- Start the animation.
Set the tempo/BPM, starts the male/female threads and
than start the sound thread.
StopDance
public synchronized void StopDance()
- Stop the animation. E.g. if the "play" button is hit while
an animation still runs, the animation will be aborted.
Than all missing steps are done quickly.
ThreadsAlive
public boolean ThreadsAlive()
- Is at least one of the dancing threads (male/female) alive?
SetCounter
public void SetCounter(int c)
- Set the time counter value. Needed in single step mode.
Counter value -1 means, hide the counter window.
drawTitel
public void drawTitel(Graphics g)
- Draw the dance and figur name on the top of the applet.
drawNum
public void drawNum(Graphics g,
boolean update)
- Draw the time/takt number. The value of this counter is
maintained from the sound class.
- Parameters:
- g - actual graphics context
- update - only an update or an whole repaint
- See Also:
- Sound, GetNumImg
LeftEdge
public int LeftEdge()
- Return the left edge of the male floor
RightEdge
public int RightEdge()
- Return the right edge of the female floor (plus some additional space
BottomEdge
public int BottomEdge()
- Return the bottom edge of the floors.
toString
public String toString()
- Returns a String object representing.
- Overrides:
- toString in class Object