|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--AbstractAnimation | +--DeleteBSTAnimation | +--DeleteRedBlackAnimation
The Animation object that defines the Deletion of a node in a DeleteRedBlackAnimation. Two constructors exist, one setting the animator and line paints, the other using defaults. The animation builds RotationBSTAnimations as it goes, keeping only one currently animating and allowing rewinding only to the previous rotation.
Field Summary | |
protected static int |
BEGIN_FIXUP
The location for beginning of red-black deletion. |
protected static int |
CASE_FOUR
The location for case four in red-black deletion. |
protected static int |
CASE_ONE
The location for case one in red-black deletion. |
protected static int |
CASE_THREE
The location for case three in red-black deletion. |
protected static int |
CASE_TWO
The location for case two in red-black deletion. |
protected SelectionBSTAnimation |
currentSelection
Refers to the current SelectionBSTAnimation being drawn. |
protected int |
END
Defines the final move through the tree. |
protected static int |
END_FIXUP
The location for the end of red-black deletion. |
protected int |
FADE_NODE
Constant that defines the fading of the erasing node. |
protected int |
FADE_NODE_REPLACE
Defines the partitioning through the tree. |
protected int |
FINAL_MOVE
Defines the final move through the tree. |
protected int |
FIX_UP
Defines the final move through the tree. |
protected int |
REPLACE_NODE
Defines the partitioning through the tree. |
protected int |
SELECTION_TREE
Defines the partitioning through the tree. |
protected int |
START
Constant that defines the starting location. |
Fields inherited from class DeleteBSTAnimation |
currentLocation, currentPartition, finalMovingNodes, PARTITION_TREE, previousLocation |
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 | |
DeleteRedBlackAnimation(BSTTree erasingNode)
The constructor which initiates the status and sets the line paints to null. |
|
DeleteRedBlackAnimation(BSTTree erasingNode,
PaintSettings RightLinePaint,
PaintSettings LeftLinePaint,
java.lang.String startingCmd,
int stepTime)
The constructor which initiates the status and prepares the line paints. |
Method Summary | |
protected void |
addNode(RedBlackTree node,
MovingBSTTreeAnimation animator,
int movePosition,
MovingRedBlackTree parent)
Adds all children nodes to the animator list, setting the Moving node as its parent. |
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. |
protected void |
createFinalMovingNodes()
Creates the moving nodes corresponding to the final moving of the nodes. |
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 |
drawDottedLine(java.awt.Graphics2D g2,
double location)
Draws a dotted line according to the current location within the graphics. |
RedBlackTree |
getChildNode()
Gets the node being deleted during the replacing. |
protected void |
makeCurrentRotation()
Constructs the current Rotation according to the current tree, and the defined rotationCheck. |
void |
setBlackChangeLinks()
Fixes the blackChangeLinks by settings all the nodes links within the list to black. |
void |
setChildNode(RedBlackTree node)
Sets the node being deleted during the Deletion. |
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 SelectionBSTAnimation currentSelection
SelectionBSTAnimation
being drawn.
protected final int START
protected final int FADE_NODE
protected int SELECTION_TREE
protected int FADE_NODE_REPLACE
protected int REPLACE_NODE
protected int FIX_UP
protected int FINAL_MOVE
protected int END
protected static final int BEGIN_FIXUP
protected static final int CASE_ONE
protected static final int CASE_TWO
protected static final int CASE_THREE
protected static final int CASE_FOUR
protected static final int END_FIXUP
Constructor Detail |
public DeleteRedBlackAnimation(BSTTree erasingNode, PaintSettings RightLinePaint, PaintSettings LeftLinePaint, java.lang.String startingCmd, int stepTime)
erasingNode
- the BSTTree which is being deleted.RightLinePaint
- the paint for the right line when drawing the deletion.LeftLinePaint
- the paint for the left line when drawing the deletionstartingCmd
- the Animation command that this should start.stepTime
- the time for each step of the Animation. Sets the initial value.public DeleteRedBlackAnimation(BSTTree erasingNode)
erasingNode
- the BSTTree which is deleted during the deletion.Method Detail |
public RedBlackTree getChildNode()
public void setChildNode(RedBlackTree node)
protected void createFinalMovingNodes()
createFinalMovingNodes
in class DeleteBSTAnimation
protected void addNode(RedBlackTree node, MovingBSTTreeAnimation animator, int movePosition, MovingRedBlackTree parent)
node
- the node which the MovingBSTTree made imitates.animator
- the MovingBSTTreeAnimation to which the new MovingBSTTree node is added.parent
- MovingBSTTree
parent for the node, specifically for following the node.public void drawAnimation(java.awt.Graphics2D g2, java.lang.String startingStatus)
removeTreeType
- to do the final deletion in the actual code (after partitioning has occured)
drawAnimation
in interface Animation
drawAnimation
in class DeleteBSTAnimation
g2
- the graphics to which the animation step should be drawn.startingStatus
- the status used as the starting command of animation, if needed.public void setRedChangeLinks()
public void setBlackChangeLinks()
protected void makeCurrentRotation()
DeleteBSTAnimation
.
protected void drawDottedLine(java.awt.Graphics2D g2, double location)
drawDottedLine
in class DeleteBSTAnimation
g2
- Graphics2D to which the line is drawn.location
- the double location of progress in the animation.protected void animationAction(java.lang.String cmd, java.lang.String description)
animationEventPerformed
method is called.
animationAction
in class DeleteBSTAnimation
cmd
- 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 |