/** Realization of a dictionary by means of a red-black tree. */
public class RBTree extends BinarySearchTree implements Dictionary {
  public RBTree() { super(); }
  public RBTree(Comparator C) { super(C); }
  /** Nested class for the nodes of a red-black tree */
  protected static class RBNode extends BTNode {
    protected boolean isRed;  // we add a color field to a BTNode
    RBNode() {/* default constructor */}
    /** Preferred constructor */
    RBNode(Object element, BTPosition parent,
	   BTPosition left, BTPosition right) {
      super(element, parent, left, right);
      isRed = false;
    } 
    public boolean isRed()  {return isRed;}
    public void makeRed()  {isRed = true;}
    public void makeBlack()  {isRed = false;}
    public void setColor(boolean color)  {isRed = color;}
  }