|
||||||||||
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.InsertBSTAnimation<P>
public class InsertBSTAnimation<P extends NodeProperties>
The Animation object that defines the Insertion into a BSTTree. Two constructors exist, one setting the animator and animation color Schemes. The addition of nodes that the Animation must pass include both the AffineTransform and then BSTTree or either separately.
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 | |
---|---|
InsertBSTAnimation(GrowingTreeNode<P> node)
The constructor which initiates the status and sets the colorSchemes to null. |
|
InsertBSTAnimation(GrowingTreeNode<P> 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 | |
---|---|
void |
add(java.awt.geom.AffineTransform a)
Add a step to the InsertAnimation. |
void |
add(java.awt.geom.AffineTransform a,
GrowingTreeNode<P> node)
Add a step to the InsertAnimation. |
void |
add(GrowingTreeNode<P> node)
Add a step to the InsertAnimation. |
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). |
NodeSettings |
getAnimationSchemeLeft()
Gets the NodeSettings for the left animation scheme for the insertion. |
NodeSettings |
getAnimationSchemeRight()
Gets the NodeSettings for the right animation scheme for the insertion. |
NodeSettings |
getAnimatorScheme()
Gets the NodeSettings for the animator scheme for the insertion. |
KeySettings |
getKeyAnimatorScheme()
Sets the KeySettings for the animator scheme key for the insertion. |
void |
setAnimationSchemeLeft(NodeSettings scheme)
Sets the NodeSettings for the left animation scheme for the insertion. |
void |
setAnimationSchemeRight(NodeSettings scheme)
Sets the NodeSettings for the right animation scheme for the insertion. |
void |
setAnimatorScheme(NodeSettings scheme)
Sets the NodeSettings for the animator scheme for the insertion. |
void |
setKeyAnimatorScheme(KeySettings scheme)
Sets the KeySettings for the animator scheme key for the insertion. |
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 InsertBSTAnimation(GrowingTreeNode<P> 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 InsertBSTAnimation(GrowingTreeNode<P> node)
node
- the BSTTree which is animated during the animation.Method Detail |
---|
public NodeSettings getAnimationSchemeLeft()
public NodeSettings getAnimationSchemeRight()
public NodeSettings getAnimatorScheme()
public KeySettings getKeyAnimatorScheme()
public void setAnimationSchemeLeft(NodeSettings scheme)
scheme
- NodeSettings for the node after the animated node passes it to the left.public void setAnimationSchemeRight(NodeSettings scheme)
scheme
- NodeSettings for the node after the animated node passes it to the right.public void setAnimatorScheme(NodeSettings scheme)
scheme
- NodeSettings for the node animating.public void setKeyAnimatorScheme(KeySettings scheme)
scheme
- KeySettings for the key of the node animating.public void add(java.awt.geom.AffineTransform a)
a
- AffineTransform to be drawn in the following step.public void add(java.awt.geom.AffineTransform a, GrowingTreeNode<P> node)
a
- AffineTransform to be drawn in the following step.node
- the color scheme is changed when the step is completed.public void add(GrowingTreeNode<P> node)
node
- the color scheme is changed when the step is completed.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.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |