Commit 7cd40ad4 authored by Ari Trachtenberg's avatar Ari Trachtenberg
Browse files

cleaned up code

parent 172e11d3
Loading
Loading
Loading
Loading
+4 −4
Original line number Original line Diff line number Diff line
@@ -6,8 +6,8 @@ package edu.bu.ec504.hw2;
    public class BstRotation {
    public class BstRotation {
        public enum RotationType {ZIG, ZAG}
        public enum RotationType {ZIG, ZAG}


        public BstRotation(Integer myRotRootID, RotationType myRotType) {
        public BstRotation(Integer myRotKey, RotationType myRotType) {
            rotRootID = myRotRootID;
            rotKey = myRotKey;
            rotType = myRotType;
            rotType = myRotType;
        }
        }


@@ -24,10 +24,10 @@ package edu.bu.ec504.hw2;
                    result.append("ZAG");
                    result.append("ZAG");
                    break;
                    break;
            }
            }
            result.append(" on node ID ").append(rotRootID);
            result.append(" on node ID ").append(rotKey);
            return result.toString();
            return result.toString();
        }
        }


        private final Integer rotRootID;           // the ID of the root of the rotation being performed
        private final Integer rotKey;            // the key of the root of the rotation being performed
        private final RotationType rotType;      // the type of rotation being performed
        private final RotationType rotType;      // the type of rotation being performed
    }
    }
+24 −0
Original line number Original line Diff line number Diff line
package edu.bu.ec504.hw2;

/**
 * A Binary Search Tree that can be rotated around nodes.
 * @inheritDoc
 */
public class rotationalBST<keyType extends Comparable<keyType>> extends BST<keyType> {

    /**
     * @return The number of nodes in the subtree rooted at this node.
     */
    int size() {
        return 0;
    }

    /**
     * Perform the rotation specified in <code>op</code> on the current tree.
     * @param op A rotational operation to complete.
     * @return true iff the rotation was successful.
     */
    boolean rotate(BstRotation op) {
        return false;
    }
}