/** * Tree node used by the Randomized Meldable Priority Queue to store a single * element. */ private final class MeldNode<F extends Comparable<F>> implements Comparable<MeldNode<F>> { /** * The left child node of the (sub)tree rooted at this node. */ public MeldNode<F> leftChild = null; /** * The right child node of the (sub)tree rooted at this node. */ public MeldNode<F> rightChild = null; /** * The object (value) represented by this node. */ private F obj = null; /** * Default constructor that creates an <code>MeldNode</code> instance * for the given object. * * The new node will initially have no children. * * @param obj the object to store in this node */ public MeldNode(F obj) { this.obj = obj; } /** * Return the object (value) represented by this node. * * @return the contents of this node */ public F getObject() { return obj; } /** * Compares the value of this node with the value of the specified node for * order. * * @param other the node to compare with * @return a negative integer, zero, or a positive integer as this * node's value is less than, equal to, or greater than the * value of the specified node. * @see java.lang.Comparable */ public int compareTo(MeldNode<F> other) { obj.compareTo(other); } }}