From 4d0a59a0023f2b4fca144a089a3f75acb4ebd62b Mon Sep 17 00:00:00 2001 From: bculkin2442 Date: Tue, 2 Jul 2019 18:32:37 -0400 Subject: Move tests to new package --- src/main/java/bjc/data/Multimap.java | 15 +++++++++++++++ src/main/java/bjc/esodata/ThresholdSet.java | 13 +++++++++---- 2 files changed, 24 insertions(+), 4 deletions(-) create mode 100644 src/main/java/bjc/data/Multimap.java (limited to 'src/main/java/bjc') diff --git a/src/main/java/bjc/data/Multimap.java b/src/main/java/bjc/data/Multimap.java new file mode 100644 index 0000000..3a9ca44 --- /dev/null +++ b/src/main/java/bjc/data/Multimap.java @@ -0,0 +1,15 @@ +package bjc.data; + +/** + * A map with support for multiple values per key. + * + * @param + * The type of the keys for the map. + * @param + * The type of the values for the map. + * + * @author Ben Culkin + */ +public class Multimap { + +} diff --git a/src/main/java/bjc/esodata/ThresholdSet.java b/src/main/java/bjc/esodata/ThresholdSet.java index 20b4ceb..bc1b517 100644 --- a/src/main/java/bjc/esodata/ThresholdSet.java +++ b/src/main/java/bjc/esodata/ThresholdSet.java @@ -28,6 +28,7 @@ public class ThresholdSet { * the set will contain key after it returns (as a matter of fact, attempting to add the * component might actually cause it to be removed from the collection). */ + @Override public boolean add(KeyType key) { // Qualified-this; allows us to reference the 'this' of our enclosing type. int ret = ThresholdSet.this.add(key); @@ -38,6 +39,7 @@ public class ThresholdSet { return true; } + @Override public boolean remove(Object o) { // Will throw a ClassCastException if you give us something bad. KeyType k = (KeyType)o; @@ -50,6 +52,7 @@ public class ThresholdSet { return false; } + @Override public boolean contains(Object o) { // Will throw a ClassCastException if you give us something bad. KeyType k = (KeyType)o; @@ -62,10 +65,12 @@ public class ThresholdSet { return false; } + @Override public int size() { return ThresholdSet.this.setSize(); } + @Override public Iterator iterator() { return ThresholdSet.this.setIterator(); } @@ -93,7 +98,7 @@ public class ThresholdSet { * The keys to add. * @return An array containing the results of adding the keys. */ - public int[] addAll(KeyType... keys) { + public int[] addKeys(KeyType... keys) { int[] ret = new int[keys.length]; for (int i = 0; i < keys.length; i++) { @@ -141,7 +146,7 @@ public class ThresholdSet { * * @return The results from removing the keys. */ - public int[] removeAll(KeyType... keys) { + public int[] removeKeys(KeyType... keys) { int[] ret = new int[keys.length]; for (int i = 0; i < keys.length; i++) { @@ -162,7 +167,7 @@ public class ThresholdSet { */ public int remove(KeyType key) { if (keySet.contains(key)) { - // No more occurances + // No more occurrences keySet.remove(key); return 0; @@ -196,7 +201,7 @@ public class ThresholdSet { * * @return The containment counts for each key. */ - public int[] containsAll(KeyType... keys) { + public int[] containsKeys(KeyType... keys) { int[] ret = new int[keys.length]; for (int i = 0; i < keys.length; i++) { -- cgit v1.2.3