Commit 4bad0795 authored by Ari Trachtenberg's avatar Ari Trachtenberg
Browse files

some simplifications

parent 8fb98f52
Loading
Loading
Loading
Loading
+6 −6
Original line number Diff line number Diff line
@@ -51,13 +51,13 @@ public class BST<keyType extends Comparable<keyType> > {
    // ... getters
    public final Integer getNodeId() { return nodeId; }
    public final keyType getKey() { return key; }
    public final BST<keyType> getLeft() { return left; }
    public final BST<keyType> getRight() { return right; }
    public BST<keyType> getLeft() { return left; }
    public BST<keyType> getRight() { return right; }

    // ... setters
    public final void setNodeID(Integer newId) { nodeId=newId; }
    public final void setLeft(BST<keyType> newLeft) { left=newLeft; }
    public final void setRight(BST<keyType> newRight) { left=newRight; }
    public void setLeft(BST<keyType> newLeft) { left=newLeft; }
    public void setRight(BST<keyType> newRight) { left=newRight; }

    /**
     * Compute how to transform this BST into the BST {@code otherTree} using rotations.
@@ -86,7 +86,7 @@ public class BST<keyType extends Comparable<keyType> > {
     *
     * @param newKey The new key to be inserted
     */
    final public void insert(keyType newKey) {
    public void insert(keyType newKey) {
        if (key == null) // insert here
            key = newKey;
        else if (newKey.compareTo(key) > 0) { // i.e. newKey > key
@@ -105,7 +105,7 @@ public class BST<keyType extends Comparable<keyType> > {
    /**
     * Return the BST rooted at this node as a human-readable string
     */
    final public String toString() {
    public String toString() {
        return toString("|");
    }