edu.princeton.cs.algs4.growingtree.demos
Class RBNodeProperties
java.lang.Object
edu.princeton.cs.algs4.growingtree.framework.NodeProperties
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
|
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 |
RED
public static final boolean RED
- See Also:
- Constant Field Values
BLACK
public static final boolean BLACK
- See Also:
- Constant Field Values
RBNodeProperties
public RBNodeProperties()
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.