|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Object
|
+--AbstractAnimation
|
+--InsertBSTAnimation
|
+--InsertRedBlackAnimation
The Animation object that defines the Insertion into a Red-Black Tree. Two constructors exist, one setting the animator and animation color Schemes.
| Field Summary | |
protected static int |
BEGIN_CHECK
The location for beginning of checking rotations. |
protected static int |
LEFT_CHECK
The location for the left checking of rotations. |
protected static int |
RIGHT_CHECK
The location for the right checking of rotations. |
| Fields inherited from class InsertBSTAnimation |
comparisonCount, insertionSize, nextNodeIndex, previousNodeIndex |
| 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 | |
InsertRedBlackAnimation(BSTTree node)
The constructor which initiates the status and sets the colorSchemes to null. |
|
InsertRedBlackAnimation(BSTTree node,
NodeSettings AnimationSchemeLeft,
NodeSettings AnimationSchemeRight,
NodeSettings AnimatorScheme,
KeySettings KeyAnimatorScheme,
java.lang.String startingCmd,
int stepTime)
The constructor which initiates the status and prepares the colorSchemes. |
|
| 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). |
protected void |
makeCurrentRotation(RedBlackTree newTree,
RedBlackTree node)
Constructs the current Rotation according to the current tree, and the defined rotationCheck. |
protected void |
restore()
Restores the settings of all nodes encountered during the animation. |
void |
setBlackChangeLinks()
Fixes the blackChangeLinks by settings all the nodes links within the list to black. |
void |
setRedChangeLinks()
Fixes the redChangeLinks by settings all the nodes links within the list to red. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
protected static final int BEGIN_CHECK
protected static final int LEFT_CHECK
protected static final int RIGHT_CHECK
| Constructor Detail |
public InsertRedBlackAnimation(BSTTree node,
NodeSettings AnimationSchemeLeft,
NodeSettings AnimationSchemeRight,
NodeSettings AnimatorScheme,
KeySettings KeyAnimatorScheme,
java.lang.String startingCmd,
int stepTime)
node - the BSTTree which is animated during the animation.AnimationSchemeLeft - the NodeSettings associated with a color scheme according to NodeSettings for the left Animation.AnimationSchemeRight - the NodeSettings associated with a color scheme according to NodeSettings for the right Animation.AnimatorScheme - the NodeSettings associated with a color scheme according to NodeSettings.KeyAnimatorScheme - the KeySettings associated with a color scheme according to KeySettings.startingCmd - the Animation command that this should start.stepTime - the time for each step of the Animation. Sets the initial value.public InsertRedBlackAnimation(BSTTree node)
node - the BSTTree which is animated during the animation.| Method Detail |
public void drawAnimation(java.awt.Graphics2D g2,
java.lang.String startingStatus)
drawAnimation in interface AnimationdrawAnimation in class InsertBSTAnimationg2 - the graphics to which the animation step should be drawn.startingStatus - the status used as the starting command of animation, if needed.protected void restore()
This also restores the animator node. It also passes the animation action to all nodes of Animation.FINISH.
restore in class InsertBSTAnimation
protected void makeCurrentRotation(RedBlackTree newTree,
RedBlackTree node)
newTree - RedBlackTree that represents the newly added node.node - RedBlackTree that represents the current checking node.public void setRedChangeLinks()
public void setBlackChangeLinks()
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 AnimationListenere - AnimationEvent that represents the information of the Animation.
protected void animationAction(java.lang.String cmd,
java.lang.String description)
animationEventPerformed method is called.
animationAction in class InsertBSTAnimationcmd - String Animation command passed instead of the current Status.description - String description for messages.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||