|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectedu.princeton.cs.algs4.growingtree.framework.AbstractAnimation
edu.princeton.cs.algs4.growingtree.framework.RotationDoubleBSTAnimation<P>
public class RotationDoubleBSTAnimation<P extends NodeProperties>
The Animation object that defines a double rotation of a node in a BSTTree. The animation builds two RotationBSTAnimations as it goes, keeping only one currently animating and allowing rewinding only to the previous rotation.
The Object implements the Animation interface, and should consequently be used only in that context. The object restores all values changed in the given nodes, however, if the object is never allowed to finish, the restoring of values becomes impossible. On any exception occuring elsewhere, the object may not restore the conditions correctly.
Field Summary |
---|
Fields inherited from class edu.princeton.cs.algs4.growingtree.framework.AbstractAnimation |
---|
DEFAULT_CONVERSION, DEFAULT_STEP |
Fields inherited from interface edu.princeton.cs.algs4.growingtree.framework.Animation |
---|
ANIMATION_MESSAGE, BEGIN, FINISH, PAUSE, PLAY, REDRAW, REWIND, STEP, STOP |
Constructor Summary | |
---|---|
RotationDoubleBSTAnimation(GrowingTreeNode<P> node)
The constructor which initiates the status and sets the color schemes to null. |
|
RotationDoubleBSTAnimation(GrowingTreeNode<P> node,
java.lang.String startingCmd,
int stepTime)
The constructor which initiates the status and prepares the color schemes. |
Method Summary | |
---|---|
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). |
GrowingTreeNode<P> |
getNode()
Gets the node from which the partitioning takes place. |
void |
setNode(GrowingTreeNode<P> node)
Sets the node from which the partitioning takes place. |
Methods inherited from class edu.princeton.cs.algs4.growingtree.framework.AbstractAnimation |
---|
addAnimationListener, addDescription, drawAnimation, getDescription, getListeners, getStatus, getStep, getStepTime, removeAnimationListener, setStatus, setStep, setStepTime |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public RotationDoubleBSTAnimation(GrowingTreeNode<P> node, java.lang.String startingCmd, int stepTime)
node
- the BSTTree from which the partition takes place.startingCmd
- the Animation command that this should start.stepTime
- the time for each step of the Animation. Sets the initial value.public RotationDoubleBSTAnimation(GrowingTreeNode<P> node)
node
- the BSTTree which is deleted during the deletion.Method Detail |
---|
public GrowingTreeNode<P> getNode()
public void setNode(GrowingTreeNode<P> node)
node
- BSTTree of the node currently being partitioned at the KeySelect.public void drawAnimation(java.awt.Graphics2D g2, java.lang.String startingStatus)
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.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 |