summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/main/java/bjc/data/Multimap.java15
-rw-r--r--src/main/java/bjc/esodata/ThresholdSet.java13
-rw-r--r--src/test/java/bjc/TestUtils.java (renamed from src/test/java/io/github/bculkin2442/TestUtils.java)2
-rw-r--r--src/test/java/bjc/data/BooleanToggleTest.java (renamed from src/test/java/io/github/bculkin2442/data/BooleanToggleTest.java)2
-rw-r--r--src/test/java/bjc/data/CircularIteratorTest.java (renamed from src/test/java/io/github/bculkin2442/data/CircularIteratorTest.java)6
-rw-r--r--src/test/java/bjc/data/QueuedIteratorTest.java (renamed from src/test/java/io/github/bculkin2442/data/QueuedIteratorTest.java)4
-rw-r--r--src/test/java/bjc/esodata/ThresholdSetTest.java (renamed from src/test/java/io/github/bculkin2442/esodata/ThresholdSetTest.java)14
7 files changed, 38 insertions, 18 deletions
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 <KeyType>
+ * The type of the keys for the map.
+ * @param <ValueType>
+ * The type of the values for the map.
+ *
+ * @author Ben Culkin
+ */
+public class Multimap<KeyType, ValueType> {
+
+}
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<KeyType> {
* 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<KeyType> {
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<KeyType> {
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<KeyType> {
return false;
}
+ @Override
public int size() {
return ThresholdSet.this.setSize();
}
+ @Override
public Iterator<KeyType> iterator() {
return ThresholdSet.this.setIterator();
}
@@ -93,7 +98,7 @@ public class ThresholdSet<KeyType> {
* 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<KeyType> {
*
* @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<KeyType> {
*/
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<KeyType> {
*
* @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++) {
diff --git a/src/test/java/io/github/bculkin2442/TestUtils.java b/src/test/java/bjc/TestUtils.java
index 80f7d96..3c2efa7 100644
--- a/src/test/java/io/github/bculkin2442/TestUtils.java
+++ b/src/test/java/bjc/TestUtils.java
@@ -1,4 +1,4 @@
-package io.github.bculkin2442;
+package bjc;
import java.util.Iterator;
import java.util.List;
diff --git a/src/test/java/io/github/bculkin2442/data/BooleanToggleTest.java b/src/test/java/bjc/data/BooleanToggleTest.java
index 8211117..b3d33eb 100644
--- a/src/test/java/io/github/bculkin2442/data/BooleanToggleTest.java
+++ b/src/test/java/bjc/data/BooleanToggleTest.java
@@ -1,4 +1,4 @@
-package io.github.bculkin2442.data;
+package bjc.data;
import static org.junit.Assert.assertEquals;
diff --git a/src/test/java/io/github/bculkin2442/data/CircularIteratorTest.java b/src/test/java/bjc/data/CircularIteratorTest.java
index 80fbb54..82a08c6 100644
--- a/src/test/java/io/github/bculkin2442/data/CircularIteratorTest.java
+++ b/src/test/java/bjc/data/CircularIteratorTest.java
@@ -1,4 +1,6 @@
-package io.github.bculkin2442.data;
+package bjc.data;
+
+import static bjc.TestUtils.*;
import java.util.Arrays;
import java.util.List;
@@ -6,8 +8,6 @@ import java.util.List;
import org.junit.Test;
import bjc.data.CircularIterator;
-
-import static io.github.bculkin2442.TestUtils.*;
/**
* Test for circular iterators.,
*
diff --git a/src/test/java/io/github/bculkin2442/data/QueuedIteratorTest.java b/src/test/java/bjc/data/QueuedIteratorTest.java
index 0c1144b..69f37b8 100644
--- a/src/test/java/io/github/bculkin2442/data/QueuedIteratorTest.java
+++ b/src/test/java/bjc/data/QueuedIteratorTest.java
@@ -1,4 +1,4 @@
-package io.github.bculkin2442.data;
+package bjc.data;
import static java.util.Arrays.asList;
@@ -6,8 +6,8 @@ import org.junit.Test;
import bjc.data.QueuedIterator;
+import static bjc.TestUtils.*;
import static bjc.data.QueuedIterator.queued;
-import static io.github.bculkin2442.TestUtils.*;
/**
* Test of QueuedIterator.
diff --git a/src/test/java/io/github/bculkin2442/esodata/ThresholdSetTest.java b/src/test/java/bjc/esodata/ThresholdSetTest.java
index c8f2bd3..b37f866 100644
--- a/src/test/java/io/github/bculkin2442/esodata/ThresholdSetTest.java
+++ b/src/test/java/bjc/esodata/ThresholdSetTest.java
@@ -1,14 +1,14 @@
-package io.github.bculkin2442.esodata;
+package bjc.esodata;
import org.junit.Test;
+import bjc.TestUtils;
import bjc.esodata.ThresholdSet;
-import io.github.bculkin2442.TestUtils;
import java.util.Iterator;
+import static bjc.TestUtils.*;
import static org.junit.Assert.*;
-import static io.github.bculkin2442.TestUtils.*;
/**
* Tests for ThresholdSet
@@ -20,7 +20,7 @@ public class ThresholdSetTest {
public void testAdd() {
ThresholdSet<String> thst = new ThresholdSet<>();
- thst.addAll("a", "b");
+ thst.addKeys("a", "b");
assertIteratorEquals(false, thst.setView().iterator(), "a", "b");
}
@@ -29,7 +29,7 @@ public class ThresholdSetTest {
public void testAddMulti() {
ThresholdSet<String> thst = new ThresholdSet<>();
- thst.addAll("a", "b", "a");
+ thst.addKeys("a", "b", "a");
assertIteratorEquals(false, thst.setView().iterator(), "b");
}
@@ -38,8 +38,8 @@ public class ThresholdSetTest {
public void testRemoveMulti() {
ThresholdSet<String> thst = new ThresholdSet<>();
- thst.addAll("a", "a", "b");
- thst.removeAll("a");
+ thst.addKeys("a", "a", "b");
+ thst.removeKeys("a");
assertIteratorEquals(false, thst.setView().iterator(), "a", "b");
}