Loading src/edu/bu/ec504/hw2/BST.java +6 −2 Original line number Diff line number Diff line Loading @@ -50,17 +50,21 @@ public class BST<keyType extends Comparable<keyType> > { * Compute how to transform this BST into the BST <code>otherTree</code> using rotations. * * @param otherTree The into which we seek to transform the current tree. * @expects The keys of this object are {@link #equals(Object)}} to the keys of <code>otherTree</code> * in a one-to-one correspondence. * @return An ArrayList of rotations indicating which rotations around which nodes * must be performed to transform <first> into <second. */ public ArrayList<BstRotation> transformTo(BST otherTree) { public ArrayList<BstRotation<keyType> > transformTo(BST<keyType> otherTree) { throw new UnsupportedOperationException("This method should be properly implemented in a subclass."); } /** * Static version of {@link #transformTo(BST)}. * Only transforms a BST to another BST of the same key type. */ public static ArrayList transform(BST firstTree, BST secondTree) { public static <oneKeyType extends Comparable<oneKeyType> > ArrayList transform(BST<oneKeyType> firstTree, BST<oneKeyType> secondTree) { return firstTree.transformTo(secondTree); } Loading Loading
src/edu/bu/ec504/hw2/BST.java +6 −2 Original line number Diff line number Diff line Loading @@ -50,17 +50,21 @@ public class BST<keyType extends Comparable<keyType> > { * Compute how to transform this BST into the BST <code>otherTree</code> using rotations. * * @param otherTree The into which we seek to transform the current tree. * @expects The keys of this object are {@link #equals(Object)}} to the keys of <code>otherTree</code> * in a one-to-one correspondence. * @return An ArrayList of rotations indicating which rotations around which nodes * must be performed to transform <first> into <second. */ public ArrayList<BstRotation> transformTo(BST otherTree) { public ArrayList<BstRotation<keyType> > transformTo(BST<keyType> otherTree) { throw new UnsupportedOperationException("This method should be properly implemented in a subclass."); } /** * Static version of {@link #transformTo(BST)}. * Only transforms a BST to another BST of the same key type. */ public static ArrayList transform(BST firstTree, BST secondTree) { public static <oneKeyType extends Comparable<oneKeyType> > ArrayList transform(BST<oneKeyType> firstTree, BST<oneKeyType> secondTree) { return firstTree.transformTo(secondTree); } Loading