summaryrefslogtreecommitdiff
path: root/src/main/java/bjc/esodata/MapSet.java
diff options
context:
space:
mode:
authorBen Culkin <scorpress@gmail.com>2020-04-13 18:43:13 -0400
committerBen Culkin <scorpress@gmail.com>2020-04-13 18:43:13 -0400
commitf51f6da7319787348c38b875652b5c0e9f88c8aa (patch)
tree943888fc724da2d2dedd89abec99dcbfcc089fd0 /src/main/java/bjc/esodata/MapSet.java
parent9052ed6da37af23ea82588d248f409e60a33c6cb (diff)
Cleanup pass
Pass to do some cleanups
Diffstat (limited to 'src/main/java/bjc/esodata/MapSet.java')
-rw-r--r--src/main/java/bjc/esodata/MapSet.java57
1 files changed, 30 insertions, 27 deletions
diff --git a/src/main/java/bjc/esodata/MapSet.java b/src/main/java/bjc/esodata/MapSet.java
index cbb5d34..a80c482 100644
--- a/src/main/java/bjc/esodata/MapSet.java
+++ b/src/main/java/bjc/esodata/MapSet.java
@@ -8,13 +8,13 @@ import java.util.Set;
/**
* A string-keyed set of maps.
- *
+ *
* @author bjculkin
*
* @param <KeyType>
- * The key type of the maps.
+ * The key type of the maps.
* @param <ValueType>
- * The value type of the maps.
+ * The value type of the maps.
*/
public class MapSet<KeyType, ValueType> extends AbstractMap<KeyType, ValueType> {
private Map<String, Map<KeyType, ValueType>> backing;
@@ -30,9 +30,9 @@ public class MapSet<KeyType, ValueType> extends AbstractMap<KeyType, ValueType>
/**
* Create a new set of maps, with the specified set of maps.
- *
+ *
* @param back
- * The set of maps to use.
+ * The set of maps to use.
*/
public MapSet(Map<String, Map<KeyType, ValueType>> back) {
backing = back;
@@ -40,11 +40,11 @@ public class MapSet<KeyType, ValueType> extends AbstractMap<KeyType, ValueType>
/**
* Add a keyed map.
- *
+ *
* @param key
- * The key for the map.
+ * The key for the map.
* @param map
- * The map itself.
+ * The map itself.
*/
public void addMap(String key, Map<KeyType, ValueType> map) {
backing.put(key, map);
@@ -61,9 +61,9 @@ public class MapSet<KeyType, ValueType> extends AbstractMap<KeyType, ValueType>
/**
* Check if there is a map attached to the specified key.
- *
+ *
* @param key
- * The key to look for.
+ * The key to look for.
* @return Whether or not there is anything attached to the key.
*/
public boolean containsMap(String key) {
@@ -72,9 +72,9 @@ public class MapSet<KeyType, ValueType> extends AbstractMap<KeyType, ValueType>
/**
* Get the map attached to a specified key.
- *
+ *
* @param key
- * The key to look for.
+ * The key to look for.
* @return The map attached to the key.
*/
public Map<KeyType, ValueType> getMap(String key) {
@@ -83,7 +83,7 @@ public class MapSet<KeyType, ValueType> extends AbstractMap<KeyType, ValueType>
/**
* Get all of the backing entries.
- *
+ *
* @return The backing entries.
*/
public Set<Map.Entry<String, Map<KeyType, ValueType>>> getMapEntries() {
@@ -92,7 +92,7 @@ public class MapSet<KeyType, ValueType> extends AbstractMap<KeyType, ValueType>
/**
* Get all of the keys.
- *
+ *
* @return The keys currently in use.
*/
public Set<String> getMapKeys() {
@@ -101,7 +101,7 @@ public class MapSet<KeyType, ValueType> extends AbstractMap<KeyType, ValueType>
/**
* Get all of the keyed maps.
- *
+ *
* @return The keyed maps.
*/
public Collection<Map<KeyType, ValueType>> getMapValues() {
@@ -110,13 +110,14 @@ public class MapSet<KeyType, ValueType> extends AbstractMap<KeyType, ValueType>
/**
* Set the current map.
- *
+ *
* @param key
- * The key to use as the current map.
+ * The key to use as the current map.
* @return False if there is no map attached to the key, true otherwise.
*/
public boolean setMap(String key) {
- if (!backing.containsKey(key)) return false;
+ if (!backing.containsKey(key))
+ return false;
currentMap = backing.get(key);
@@ -124,11 +125,11 @@ public class MapSet<KeyType, ValueType> extends AbstractMap<KeyType, ValueType>
}
/**
- * Sets the current map, or creates a new one if there isn't one
- * attached to that key.
- *
+ * Sets the current map, or creates a new one if there isn't one attached to
+ * that key.
+ *
* @param key
- * The key to use as the current map.
+ * The key to use as the current map.
*/
public void setCreateMap(String key) {
if (!backing.containsKey(key)) {
@@ -144,11 +145,11 @@ public class MapSet<KeyType, ValueType> extends AbstractMap<KeyType, ValueType>
/**
* Set the current map, or bind a map to it.
- *
+ *
* @param key
- * The key to set or bind.
+ * The key to set or bind.
* @param map
- * The map to bind to the key if it isn't present.
+ * The map to bind to the key if it isn't present.
*/
public void setPutMap(String key, Map<KeyType, ValueType> map) {
if (!backing.containsKey(key)) {
@@ -164,14 +165,16 @@ public class MapSet<KeyType, ValueType> extends AbstractMap<KeyType, ValueType>
@Override
public Set<Map.Entry<KeyType, ValueType>> entrySet() {
- if (currentMap == null) throw new NullPointerException("Current map is not set");
+ if (currentMap == null)
+ throw new NullPointerException("Current map is not set");
return currentMap.entrySet();
}
@Override
public ValueType put(KeyType key, ValueType value) {
- if (currentMap == null) throw new NullPointerException("Current map is not set");
+ if (currentMap == null)
+ throw new NullPointerException("Current map is not set");
return currentMap.put(key, value);
}