|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--AbstractAnimation | +--BalanceBSTAnimation
The Animation object that defines the Balancing of a node in a BSTTree. Two constructors exist,
one setting the starting string command and step time (preferred use). The other uses defaults.
The animation builds PartitionBSTAnimation
s from the head node as it goes, keeping
only one currently animating and allowing rewinding only to the previous
rotation. The color schemes are set by the head call. The call is
makePartitionAnimation
.
Field Summary |
Fields inherited from class AbstractAnimation |
DEFAULT_CONVERSION, DEFAULT_STEP, listeners |
Fields inherited from interface Animation |
ANIMATION_MESSAGE, BEGIN, FINISH, PAUSE, PLAY, REDRAW, REWIND, STEP, STOP |
Constructor Summary | |
BalanceBSTAnimation(BSTTree node)
The constructor which initiates the status and sets the starting command and step time |
|
BalanceBSTAnimation(BSTTree node,
java.lang.String startingCmd,
int stepTime)
The constructor which initiates the status. |
Method Summary | |
protected void |
animationAction(java.lang.String cmd,
java.lang.String description)
Calls all of the listeners of the current Animation and passed information regarding the progress and status of the current Animation. |
void |
animationEventPerformed(AnimationEvent e)
Implements AnimationListener which requires the following method. |
void |
drawAnimation(java.awt.Graphics2D g2,
java.lang.String startingStatus)
Draws the animation of the next step, using the status of the animation (Animation.PLAY, Animation.PAUSE and so forth). |
BSTTree |
getNode()
Gets the node from which the balancing takes place. |
BSTTree |
getReplacingNode()
Gets the node currently being replaced by the node being balanced (not set until after partition occurs). |
void |
setNode(BSTTree node)
Sets the node from which the balancing takes place. |
void |
setReplacingNode(BSTTree node)
Sets the node that will replace the balanced node. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public BalanceBSTAnimation(BSTTree node, java.lang.String startingCmd, int stepTime)
node
- the BSTTree from which the balancing takes place.startingCmd
- the Animation command that this should start.stepTime
- the time for each step of the Animation. Sets the initial value.public BalanceBSTAnimation(BSTTree node)
node
- the BSTTree which is balanced.Method Detail |
public BSTTree getNode()
public BSTTree getReplacingNode()
public void setNode(BSTTree node)
node
- BSTTree of the node currently being balanced.public void setReplacingNode(BSTTree node)
public void drawAnimation(java.awt.Graphics2D g2, java.lang.String startingStatus)
BSTTreeHead calls:
selectTreeType
- to locate the replacing node without moving itbalance
- to make recursive calls once the animation has completed
drawAnimation
in interface Animation
drawAnimation
in class AbstractAnimation
g2
- the graphics to which the animation step should be drawn.startingStatus
- the status used as the starting command of animation, if needed.protected void animationAction(java.lang.String cmd, java.lang.String description)
animationEventPerformed
method is called.
animationAction
in class AbstractAnimation
cmd
- String Animation command passed instead of the current Status.description
- String description for messages.public void animationEventPerformed(AnimationEvent e)
AnimationListener
which requires the following method.
The only status of animation it listens for is Animation.ANIMATION_MESSAGE
, to pass
the message on.
animationEventPerformed
in interface AnimationListener
e
- AnimationEvent that represents the information of the Animation.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |