edu.princeton.cs.algs4.growingtree.demos
Class RBNodeProperties

java.lang.Object
  extended by edu.princeton.cs.algs4.growingtree.framework.NodeProperties
      extended by edu.princeton.cs.algs4.growingtree.demos.RBNodeProperties
All Implemented Interfaces:
java.lang.Cloneable

public class RBNodeProperties
extends NodeProperties


Field Summary
static boolean BLACK
           
static boolean RED
           
 
Fields inherited from class edu.princeton.cs.algs4.growingtree.framework.NodeProperties
NULL_HEIGHT
 
Constructor Summary
RBNodeProperties()
           
 
Method Summary
 boolean colorParentLink()
          Determines whether the node itself is colored or its parent link
 boolean getColor()
           
 java.awt.Color getNodeColor()
           
 java.lang.Integer getULIntegerFieldValue()
           
 RBNodeProperties makeDefaultProperties()
          This functions as a factory for NodeProperty objects.
 void setColor(boolean c)
           
 
Methods inherited from class edu.princeton.cs.algs4.growingtree.framework.NodeProperties
clone, getHeight, getIntegerFieldColor, getLeftLinkColor, getLLIntegerFieldValue, getLRIntegerFieldValue, getRightLinkColor, getSize, getURIntegerFieldValue, setHeight, setSize
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

RED

public static final boolean RED
See Also:
Constant Field Values

BLACK

public static final boolean BLACK
See Also:
Constant Field Values
Constructor Detail

RBNodeProperties

public RBNodeProperties()
Method Detail

makeDefaultProperties

public RBNodeProperties makeDefaultProperties()
Description copied from class: NodeProperties
This functions as a factory for NodeProperty objects. It is called whenever a new node is created (for insertion into the tree). If extended, this MUST be overridden to return an instance of the subclass as a result of some of the quirks of Java generics.

Overrides:
makeDefaultProperties in class NodeProperties
Returns:
An instance of this class. Subclasses should return an instance of the subclass.

getColor

public boolean getColor()

setColor

public void setColor(boolean c)

getNodeColor

public java.awt.Color getNodeColor()
Overrides:
getNodeColor in class NodeProperties
Returns:
The color this node should be drawn. If colorParentLink returns true, then the parent link will be drawn this color and the node will be black.

colorParentLink

public boolean colorParentLink()
Description copied from class: NodeProperties
Determines whether the node itself is colored or its parent link

Overrides:
colorParentLink in class NodeProperties
Returns:
True if getNodeColor should be used for the parent link

getULIntegerFieldValue

public java.lang.Integer getULIntegerFieldValue()
Overrides:
getULIntegerFieldValue in class NodeProperties
Returns:
The value the upper right integer field should contain, or null if nothing should be drawn. This is not to be confused with the actual key value of the node. It is to be used for values like height or rank.