edu.princeton.cs.algs4.growingtree.framework
Class SwapBSTAnimation<P extends NodeProperties>

java.lang.Object
  extended by edu.princeton.cs.algs4.growingtree.framework.AbstractAnimation
      extended by edu.princeton.cs.algs4.growingtree.framework.SwapBSTAnimation<P>
All Implemented Interfaces:
Animation

public class SwapBSTAnimation<P extends NodeProperties>
extends AbstractAnimation


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
SwapBSTAnimation(GrowingTreeNode<P> nodeA, GrowingTreeNode<P> nodeB, int stepTime)
           
 
Method Summary
 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).
 java.awt.geom.AffineTransform getTransformStep(GrowingTreeNode<P> from, GrowingTreeNode<P> to, double step)
           
 
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

SwapBSTAnimation

public SwapBSTAnimation(GrowingTreeNode<P> nodeA,
                        GrowingTreeNode<P> nodeB,
                        int stepTime)
Method Detail

drawAnimation

public void drawAnimation(java.awt.Graphics2D g2,
                          java.lang.String startingStatus)
Description copied from class: AbstractAnimation
Draws the animation of the next step, using the status of the animation (Animation.PLAY, Animation.PAUSE and so forth). This must be declared to extend this abstract class.

Specified by:
drawAnimation in interface Animation
Overrides:
drawAnimation in class AbstractAnimation
Parameters:
g2 - the graphics to which the animation step should be drawn.
startingStatus - the status used as the starting command of animation, if needed.

getTransformStep

public java.awt.geom.AffineTransform getTransformStep(GrowingTreeNode<P> from,
                                                      GrowingTreeNode<P> to,
                                                      double step)
                                               throws java.lang.IndexOutOfBoundsException
Throws:
java.lang.IndexOutOfBoundsException