Loading src/edu/bu/ec504/hw2/Main.java +1 −1 Original line number Diff line number Diff line Loading @@ -21,7 +21,7 @@ class Main { intResult = intTest.extendedContains(6); System.out.println("... 6 is in your BST? " + intResult.getSearchResult()+" in "+intResult.getSearchCount()+" steps;\n "+intResult.getLastSeen()); System.out.println("Your string BST is:\n"+strTest); System.out.println("One rotation: "+new BSTRotation(3, BSTRotation.RotationType.ZAG)); System.out.println("One rotation: "+ new BSTRotation<>(3, BSTRotation.RotationType.ZAG)); } } src/edu/bu/ec504/hw2/bst/BST.java +5 −5 Original line number Diff line number Diff line Loading @@ -10,10 +10,10 @@ public class BST<keyType extends Comparable<keyType> > { /** * Represents one rotation (ZIG or ZAG) around one key in a Binary Search Tree */ public static class BSTRotation { public static class BSTRotation<keyType> { public enum RotationType {ZIG, ZAG} public BSTRotation(Integer myRotKey, RotationType myRotType) { public BSTRotation(keyType myRotKey, RotationType myRotType) { rotKey = myRotKey; rotType = myRotType; } Loading @@ -36,10 +36,10 @@ public class BST<keyType extends Comparable<keyType> > { } // getters Integer getRotKey() { return rotKey; } keyType getRotKey() { return rotKey; } RotationType getRotType() { return rotType; } private final Integer rotKey; // the key of the root of the rotation being performed private final keyType rotKey; // the key of the root of the rotation being performed private final RotationType rotType; // the type of rotation being performed } Loading Loading @@ -194,7 +194,7 @@ public class BST<keyType extends Comparable<keyType> > { * Inserts the new number as a key into the binary search tree * * @param newKey The new key to be inserted. * @return * @return true if the key was successfully inserted into the tree */ public boolean add(keyType newKey) { searchRecord theRecord = searchHelper(newKey); Loading src/edu/bu/ec504/hw2/bst/ExtendedBSTSet.java +1 −1 Original line number Diff line number Diff line Loading @@ -16,7 +16,7 @@ public class ExtendedBSTSet<keyType extends Comparable<keyType>> extends BSTSet< * @param op A rotational operation to complete. * @return true iff the rotation was successful. */ public boolean rotate(BSTRotation op) { public boolean rotate(BSTRotation<keyType> op) { return false; } Loading Loading
src/edu/bu/ec504/hw2/Main.java +1 −1 Original line number Diff line number Diff line Loading @@ -21,7 +21,7 @@ class Main { intResult = intTest.extendedContains(6); System.out.println("... 6 is in your BST? " + intResult.getSearchResult()+" in "+intResult.getSearchCount()+" steps;\n "+intResult.getLastSeen()); System.out.println("Your string BST is:\n"+strTest); System.out.println("One rotation: "+new BSTRotation(3, BSTRotation.RotationType.ZAG)); System.out.println("One rotation: "+ new BSTRotation<>(3, BSTRotation.RotationType.ZAG)); } }
src/edu/bu/ec504/hw2/bst/BST.java +5 −5 Original line number Diff line number Diff line Loading @@ -10,10 +10,10 @@ public class BST<keyType extends Comparable<keyType> > { /** * Represents one rotation (ZIG or ZAG) around one key in a Binary Search Tree */ public static class BSTRotation { public static class BSTRotation<keyType> { public enum RotationType {ZIG, ZAG} public BSTRotation(Integer myRotKey, RotationType myRotType) { public BSTRotation(keyType myRotKey, RotationType myRotType) { rotKey = myRotKey; rotType = myRotType; } Loading @@ -36,10 +36,10 @@ public class BST<keyType extends Comparable<keyType> > { } // getters Integer getRotKey() { return rotKey; } keyType getRotKey() { return rotKey; } RotationType getRotType() { return rotType; } private final Integer rotKey; // the key of the root of the rotation being performed private final keyType rotKey; // the key of the root of the rotation being performed private final RotationType rotType; // the type of rotation being performed } Loading Loading @@ -194,7 +194,7 @@ public class BST<keyType extends Comparable<keyType> > { * Inserts the new number as a key into the binary search tree * * @param newKey The new key to be inserted. * @return * @return true if the key was successfully inserted into the tree */ public boolean add(keyType newKey) { searchRecord theRecord = searchHelper(newKey); Loading
src/edu/bu/ec504/hw2/bst/ExtendedBSTSet.java +1 −1 Original line number Diff line number Diff line Loading @@ -16,7 +16,7 @@ public class ExtendedBSTSet<keyType extends Comparable<keyType>> extends BSTSet< * @param op A rotational operation to complete. * @return true iff the rotation was successful. */ public boolean rotate(BSTRotation op) { public boolean rotate(BSTRotation<keyType> op) { return false; } Loading