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

java.lang.Object
  extended by edu.princeton.cs.algs4.growingtree.framework.GrowingTreeNode<P>
All Implemented Interfaces:
AnimatingTree<P>, AnimationListener, DrawingTree<P>, Tree<P>, java.util.EventListener
Direct Known Subclasses:
GrowingTreeHead, MovingBSTTree

public class GrowingTreeNode<P extends NodeProperties>
extends java.lang.Object
implements Tree<P>, DrawingTree<P>, AnimationListener, AnimatingTree<P>

The class provides the base structure of a BSTTree, a node of the Binary Search Tree. It uses the elements natural ordering. It uses everything defined within the AbstractTree

The BSTTree cannot be the head of the tree, it is only the nodes. It defines recursive methods which aren't defined in the head node and it does not define the methods for the head node.


The BSTTree defines methods necessary for a BSTTree, a DrawingBSTTree, and an AnimatingBSTTree. The type is set when the node is constructed but can be changed in the middle. If a method is called for a type that is higher is level than the type of the tree, the method will be ignored.

A Binary Search Tree is a binary tree that has a key associated with each of its internal nodes, with the additional property that the key in any node is larger than (or eqaul to) that keys in all nodes in that node's left subtree and smaller than (or equal to) the keys in all nodes in the node's right subtree. (Sedgewick, 502, Algorithms in C)

Note that this implementation is not synchronized. If multiple threads access this tree concurrently, and at least one of the threads modifies the tree structurally, it must be synchronized externally.

Version:
3.4 9/15/01
Author:
Corey Sanders

Field Summary
static int ANIMATING_BST_TREE_TYPE
          Tree type defining AnimatingBSTTree.
static int BST_TREE_TYPE
          Tree type defining only a BSTTree.
static int DRAWING_BST_TREE_TYPE
          Tree type defining a DrawingBSTTree.
 
Constructor Summary
GrowingTreeNode()
          Constructs a new, empty BSTTree, sorted according to the keys' natural order.
GrowingTreeNode(int treeType)
          Constructs a new, empty BSTTree according to the type passed.
GrowingTreeNode(int treeType, P p, IExperimentLogger<P> logger)
           
 
Method Summary
 void addAnimator(Animation a)
          Adds an animation to the current node.
 void animationEventPerformed(AnimationEvent e)
          Implements AnimationListener which requires the following method.
 int compareTo(GrowingTreeNode<P> that)
           
 void constructAnimatingBSTTree()
          Constructor for the ANIMATING_BST_TREE_TYPE.
 void constructBSTTree()
          Constructor for the BST_TREE_TYPE.
 void constructDrawingBSTTree()
          Constructor for the DRAWING_BST_TREE_TYPE.
 GrowingTreeNode<P> delete()
           
 void drawNode()
          Draws the node of the tree using the previously defined graphics.
 void drawNode(java.awt.Graphics2D g2)
          Draws the node of the tree to the given Graphics2D.
 void drawNode(java.awt.Graphics2D g2, java.awt.geom.AffineTransform a)
          Draws the node of the tree to the given Graphics2D, using the AffineTransform.
 void drawNodeAndLeftLink()
          Draws the node and left link of the tree using the previously defined graphics.
 void drawNodeAndLink()
          Draws the node and link of the tree using the previously defined graphics..
 void drawNodeAndLink(java.awt.Graphics2D g2)
          Draws the node and link of the tree to the given Graphics2D.
 void drawNodeAndLink(java.awt.Graphics2D g2, java.awt.geom.AffineTransform a)
          Draws the node and link of the tree to the given Graphics2D.
 void drawNodeAndLink(java.awt.Graphics2D g2, java.awt.geom.AffineTransform a, boolean bottomLinks)
          Draws the node and link of the tree to the given Graphics2D.
 void drawNodeAndLink(java.awt.Graphics2D g2, boolean bottomLinks)
          Draws the node and link of the tree to the given Graphics2D.
 void drawNodeAndLink(java.awt.Graphics2D g2, double sectionHeight, java.awt.geom.AffineTransform a, double drawingLevel, double powerLevel)
          Draws the node and link of the tree to the given Graphics2D.
 void drawNodeAndLink(java.awt.Graphics2D g2, double sectionHeight, java.awt.geom.AffineTransform a, double drawingLevel, double powerLevel, boolean bottomLinks)
          Draws the node and link of the tree to the given Graphics2D.
 void drawNodeAndRightLink()
          Draws the node and right link of the tree using the previously defined graphics.
 void eraseNodeAndLink()
          Erases the previous drawing of the nodeAndLinkm, simply drawing.
 void eraseNodeAndLink(java.awt.Graphics2D g2)
          Erases the previous drawing of the nodeAndLinkm, simply drawing.
 Animation getAnimator()
          Gets the first Animation of the node.
 Tree[] getChildren()
          Returns the children of the current Tree.
 java.awt.Graphics2D getCurrentGraphics()
          Gets the graphics previously defined within the tree.
 double getCurrentPower2()
          Gets the current power of 2 to which the tree was last drawn.
 java.awt.geom.AffineTransform getCurrentTransform()
          Gets the AffineTransform defined within the tree.
 double getDrawingLevel()
          Gets the drawing level for the current DrawingTree.
 GrowingTreeHead<P> getHead()
          Gets the head for the node.
 int getInorderCount()
          Returns the inorder count of the current node.
 KeyType getKey()
          Returns the key of the current BSTTree.
 java.awt.Color getLeftLinkColor()
           
 GrowingTreeNode<P> getLeftNodeInternal()
          Returns the left BSTTree of the current tree.
 int getLevel()
          Gets the the level of the current BSTTree.
 int getMaxKeyWidth()
           
 P getNodeProperties()
           
 GrowingTreeNode<P> getParentTree()
          Returns the parent of the current tree.
 java.awt.Color getRightLinkColor()
           
 GrowingTreeNode<P> getRightNodeInternal()
          Returns the right BSTTree of the current tree.
 GrowingTreeNode<P> getRoot()
           
 java.awt.geom.Rectangle2D getScreenBounds()
          Gets the bounds of the screen to which the tree is drawing.
 double getSectionHeight()
          Gets the height of the section for the DrawingTree.
 NodeSettings getSettings()
          Gets the NodeSettings of the tree.
 ShadowNode<P> getShadowNode()
          BST_TREE_TYPE Accesssor methods*
 int getTreeType()
          Gets the tree type for the BSTTree.
 java.lang.String getTreeTypeString()
          Gets the tree type String for the BSTTree.
 java.lang.Object getValue()
          Returns the value of the current BSTTree.
 IAlgorithmNode<P> insertNode(GrowingTreeNode<P> node)
           
 boolean inTree()
          Determines if the current node is within a BSTTree.
 boolean isAnimateDrawing()
          Gets the boolean flag whether the node should draw if called from an animation.
 boolean isEmpty()
          Returns true if the current BSTTree is empty.
 boolean isLeaf()
          Determines if the current node is a leaf
 boolean isNodeAnimating()
          Returns true if the node is animating.
 boolean isSettingsSaved()
          Returns true if the settings are currently saved for the DrawingTree.
 void restoreLeftSettings()
          Restores the settings for the tree, decrementing the count of left Saves and total saves by one.
 void restoreRightSettings()
          Restores the settings for the tree, decrementing the count of right Saves and total saves by one.
 void restoreSettings()
          Restores the settings for the tree, decrementing the count of saves by one.
 void restoreTransform()
          Restores the AffineTransform defined previously within the tree.
 GrowingTreeNode<P> rotateLeftPointers()
          Rotate the tree to the left.
 GrowingTreeNode<P> rotateRightPointers()
          Rotate the tree to the right.
 void rotateUp()
           
 void saveLeftSettings()
          Saves the settings for the tree, incrementing the count of left Saves and total saves by one and setting the previous settings accordingly.
 void saveRightSettings()
          Saves the settings for the tree, incrementing the count of right Saves and total saves by one and setting the previous settings accordingly.
 void saveSettings()
          Saves the settings for the tree, incrementing the count of saves by one and setting the previous settings accordingly.
 void setAnimateDrawing(boolean animateDrawing)
          Sets the boolean flag whether the node should draw if called from an animation.
 void setCurrentGraphics(java.awt.Graphics2D g2)
          Sets the graphics defined within the tree.
 void setNodeSettings(NodeSettings s)
          Sets the settings of the node for the BSTTree.
 void setScreenBounds(java.awt.geom.Rectangle2D bounds)
          Sets the bounds of the screen to which the tree is drawing.
 void setSettings(NodeSettings s)
          Sets the NodeSettings of the DrawingTree.
 void setTreeType(int treeType)
          Sets the tree type for the BSTTree.
 int size()
          Returns the number of nodes in the current Tree and below.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

BST_TREE_TYPE

public static final int BST_TREE_TYPE
Tree type defining only a BSTTree. The Drawing and Animating methods will not be available.

See Also:
Constant Field Values

DRAWING_BST_TREE_TYPE

public static final int DRAWING_BST_TREE_TYPE
Tree type defining a DrawingBSTTree. The Animating methods will not be available.

See Also:
Constant Field Values

ANIMATING_BST_TREE_TYPE

public static final int ANIMATING_BST_TREE_TYPE
Tree type defining AnimatingBSTTree. All methods will be available and all animations will occur.

See Also:
Constant Field Values
Constructor Detail

GrowingTreeNode

public GrowingTreeNode()
Constructs a new, empty BSTTree, sorted according to the keys' natural order. All keys inserted into the tree must implement the KeyType interface. Furthermore, all such keys must be mutually comparable: k1.compareTo(k2) must not throw a ClassCastException for any elements k1 and k2 in the tree. If the user attempts to put a key into the tree that violates this constraint (for example, the user attempts to put a string key into a map whose keys are integers), the add(KeyType key, Object value) call will throw a ClassCastException.

Default type is BST_TREE_TYPE.


GrowingTreeNode

public GrowingTreeNode(int treeType)
Constructs a new, empty BSTTree according to the type passed. The options for the types are BST_TREE_TYPE, DRAWING_BST_TREE_TYPE, and ANIMATING_BST_TREE_TYPE. The types are defined as follows:

Parameters:
treeType - type of tree that should be implemented.

GrowingTreeNode

public GrowingTreeNode(int treeType,
                       P p,
                       IExperimentLogger<P> logger)
Method Detail

setTreeType

public void setTreeType(int treeType)
Sets the tree type for the BSTTree.

Parameters:
treeType - setting for the tree.

getTreeType

public int getTreeType()
Gets the tree type for the BSTTree.

Returns:
tree type for the tree.

getTreeTypeString

public java.lang.String getTreeTypeString()
Gets the tree type String for the BSTTree.

Returns:
tree type String for the tree.

constructBSTTree

public void constructBSTTree()
Constructor for the BST_TREE_TYPE. This constructs and sets all values to defaults for the BST_TREE_TYPE.


getShadowNode

public ShadowNode<P> getShadowNode()
BST_TREE_TYPE Accesssor methods*


getNodeProperties

public P getNodeProperties()

getLeftLinkColor

public java.awt.Color getLeftLinkColor()

getRightLinkColor

public java.awt.Color getRightLinkColor()

getHead

public GrowingTreeHead<P> getHead()
Gets the head for the node. The head node is used in numerous operations and is the reference for the tree.

Returns:
BSTTreeHead that represents the head for this node, indicating the tree.

size

public int size()
Returns the number of nodes in the current Tree and below.

Specified by:
size in interface Tree<P extends NodeProperties>
Returns:
the number of nodes in the current Tree and below.

isEmpty

public boolean isEmpty()
Returns true if the current BSTTree is empty.

Specified by:
isEmpty in interface Tree<P extends NodeProperties>
Returns:
the boolean true if the BSTTree is empty.

getValue

public java.lang.Object getValue()
Returns the value of the current BSTTree.

Specified by:
getValue in interface Tree<P extends NodeProperties>
Returns:
the value of the current BSTTree.

compareTo

public int compareTo(GrowingTreeNode<P> that)

getKey

public KeyType getKey()
Returns the key of the current BSTTree.

Specified by:
getKey in interface Tree<P extends NodeProperties>
Returns:
the key of the current BSTTree.

getLevel

public int getLevel()
Gets the the level of the current BSTTree. The level is the integer count of how far down the tree is to the current node.

Specified by:
getLevel in interface Tree<P extends NodeProperties>
Returns:
integer count of the level of the current BSTTree.

getInorderCount

public int getInorderCount()
Returns the inorder count of the current node.

Returns:
the inorder count of the node.

getLeftNodeInternal

public GrowingTreeNode<P> getLeftNodeInternal()
Returns the left BSTTree of the current tree. Used to traverse down the binary tree.

Returns:
BSTTree that is the left subtree of the current BSTTree, null of no such tree exists.

getRightNodeInternal

public GrowingTreeNode<P> getRightNodeInternal()
Returns the right BSTTree of the current tree. Used to traverse down the binary tree.

Returns:
BSTTree that is the right subtree of the current BSTTree, null of no such tree exists.

getChildren

public Tree[] getChildren()
Returns the children of the current Tree.

Specified by:
getChildren in interface Tree<P extends NodeProperties>
Returns:
Tree array that is the children and null if the tree is an exterior node.

getParentTree

public GrowingTreeNode<P> getParentTree()
Returns the parent of the current tree. Used to traverse up the binary tree.

Specified by:
getParentTree in interface Tree<P extends NodeProperties>
Returns:
Tree that is the parent of the current tree and null if the tree is the head.

getRoot

public GrowingTreeNode<P> getRoot()

inTree

public boolean inTree()
Determines if the current node is within a BSTTree. It quickly checks if its parent points to it, and if its two children point up to it. A quick check that does not go through the entire tree.

Returns:
true if the node is within a BSTTree.

isLeaf

public boolean isLeaf()
Determines if the current node is a leaf

Returns:
true if the node is a leaf.

insertNode

public IAlgorithmNode<P> insertNode(GrowingTreeNode<P> node)

delete

public GrowingTreeNode<P> delete()

rotateRightPointers

public GrowingTreeNode<P> rotateRightPointers()
Rotate the tree to the right. It simply changes around references to BSTTrees.

Returns:
BSTTree that is the reference to the newly rotated tree.

rotateLeftPointers

public GrowingTreeNode<P> rotateLeftPointers()
Rotate the tree to the left. It simply changes around references to BSTTrees.

Returns:
BSTTree that is the reference to the newly rotated tree.

rotateUp

public void rotateUp()

getMaxKeyWidth

public int getMaxKeyWidth()

constructDrawingBSTTree

public void constructDrawingBSTTree()
Constructor for the DRAWING_BST_TREE_TYPE. This constructs and sets all values to defaults for the DRAWING_BST_TREE_TYPE.


getDrawingLevel

public double getDrawingLevel()
Gets the drawing level for the current DrawingTree. This is a necessary method for allowing intermidiary drawing between two levels, because the param is a double, not an integer.

Specified by:
getDrawingLevel in interface DrawingTree<P extends NodeProperties>
Returns:
the double level for the drawing node.

getSectionHeight

public double getSectionHeight()
Gets the height of the section for the DrawingTree. The section height is generally used to determine link length and node height when drawing the tree.

Specified by:
getSectionHeight in interface DrawingTree<P extends NodeProperties>
Returns:
double height of the drawing section for the node.

getScreenBounds

public java.awt.geom.Rectangle2D getScreenBounds()
Gets the bounds of the screen to which the tree is drawing. The bounds generally is simply the rectangle enclosing the Graphics2D passed.

Specified by:
getScreenBounds in interface DrawingTree<P extends NodeProperties>
Returns:
the rectangle representing the bounds of the screen.

getCurrentPower2

public double getCurrentPower2()
Gets the current power of 2 to which the tree was last drawn. The power is stored in this way to allow quick access and avoiding power methods.

Returns:
double power of 2 last used in drawing the tree (2^drawingLevel).

getSettings

public NodeSettings getSettings()
Gets the NodeSettings of the tree. These settings are used for drawing the node and the links of the given tree.

Specified by:
getSettings in interface DrawingTree<P extends NodeProperties>
Returns:
NodeSettings for use in drawing the tree.

isSettingsSaved

public boolean isSettingsSaved()
Returns true if the settings are currently saved for the DrawingTree.

Returns:
true if the NodeSettings are saved.

getCurrentTransform

public java.awt.geom.AffineTransform getCurrentTransform()
Gets the AffineTransform defined within the tree. The current transform is used when calling draw without the AffineTransform value.

Specified by:
getCurrentTransform in interface DrawingTree<P extends NodeProperties>
Returns:
transform set for the current drawing of the tree.

getCurrentGraphics

public java.awt.Graphics2D getCurrentGraphics()
Gets the graphics previously defined within the tree. The graphics are defined in makeTree or by the client using setCurrentGraphics.

Returns:
Graphics2D which was the previously defined graphics.

setScreenBounds

public void setScreenBounds(java.awt.geom.Rectangle2D bounds)
Sets the bounds of the screen to which the tree is drawing. Generally, these bounds are set using getClipBounds on the Graphics2D passed, however, the bounds can be set in any way.

Specified by:
setScreenBounds in interface DrawingTree<P extends NodeProperties>
Parameters:
bounds - the rectangle representing the bounds of the screen.

setCurrentGraphics

public void setCurrentGraphics(java.awt.Graphics2D g2)
Sets the graphics defined within the tree.

Parameters:
g2 - Graphics2D which are the defined graphics for the tree.

setNodeSettings

public void setNodeSettings(NodeSettings s)
Sets the settings of the node for the BSTTree. No settings are saved and the previous settings are not modified.

Parameters:
s - NodeSettings set for the entire tree.

setSettings

public void setSettings(NodeSettings s)
Sets the NodeSettings of the DrawingTree. These settings are used for drawing the node and the links of the given tree.

If the settings are saved, the previous settings are modified to the NodeSettings, leaving the current settings unmodified. To modify the current settings, use setNodeSettings. If the settings are not saved, the previous settings are made null and the currentSettings are set.

Specified by:
setSettings in interface DrawingTree<P extends NodeProperties>
Parameters:
s - NodeSettings for use in drawing the tree.

restoreTransform

public void restoreTransform()
Restores the AffineTransform defined previously within the tree. The previous transform is always the last transform defined and is automatically updated each time setCurrentTransform is called.


saveSettings

public void saveSettings()
Saves the settings for the tree, incrementing the count of saves by one and setting the previous settings accordingly.


saveLeftSettings

public void saveLeftSettings()
Saves the settings for the tree, incrementing the count of left Saves and total saves by one and setting the previous settings accordingly.


saveRightSettings

public void saveRightSettings()
Saves the settings for the tree, incrementing the count of right Saves and total saves by one and setting the previous settings accordingly.


restoreLeftSettings

public void restoreLeftSettings()
Restores the settings for the tree, decrementing the count of left Saves and total saves by one. If the left settings have been restored completely, than the NodeSettings for the tree are set accordingly.


restoreRightSettings

public void restoreRightSettings()
Restores the settings for the tree, decrementing the count of right Saves and total saves by one. If the right settings have been restored completely, than the NodeSettings for the tree are set accordingly.


restoreSettings

public void restoreSettings()
Restores the settings for the tree, decrementing the count of saves by one. If the settings have been restored completely, than the NodeSettings for the tree are set accordingly.


drawNode

public void drawNode()
Draws the node of the tree using the previously defined graphics. The drawing uses the previously defined AffineTransform.

Specified by:
drawNode in interface DrawingTree<P extends NodeProperties>

drawNode

public void drawNode(java.awt.Graphics2D g2)
Draws the node of the tree to the given Graphics2D. The drawing uses the previously defined AffineTransform.

Specified by:
drawNode in interface DrawingTree<P extends NodeProperties>
Parameters:
g2 - graphics to which the node is drawn.

drawNode

public void drawNode(java.awt.Graphics2D g2,
                     java.awt.geom.AffineTransform a)
Draws the node of the tree to the given Graphics2D, using the AffineTransform. The drawing uses the AffineTransform to determine the exact way to draw the node.

Specified by:
drawNode in interface DrawingTree<P extends NodeProperties>
Parameters:
g2 - graphics to which the node is drawn.
a - transform to draw the node.

drawNodeAndLeftLink

public void drawNodeAndLeftLink()
Draws the node and left link of the tree using the previously defined graphics. The drawing uses the previously defined AffineTransform, section height, drawing level, and power level.


drawNodeAndRightLink

public void drawNodeAndRightLink()
Draws the node and right link of the tree using the previously defined graphics. The drawing uses the previously defined AffineTransform, section height, drawing level, and power level.


eraseNodeAndLink

public void eraseNodeAndLink()
Erases the previous drawing of the nodeAndLinkm, simply drawing.


eraseNodeAndLink

public void eraseNodeAndLink(java.awt.Graphics2D g2)
Erases the previous drawing of the nodeAndLinkm, simply drawing.


drawNodeAndLink

public void drawNodeAndLink()
Draws the node and link of the tree using the previously defined graphics.. The drawing uses the previously defined AffineTransform, section height, drawing level, and power level.

Specified by:
drawNodeAndLink in interface DrawingTree<P extends NodeProperties>

drawNodeAndLink

public void drawNodeAndLink(java.awt.Graphics2D g2)
Draws the node and link of the tree to the given Graphics2D. The drawing generally uses the previously defined AffineTransform, section height, drawing level, and power level.

Specified by:
drawNodeAndLink in interface DrawingTree<P extends NodeProperties>
Parameters:
g2 - graphics to which the node is drawn.

drawNodeAndLink

public void drawNodeAndLink(java.awt.Graphics2D g2,
                            boolean bottomLinks)
Draws the node and link of the tree to the given Graphics2D. The drawing generally uses the previously defined AffineTransform, section height, drawing level, and power level.

Parameters:
g2 - graphics to which the node is drawn.
bottomLinks - the boolean to declare whether the bottom links should be drawn.

drawNodeAndLink

public void drawNodeAndLink(java.awt.Graphics2D g2,
                            java.awt.geom.AffineTransform a)
Draws the node and link of the tree to the given Graphics2D. Using the Transform, the node is affect, while the links use the previously defined transform to draw. Consequently, the node made shift and enlarge while keeping the links constant.

Parameters:
g2 - graphics to which the node and links are drawn.
a - transfrom to draw the node and links.

drawNodeAndLink

public void drawNodeAndLink(java.awt.Graphics2D g2,
                            java.awt.geom.AffineTransform a,
                            boolean bottomLinks)
Draws the node and link of the tree to the given Graphics2D. Using the Transform, the node is affect, while the links use the previously defined transform to draw. Consequently, the node made shift and enlarge while keeping the links constant.

Parameters:
g2 - graphics to which the node and links are drawn.
a - transfrom to draw the node and links.
bottomLinks - the boolean to declare whether the bottom links should be drawn.

drawNodeAndLink

public void drawNodeAndLink(java.awt.Graphics2D g2,
                            double sectionHeight,
                            java.awt.geom.AffineTransform a,
                            double drawingLevel,
                            double powerLevel)
Draws the node and link of the tree to the given Graphics2D. The drawing generally uses the AffineTransform, section height, drawing level, and power level to render the node and its links.

Specified by:
drawNodeAndLink in interface DrawingTree<P extends NodeProperties>
Parameters:
g2 - graphics to which the node and links are drawn.
sectionHeight - the height of the tree' section, to draw the correct lengths for the links.
a - transfrom to draw the node and links.
drawingLevel - the level in the tree to which the node is currently being drawn.
powerLevel - the power to which the links extend, depending on how many links are present.

drawNodeAndLink

public void drawNodeAndLink(java.awt.Graphics2D g2,
                            double sectionHeight,
                            java.awt.geom.AffineTransform a,
                            double drawingLevel,
                            double powerLevel,
                            boolean bottomLinks)
Draws the node and link of the tree to the given Graphics2D. The drawing generally uses the AffineTransform, section height, drawing level, and power level to render the node and its links.

Parameters:
g2 - graphics to which the node and links are drawn.
sectionHeight - the height of the tree' section, to draw the correct lengths for the links.
a - transfrom to draw the node and links.
drawingLevel - the level in the tree to which the node is currently being drawn.
powerLevel - the power to which the links extend, depending on how many links are present.
bottomLinks - the boolean to declare whether the bottom links should be drawn.

constructAnimatingBSTTree

public void constructAnimatingBSTTree()
Constructor for the ANIMATING_BST_TREE_TYPE. This constructs and sets all values to defaults for the ANIMATING_BST_TREE_TYPE.


isNodeAnimating

public boolean isNodeAnimating()
Returns true if the node is animating. It simply determines if the list of animators is empty.

Specified by:
isNodeAnimating in interface AnimatingTree<P extends NodeProperties>
Returns:
true if the node is currently animating.

getAnimator

public Animation getAnimator()
Gets the first Animation of the node.

Specified by:
getAnimator in interface AnimatingTree<P extends NodeProperties>
Returns:
Animation which is the first Animation of the node.

setAnimateDrawing

public void setAnimateDrawing(boolean animateDrawing)
Sets the boolean flag whether the node should draw if called from an animation. Only special cases is the flag set to false (Deletion Animations).

Parameters:
animateDrawing - boolean flag to draw if animating.

addAnimator

public void addAnimator(Animation a)
Adds an animation to the current node. This method does not add the node to listen for AnimationEvents. That must be performed by the user.

Specified by:
addAnimator in interface AnimatingTree<P extends NodeProperties>
Parameters:
a - the Animation being added to the node.

isAnimateDrawing

public boolean isAnimateDrawing()
Gets the boolean flag whether the node should draw if called from an animation. Only special cases is the flag set to false (Deletion Animations).

Returns:
boolean flag to draw if animating.

animationEventPerformed

public void animationEventPerformed(AnimationEvent e)
Implements AnimationListener which requires the following method. The only status of animation it listens for is Animation.FINISH, to remove the animation from the animators list.

Specified by:
animationEventPerformed in interface AnimationListener
Parameters:
e - AnimationEvent that represents the information of the Animation.