summaryrefslogtreecommitdiff
path: root/base/src/main/java/bjc/utils/esodata
diff options
context:
space:
mode:
Diffstat (limited to 'base/src/main/java/bjc/utils/esodata')
-rw-r--r--base/src/main/java/bjc/utils/esodata/AbbrevMap.java4
-rw-r--r--base/src/main/java/bjc/utils/esodata/Directory.java221
-rw-r--r--base/src/main/java/bjc/utils/esodata/DoubleTape.java30
-rw-r--r--base/src/main/java/bjc/utils/esodata/PushdownMap.java27
-rw-r--r--base/src/main/java/bjc/utils/esodata/QueueStack.java18
-rw-r--r--base/src/main/java/bjc/utils/esodata/SimpleDirectory.java24
-rw-r--r--base/src/main/java/bjc/utils/esodata/SimpleStack.java18
-rw-r--r--base/src/main/java/bjc/utils/esodata/SingleTape.java43
-rw-r--r--base/src/main/java/bjc/utils/esodata/SpaghettiStack.java26
-rw-r--r--base/src/main/java/bjc/utils/esodata/Stack.java118
-rw-r--r--base/src/main/java/bjc/utils/esodata/Tape.java39
-rw-r--r--base/src/main/java/bjc/utils/esodata/TapeChanger.java79
-rw-r--r--base/src/main/java/bjc/utils/esodata/TapeLibrary.java77
-rw-r--r--base/src/main/java/bjc/utils/esodata/UnifiedDirectory.java26
14 files changed, 359 insertions, 391 deletions
diff --git a/base/src/main/java/bjc/utils/esodata/AbbrevMap.java b/base/src/main/java/bjc/utils/esodata/AbbrevMap.java
index 64f542a..59888c0 100644
--- a/base/src/main/java/bjc/utils/esodata/AbbrevMap.java
+++ b/base/src/main/java/bjc/utils/esodata/AbbrevMap.java
@@ -168,7 +168,9 @@ public class AbbrevMap {
*/
public String[] deabbrev(final String abbrev) {
if(abbrevMap.containsKey(abbrev)) {
- return new String[] { abbrevMap.get(abbrev) };
+ return new String[] {
+ abbrevMap.get(abbrev)
+ };
}
return ambMap.get(abbrev).toArray(new String[0]);
diff --git a/base/src/main/java/bjc/utils/esodata/Directory.java b/base/src/main/java/bjc/utils/esodata/Directory.java
index 4b25cda..b0abd7c 100644
--- a/base/src/main/java/bjc/utils/esodata/Directory.java
+++ b/base/src/main/java/bjc/utils/esodata/Directory.java
@@ -1,114 +1,107 @@
-package bjc.utils.esodata;
-
-/**
- * Represents a hierarchical map.
- *
- * What's useful about this is that you can hand sub-directories to people and
- * be able to ensure that they can't write outside of it.
- *
- * @param <K>
- * The key type of the map.
- * @param <V>
- * The value type of the map.
- */
-public interface Directory<K, V> {
- /**
- * Retrieves a given sub-directory.
- *
- * @param key
- * The key to retrieve the sub-directory for.
- *
- * @return
- * The sub-directory under that name.
- *
- * @throws IllegalArgumentException
- * If the given sub-directory doesn't exist.
- */
- Directory<K, V> getSubdirectory(K key);
-
- /**
- * Check if a given sub-directory exists.
- *
- * @param key
- * The key to look for the sub-directory under.
- *
- * @return
- * Whether or not a sub-directory of that name exists.
- */
- boolean hasSubdirectory(K key);
-
- /**
- * Insert a sub-directory into the dictionary.
- *
- * @param key
- * The name of the new sub-directory
- * @param value
- * The sub-directory to insert
- *
- * @return
- * The old sub-directory attached to this key, or null if such a
- * sub-directory didn't exist
- */
- Directory<K, V> putSubdirectory(K key, Directory<K, V> value);
-
- /**
- * Create a new sub-directory.
- *
- * Will fail if a sub-directory of that name already exists.
- *
- * @param key
- * The name of the new sub-directory.
- *
- * @return
- * The new sub-directory, or null if one by that name already
- * exists.
- */
- default Directory<K, V> newSubdirectory(final K key) {
- if (hasSubdirectory(key)) return null;
-
- final Directory<K, V> dir = new SimpleDirectory<>();
-
- putSubdirectory(key, dir);
-
- return dir;
- }
-
- /**
- * Check if the directory contains a data-item under the given key.
- *
- * @param key
- * The key to check for.
- *
- * @return
- * Whether or not there is a data item for the given key.
- */
- boolean containsKey(K key);
-
- /**
- * Retrieve a given data-item from the directory.
- *
- * @param key
- * The key to retrieve data for.
- *
- * @return
- * The value for the given key.
- *
- * @throws IllegalArgumentException
- * If no value exists for the given key.
- */
- V getKey(K key);
-
- /**
- * Insert a data-item into the directory.
- *
- * @param key
- * The key to insert into.
- *
- * @param val
- * The value to insert.
- *
- * @return
- * The old value of key, or null if such a value didn't exist.
- */
- V putKey(K key, V val);
-}
+package bjc.utils.esodata;
+
+/**
+ * Represents a hierarchical map.
+ *
+ * What's useful about this is that you can hand sub-directories to people and
+ * be able to ensure that they can't write outside of it.
+ *
+ * @param <K>
+ * The key type of the map.
+ * @param <V>
+ * The value type of the map.
+ */
+public interface Directory<K, V> {
+ /**
+ * Retrieves a given sub-directory.
+ *
+ * @param key
+ * The key to retrieve the sub-directory for.
+ *
+ * @return The sub-directory under that name.
+ *
+ * @throws IllegalArgumentException
+ * If the given sub-directory doesn't exist.
+ */
+ Directory<K, V> getSubdirectory(K key);
+
+ /**
+ * Check if a given sub-directory exists.
+ *
+ * @param key
+ * The key to look for the sub-directory under.
+ *
+ * @return Whether or not a sub-directory of that name exists.
+ */
+ boolean hasSubdirectory(K key);
+
+ /**
+ * Insert a sub-directory into the dictionary.
+ *
+ * @param key
+ * The name of the new sub-directory
+ * @param value
+ * The sub-directory to insert
+ *
+ * @return The old sub-directory attached to this key, or null if such a
+ * sub-directory didn't exist
+ */
+ Directory<K, V> putSubdirectory(K key, Directory<K, V> value);
+
+ /**
+ * Create a new sub-directory.
+ *
+ * Will fail if a sub-directory of that name already exists.
+ *
+ * @param key
+ * The name of the new sub-directory.
+ *
+ * @return The new sub-directory, or null if one by that name already
+ * exists.
+ */
+ default Directory<K, V> newSubdirectory(final K key) {
+ if(hasSubdirectory(key)) return null;
+
+ final Directory<K, V> dir = new SimpleDirectory<>();
+
+ putSubdirectory(key, dir);
+
+ return dir;
+ }
+
+ /**
+ * Check if the directory contains a data-item under the given key.
+ *
+ * @param key
+ * The key to check for.
+ *
+ * @return Whether or not there is a data item for the given key.
+ */
+ boolean containsKey(K key);
+
+ /**
+ * Retrieve a given data-item from the directory.
+ *
+ * @param key
+ * The key to retrieve data for.
+ *
+ * @return The value for the given key.
+ *
+ * @throws IllegalArgumentException
+ * If no value exists for the given key.
+ */
+ V getKey(K key);
+
+ /**
+ * Insert a data-item into the directory.
+ *
+ * @param key
+ * The key to insert into.
+ *
+ * @param val
+ * The value to insert.
+ *
+ * @return The old value of key, or null if such a value didn't exist.
+ */
+ V putKey(K key, V val);
+}
diff --git a/base/src/main/java/bjc/utils/esodata/DoubleTape.java b/base/src/main/java/bjc/utils/esodata/DoubleTape.java
index a0031ec..bfc58a4 100644
--- a/base/src/main/java/bjc/utils/esodata/DoubleTape.java
+++ b/base/src/main/java/bjc/utils/esodata/DoubleTape.java
@@ -20,15 +20,15 @@ package bjc.utils.esodata;
* Flip refers to the entire tape for 'obvious' reasons.
*
* @param <T>
- * The element type of the tape.
+ * The element type of the tape.
*
* @author bjculkin
*/
public class DoubleTape<T> implements Tape<T> {
/* The front-side of the tape. */
- private Tape<T> front;
+ private Tape<T> front;
/* The back-side of the tape. */
- private Tape<T> back;
+ private Tape<T> back;
/** Create a new empty double-sided tape that doesn't autoextend. */
public DoubleTape() {
@@ -40,7 +40,7 @@ public class DoubleTape<T> implements Tape<T> {
* auto-extension policy.
*
* @param autoExtnd
- * Whether or not to auto-extend the tape to the right w/ nulls.
+ * Whether or not to auto-extend the tape to the right w/ nulls.
*/
public DoubleTape(final boolean autoExtnd) {
front = new SingleTape<>(autoExtnd);
@@ -107,7 +107,7 @@ public class DoubleTape<T> implements Tape<T> {
public boolean left(final int amt) {
final boolean succ = front.left(amt);
- if (succ) {
+ if(succ) {
back.right(amt);
}
@@ -123,7 +123,7 @@ public class DoubleTape<T> implements Tape<T> {
public boolean right(final int amt) {
final boolean succ = front.right(amt);
- if (succ) {
+ if(succ) {
back.left(amt);
}
@@ -160,19 +160,19 @@ public class DoubleTape<T> implements Tape<T> {
@Override
public boolean equals(final Object obj) {
- if (this == obj) return true;
- if (obj == null) return false;
- if (!(obj instanceof DoubleTape<?>)) return false;
+ if(this == obj) return true;
+ if(obj == null) return false;
+ if(!(obj instanceof DoubleTape<?>)) return false;
final DoubleTape<?> other = (DoubleTape<?>) obj;
- if (back == null) {
- if (other.back != null) return false;
- } else if (!back.equals(other.back)) return false;
+ if(back == null) {
+ if(other.back != null) return false;
+ } else if(!back.equals(other.back)) return false;
- if (front == null) {
- if (other.front != null) return false;
- } else if (!front.equals(other.front)) return false;
+ if(front == null) {
+ if(other.front != null) return false;
+ } else if(!front.equals(other.front)) return false;
return true;
}
diff --git a/base/src/main/java/bjc/utils/esodata/PushdownMap.java b/base/src/main/java/bjc/utils/esodata/PushdownMap.java
index 18a9b46..e010fee 100644
--- a/base/src/main/java/bjc/utils/esodata/PushdownMap.java
+++ b/base/src/main/java/bjc/utils/esodata/PushdownMap.java
@@ -17,10 +17,10 @@ import bjc.utils.funcdata.IMap;
* @author EVE
*
* @param <KeyType>
- * The key of the map.
+ * The key of the map.
*
* @param <ValueType>
- * The values in the map.
+ * The values in the map.
*/
public class PushdownMap<KeyType, ValueType> implements IMap<KeyType, ValueType> {
/* Our backing storage. */
@@ -84,17 +84,16 @@ public class PushdownMap<KeyType, ValueType> implements IMap<KeyType, ValueType>
@Override
public <V2> IMap<KeyType, V2> transform(final Function<ValueType, V2> transformer) {
/*
- * @NOTE
- * Can and should we support this?
- * More to the point, maybe this should be a map sub-type
- * that does what it needs to?
+ * @NOTE Can and should we support this? More to the point,
+ * maybe this should be a map sub-type that does what it needs
+ * to?
*/
throw new UnsupportedOperationException("Cannot transform pushdown maps.");
}
@Override
public ValueType put(final KeyType key, final ValueType val) {
- if (backing.containsKey(key)) {
+ if(backing.containsKey(key)) {
final Stack<ValueType> stk = backing.get(key);
final ValueType vl = stk.top();
@@ -115,7 +114,7 @@ public class PushdownMap<KeyType, ValueType> implements IMap<KeyType, ValueType>
public ValueType remove(final KeyType key) {
final Stack<ValueType> stk = backing.get(key);
- if (stk.size() > 1) {
+ if(stk.size() > 1) {
return stk.pop();
} else {
return backing.remove(key).top();
@@ -139,15 +138,15 @@ public class PushdownMap<KeyType, ValueType> implements IMap<KeyType, ValueType>
@Override
public boolean equals(final Object obj) {
- if (this == obj) return true;
- if (obj == null) return false;
- if (!(obj instanceof PushdownMap<?, ?>)) return false;
+ if(this == obj) return true;
+ if(obj == null) return false;
+ if(!(obj instanceof PushdownMap<?, ?>)) return false;
final PushdownMap<?, ?> other = (PushdownMap<?, ?>) obj;
- if (backing == null) {
- if (other.backing != null) return false;
- } else if (!backing.equals(other.backing)) return false;
+ if(backing == null) {
+ if(other.backing != null) return false;
+ } else if(!backing.equals(other.backing)) return false;
return true;
}
diff --git a/base/src/main/java/bjc/utils/esodata/QueueStack.java b/base/src/main/java/bjc/utils/esodata/QueueStack.java
index be393a3..c0cbc7d 100644
--- a/base/src/main/java/bjc/utils/esodata/QueueStack.java
+++ b/base/src/main/java/bjc/utils/esodata/QueueStack.java
@@ -9,7 +9,7 @@ import java.util.LinkedList;
* Basically, a stack that actually acts like a queue.
*
* @param <T>
- * The datatype stored in the stack.
+ * The datatype stored in the stack.
*
* @author Ben Culkin
*/
@@ -29,14 +29,14 @@ public class QueueStack<T> extends Stack<T> {
@Override
public T pop() {
- if (backing.isEmpty()) throw new StackUnderflowException();
+ if(backing.isEmpty()) throw new StackUnderflowException();
return backing.remove();
}
@Override
public T top() {
- if (backing.isEmpty()) throw new StackUnderflowException();
+ if(backing.isEmpty()) throw new StackUnderflowException();
return backing.peek();
}
@@ -74,15 +74,15 @@ public class QueueStack<T> extends Stack<T> {
@Override
public boolean equals(final Object obj) {
- if (this == obj) return true;
- if (obj == null) return false;
- if (!(obj instanceof QueueStack<?>)) return false;
+ if(this == obj) return true;
+ if(obj == null) return false;
+ if(!(obj instanceof QueueStack<?>)) return false;
final QueueStack<?> other = (QueueStack<?>) obj;
- if (backing == null) {
- if (other.backing != null) return false;
- } else if (!backing.equals(other.backing)) return false;
+ if(backing == null) {
+ if(other.backing != null) return false;
+ } else if(!backing.equals(other.backing)) return false;
return true;
}
diff --git a/base/src/main/java/bjc/utils/esodata/SimpleDirectory.java b/base/src/main/java/bjc/utils/esodata/SimpleDirectory.java
index 5e7f480..a3e0a96 100644
--- a/base/src/main/java/bjc/utils/esodata/SimpleDirectory.java
+++ b/base/src/main/java/bjc/utils/esodata/SimpleDirectory.java
@@ -11,10 +11,10 @@ import bjc.utils.funcdata.IMap;
* @author EVE
*
* @param <K>
- * The key type of the directory.
+ * The key type of the directory.
*
* @param <V>
- * The value type of the directory.
+ * The value type of the directory.
*/
public class SimpleDirectory<K, V> implements Directory<K, V> {
/* Our sub-directories. */
@@ -25,7 +25,7 @@ public class SimpleDirectory<K, V> implements Directory<K, V> {
/** Create a new directory. */
public SimpleDirectory() {
children = new FunctionalMap<>();
- data = new FunctionalMap<>();
+ data = new FunctionalMap<>();
}
@Override
@@ -71,19 +71,19 @@ public class SimpleDirectory<K, V> implements Directory<K, V> {
@Override
public boolean equals(final Object obj) {
- if (this == obj) return true;
- if (obj == null) return false;
- if (!(obj instanceof SimpleDirectory<?, ?>)) return false;
+ if(this == obj) return true;
+ if(obj == null) return false;
+ if(!(obj instanceof SimpleDirectory<?, ?>)) return false;
final SimpleDirectory<?, ?> other = (SimpleDirectory<?, ?>) obj;
- if (children == null) {
- if (other.children != null) return false;
- } else if (!children.equals(other.children)) return false;
+ if(children == null) {
+ if(other.children != null) return false;
+ } else if(!children.equals(other.children)) return false;
- if (data == null) {
- if (other.data != null) return false;
- } else if (!data.equals(other.data)) return false;
+ if(data == null) {
+ if(other.data != null) return false;
+ } else if(!data.equals(other.data)) return false;
return true;
}
diff --git a/base/src/main/java/bjc/utils/esodata/SimpleStack.java b/base/src/main/java/bjc/utils/esodata/SimpleStack.java
index 72fb343..8bc7e1e 100644
--- a/base/src/main/java/bjc/utils/esodata/SimpleStack.java
+++ b/base/src/main/java/bjc/utils/esodata/SimpleStack.java
@@ -7,7 +7,7 @@ import java.util.LinkedList;
* Simple implementation of a stack.
*
* @param <T>
- * The datatype stored in the stack.
+ * The datatype stored in the stack.
*
* @author Ben Culkin
*/
@@ -27,14 +27,14 @@ public class SimpleStack<T> extends Stack<T> {
@Override
public T pop() {
- if (backing.isEmpty()) throw new StackUnderflowException();
+ if(backing.isEmpty()) throw new StackUnderflowException();
return backing.pop();
}
@Override
public T top() {
- if (backing.isEmpty()) throw new StackUnderflowException();
+ if(backing.isEmpty()) throw new StackUnderflowException();
return backing.peek();
}
@@ -67,15 +67,15 @@ public class SimpleStack<T> extends Stack<T> {
@Override
public boolean equals(final Object obj) {
- if (this == obj) return true;
- if (obj == null) return false;
- if (!(obj instanceof SimpleStack<?>)) return false;
+ if(this == obj) return true;
+ if(obj == null) return false;
+ if(!(obj instanceof SimpleStack<?>)) return false;
final SimpleStack<?> other = (SimpleStack<?>) obj;
- if (backing == null) {
- if (other.backing != null) return false;
- } else if (!backing.equals(other.backing)) return false;
+ if(backing == null) {
+ if(other.backing != null) return false;
+ } else if(!backing.equals(other.backing)) return false;
return true;
}
diff --git a/base/src/main/java/bjc/utils/esodata/SingleTape.java b/base/src/main/java/bjc/utils/esodata/SingleTape.java
index ae9b746..57ee99a 100644
--- a/base/src/main/java/bjc/utils/esodata/SingleTape.java
+++ b/base/src/main/java/bjc/utils/esodata/SingleTape.java
@@ -15,20 +15,20 @@ import java.util.ArrayList;
* policy.
*
* @param <T>
- * The element type of the tape.
+ * The element type of the tape.
*
* @author bjculkin
*/
public class SingleTape<T> implements Tape<T> {
- /* @NOTE
- * Does this stuff still need to be protected? We're not trying to
- * use inheritance to implement tape types any more, so I don't see
- * any reason to not have it be private.
+ /*
+ * @NOTE Does this stuff still need to be protected? We're not trying to
+ * use inheritance to implement tape types any more, so I don't see any
+ * reason to not have it be private.
*/
/* Our backing store. */
- protected ArrayList<T> backing;
+ protected ArrayList<T> backing;
/* Our position in the list. */
- protected int pos;
+ protected int pos;
/* Whether to auto-extend the list on the left with nulls. */
protected boolean autoExtend;
@@ -57,7 +57,7 @@ public class SingleTape<T> implements Tape<T> {
* policy.
*
* @param autoExtnd
- * Whether or not to auto-extend the tape to the right w/ nulls.
+ * Whether or not to auto-extend the tape to the right w/ nulls.
*/
public SingleTape(final boolean autoExtnd) {
autoExtend = autoExtnd;
@@ -92,7 +92,7 @@ public class SingleTape<T> implements Tape<T> {
@Override
public void insertAfter(final T itm) {
- if (pos == backing.size() - 1) {
+ if(pos == backing.size() - 1) {
backing.add(itm);
} else {
backing.add(pos + 1, itm);
@@ -102,7 +102,7 @@ public class SingleTape<T> implements Tape<T> {
@Override
public T remove() {
final T res = backing.remove(pos);
- if (pos != 0) {
+ if(pos != 0) {
pos -= 1;
}
return res;
@@ -125,7 +125,7 @@ public class SingleTape<T> implements Tape<T> {
@Override
public boolean left(final int amt) {
- if (pos - amt < 0) return false;
+ if(pos - amt < 0) return false;
pos -= amt;
return true;
@@ -138,12 +138,13 @@ public class SingleTape<T> implements Tape<T> {
@Override
public boolean right(final int amt) {
- if (pos + amt >= backing.size() - 1) {
- if (autoExtend) {
- while (pos + amt >= backing.size() - 1) {
+ if(pos + amt >= backing.size() - 1) {
+ if(autoExtend) {
+ while(pos + amt >= backing.size() - 1) {
backing.add(null);
}
- } else return false;
+ } else
+ return false;
}
pos += amt;
@@ -167,15 +168,15 @@ public class SingleTape<T> implements Tape<T> {
@Override
public boolean equals(final Object obj) {
- if (this == obj) return true;
- if (obj == null) return false;
- if (!(obj instanceof SingleTape<?>)) return false;
+ if(this == obj) return true;
+ if(obj == null) return false;
+ if(!(obj instanceof SingleTape<?>)) return false;
final SingleTape<?> other = (SingleTape<?>) obj;
- if (backing == null) {
- if (other.backing != null) return false;
- } else if (!backing.equals(other.backing)) return false;
+ if(backing == null) {
+ if(other.backing != null) return false;
+ } else if(!backing.equals(other.backing)) return false;
return true;
}
diff --git a/base/src/main/java/bjc/utils/esodata/SpaghettiStack.java b/base/src/main/java/bjc/utils/esodata/SpaghettiStack.java
index f445f75..8f2924b 100644
--- a/base/src/main/java/bjc/utils/esodata/SpaghettiStack.java
+++ b/base/src/main/java/bjc/utils/esodata/SpaghettiStack.java
@@ -8,7 +8,7 @@ import java.util.stream.Stream;
* parent stack.
*
* @param <T>
- * The datatype stored in the stack.
+ * The datatype stored in the stack.
*
* @author Ben Culkin
*/
@@ -22,7 +22,7 @@ class SpaghettiStack<T> extends Stack<T> {
* Create a new empty spaghetti stack, off of the specified parent.
*
* @param par
- * The parent stack
+ * The parent stack
*/
public SpaghettiStack(final Stack<T> par) {
backing = new SimpleStack<>();
@@ -37,14 +37,14 @@ class SpaghettiStack<T> extends Stack<T> {
@Override
public T pop() {
- if (backing.empty()) return parent.pop();
+ if(backing.empty()) return parent.pop();
return backing.pop();
}
@Override
public T top() {
- if (backing.empty()) return parent.top();
+ if(backing.empty()) return parent.top();
return backing.top();
}
@@ -78,19 +78,19 @@ class SpaghettiStack<T> extends Stack<T> {
@Override
public boolean equals(final Object obj) {
- if (this == obj) return true;
- if (obj == null) return false;
- if (!(obj instanceof SpaghettiStack<?>)) return false;
+ if(this == obj) return true;
+ if(obj == null) return false;
+ if(!(obj instanceof SpaghettiStack<?>)) return false;
final SpaghettiStack<?> other = (SpaghettiStack<?>) obj;
- if (backing == null) {
- if (other.backing != null) return false;
- } else if (!backing.equals(other.backing)) return false;
+ if(backing == null) {
+ if(other.backing != null) return false;
+ } else if(!backing.equals(other.backing)) return false;
- if (parent == null) {
- if (other.parent != null) return false;
- } else if (!parent.equals(other.parent)) return false;
+ if(parent == null) {
+ if(other.parent != null) return false;
+ } else if(!parent.equals(other.parent)) return false;
return true;
}
diff --git a/base/src/main/java/bjc/utils/esodata/Stack.java b/base/src/main/java/bjc/utils/esodata/Stack.java
index 9bb61dc..5c923c3 100644
--- a/base/src/main/java/bjc/utils/esodata/Stack.java
+++ b/base/src/main/java/bjc/utils/esodata/Stack.java
@@ -21,7 +21,7 @@ import java.util.function.Consumer;
* </p>
*
* @param <T>
- * The datatype stored in the stack.
+ * The datatype stored in the stack.
*
* @author Ben Culkin
*/
@@ -41,15 +41,14 @@ public abstract class Stack<T> {
* Push an element onto the stack.
*
* @param elm
- * The element to insert.
+ * The element to insert.
*/
public abstract void push(T elm);
/**
* Pop an element off of the stack.
*
- * @return
- * The element on top of the stack.
+ * @return The element on top of the stack.
*/
public abstract T pop();
@@ -57,32 +56,28 @@ public abstract class Stack<T> {
* Retrieve the top element of this stack without removing it from the
* stack.
*
- * @return
- * The top element of this stack.
+ * @return The top element of this stack.
*/
public abstract T top();
/**
* Get the number of elements in the stack.
*
- * @return
- * the number of elements in the stack.
+ * @return the number of elements in the stack.
*/
public abstract int size();
/**
* Check if the stack is empty.
*
- * @return
- * Whether or not the stack is empty.
+ * @return Whether or not the stack is empty.
*/
public abstract boolean empty();
/**
* Create a spaghetti stack branching off of this one.
*
- * @return
- * A spaghetti stack with this stack as a parent.
+ * @return A spaghetti stack with this stack as a parent.
*/
public Stack<T> spaghettify() {
return new SpaghettiStack<>(this);
@@ -96,10 +91,10 @@ public abstract class Stack<T> {
* Drop n items from the stack.
*
* @param n
- * The number of items to drop.
+ * The number of items to drop.
*/
public void drop(final int n) {
- for (int i = 0; i < n; i++) {
+ for(int i = 0; i < n; i++) {
pop();
}
}
@@ -113,7 +108,7 @@ public abstract class Stack<T> {
* Delete n items below the current one.
*
* @param n
- * The number of items below the top to delete.
+ * The number of items below the top to delete.
*/
public void nip(final int n) {
final T elm = pop();
@@ -132,20 +127,20 @@ public abstract class Stack<T> {
* Replicate the top n items of the stack m times.
*
* @param n
- * The number of items to duplicate.
+ * The number of items to duplicate.
*
* @param m
- * The number of times to duplicate items.
+ * The number of times to duplicate items.
*/
public void multidup(final int n, final int m) {
final List<T> lst = new ArrayList<>(n);
- for (int i = n; i > 0; i--) {
+ for(int i = n; i > 0; i--) {
lst.set(i - 1, pop());
}
- for (int i = 0; i < m; i++) {
- for (final T elm : lst) {
+ for(int i = 0; i < m; i++) {
+ for(final T elm : lst) {
push(elm);
}
}
@@ -155,7 +150,7 @@ public abstract class Stack<T> {
* Duplicate the top n items of the stack.
*
* @param n
- * The number of items to duplicate.
+ * The number of items to duplicate.
*/
public void dup(final int n) {
multidup(n, 2);
@@ -170,27 +165,27 @@ public abstract class Stack<T> {
* Replicate the n elements below the top one m times.
*
* @param n
- * The number of items to duplicate.
+ * The number of items to duplicate.
*
* @param m
- * The number of times to duplicate items.
+ * The number of times to duplicate items.
*/
public void multiover(final int n, final int m) {
final List<T> lst = new ArrayList<>(n);
final T elm = pop();
- for (int i = n; i > 0; i--) {
+ for(int i = n; i > 0; i--) {
lst.set(i - 1, pop());
}
- for (final T nelm : lst) {
+ for(final T nelm : lst) {
push(nelm);
}
push(elm);
- for (int i = 1; i < m; i++) {
- for (final T nelm : lst) {
+ for(int i = 1; i < m; i++) {
+ for(final T nelm : lst) {
push(nelm);
}
}
@@ -200,7 +195,7 @@ public abstract class Stack<T> {
* Duplicate the n elements below the top one.
*
* @param n
- * The number of items to duplicate.
+ * The number of items to duplicate.
*/
public void over(final int n) {
multiover(n, 2);
@@ -275,9 +270,8 @@ public abstract class Stack<T> {
push(y);
}
- /*
- * :StackCombinators
- * Add a general rotate/roll operator.
+ /*
+ * :StackCombinators Add a general rotate/roll operator.
*/
/*
@@ -288,21 +282,21 @@ public abstract class Stack<T> {
* Hides the top n elements on the stack from an action.
*
* @param n
- * The number of elements to hide.
+ * The number of elements to hide.
*
* @param action
- * The action to hide the elements from
+ * The action to hide the elements from
*/
public void dip(final int n, final Consumer<Stack<T>> action) {
final List<T> elms = new ArrayList<>(n);
- for (int i = n; i > 0; i--) {
+ for(int i = n; i > 0; i--) {
elms.set(i - 1, pop());
}
action.accept(this);
- for (final T elm : elms) {
+ for(final T elm : elms) {
push(elm);
}
}
@@ -311,26 +305,25 @@ public abstract class Stack<T> {
* Hide the top element of the stack from an action.
*
* @param action
- * The action to hide the top from
+ * The action to hide the top from
*/
public void dip(final Consumer<Stack<T>> action) {
dip(1, action);
}
/**
- * Copy the top n elements on the stack, replacing them once an action is
- * done.
+ * Copy the top n elements on the stack, replacing them once an action
+ * is done.
*
* @param n
- * The number of elements to copy.
+ * The number of elements to copy.
*
* @param action
- * The action to execute.
+ * The action to execute.
*/
public void keep(final int n, final Consumer<Stack<T>> action) {
/*
- * @NOTE
- * Is this correct?
+ * @NOTE Is this correct?
*/
dup(n);
dip(n, action);
@@ -340,20 +333,20 @@ public abstract class Stack<T> {
* Apply all the actions in a list to the top n elements of the stack.
*
* @param n
- * The number of elements to give to cons.
+ * The number of elements to give to cons.
*
* @param actions
- * The actions to execute.
+ * The actions to execute.
*/
public void multicleave(final int n, final List<Consumer<Stack<T>>> actions) {
final List<T> elms = new ArrayList<>(n);
- for (int i = n; i > 0; i--) {
+ for(int i = n; i > 0; i--) {
elms.set(i - 1, pop());
}
- for (final Consumer<Stack<T>> action : actions) {
- for (final T elm : elms) {
+ for(final Consumer<Stack<T>> action : actions) {
+ for(final T elm : elms) {
push(elm);
}
@@ -365,7 +358,7 @@ public abstract class Stack<T> {
* Apply all the actions in a list to the top element of the stack.
*
* @param actions
- * The actions to execute.
+ * The actions to execute.
*/
public void cleave(final List<Consumer<Stack<T>>> actions) {
multicleave(1, actions);
@@ -375,18 +368,18 @@ public abstract class Stack<T> {
* Apply every action in a list of actions to n arguments.
*
* @param n
- * The number of parameters each action takes.
+ * The number of parameters each action takes.
*
* @param actions
- * The actions to execute.
+ * The actions to execute.
*/
public void multispread(final int n, final List<Consumer<Stack<T>>> actions) {
final List<List<T>> nelms = new ArrayList<>(actions.size());
- for (int i = actions.size(); i > 0; i--) {
+ for(int i = actions.size(); i > 0; i--) {
final List<T> elms = new ArrayList<>(n);
- for (int j = n; j > 0; j--) {
+ for(int j = n; j > 0; j--) {
elms.set(j, pop());
}
@@ -394,8 +387,8 @@ public abstract class Stack<T> {
}
int i = 0;
- for (final List<T> elms : nelms) {
- for (final T elm : elms) {
+ for(final List<T> elms : nelms) {
+ for(final T elm : elms) {
push(elm);
}
@@ -409,7 +402,7 @@ public abstract class Stack<T> {
* the stack.
*
* @param conses
- * The actions to execute.
+ * The actions to execute.
*/
public void spread(final List<Consumer<Stack<T>>> conses) {
multispread(1, conses);
@@ -419,18 +412,18 @@ public abstract class Stack<T> {
* Apply an action to the first m groups of n arguments.
*
* @param n
- * The number of arguments cons takes.
+ * The number of arguments cons takes.
*
* @param m
- * The number of time to call cons.
+ * The number of time to call cons.
*
* @param action
- * The action to execute.
+ * The action to execute.
*/
public void multiapply(final int n, final int m, final Consumer<Stack<T>> action) {
final List<Consumer<Stack<T>>> actions = new ArrayList<>(m);
- for (int i = 0; i < m; i++) {
+ for(int i = 0; i < m; i++) {
actions.add(action);
}
@@ -441,10 +434,10 @@ public abstract class Stack<T> {
* Apply an action n times to the corresponding elements in the stack.
*
* @param n
- * The number of times to execute cons.
+ * The number of times to execute cons.
*
* @param action
- * The action to execute.
+ * The action to execute.
*/
public void apply(final int n, final Consumer<Stack<T>> action) {
multiapply(1, n, action);
@@ -457,8 +450,7 @@ public abstract class Stack<T> {
/**
* Get an array representing this stack.
*
- * @return
- * The stack as an array.
+ * @return The stack as an array.
*/
public abstract T[] toArray();
}
diff --git a/base/src/main/java/bjc/utils/esodata/Tape.java b/base/src/main/java/bjc/utils/esodata/Tape.java
index dab027f..91a404a 100644
--- a/base/src/main/java/bjc/utils/esodata/Tape.java
+++ b/base/src/main/java/bjc/utils/esodata/Tape.java
@@ -8,7 +8,7 @@ package bjc.utils.esodata;
* unbounded to the right, but in practice bounded by available memory.
*
* @param <T>
- * The element type of the tape.
+ * The element type of the tape.
*
* @author bjculkin
*/
@@ -16,8 +16,7 @@ public interface Tape<T> {
/**
* Get the item the tape is currently on.
*
- * @return
- * The item the tape is on.
+ * @return The item the tape is on.
*/
T item();
@@ -25,23 +24,21 @@ public interface Tape<T> {
* Set the item the tape is currently on.
*
* @param itm
- * The new value for the tape item.
+ * The new value for the tape item.
*/
void item(T itm);
/**
* Get the current number of elements in the tape.
*
- * @return
- * The current number of elements in the tape.
+ * @return The current number of elements in the tape.
*/
int size();
/**
* Get the position of the current item.
*
- * @return
- * The position of the current item.
+ * @return The position of the current item.
*/
int position();
@@ -49,7 +46,7 @@ public interface Tape<T> {
* Insert an element before the current item.
*
* @param itm
- * The item to add.
+ * The item to add.
*/
void insertBefore(T itm);
@@ -57,7 +54,7 @@ public interface Tape<T> {
* Insert an element after the current item.
*
* @param itm
- * The item to insert.
+ * The item to insert.
*/
void insertAfter(T itm);
@@ -67,8 +64,7 @@ public interface Tape<T> {
* Also moves the cursor back one step if possible to maintain relative
* position.
*
- * @return
- * The removed item.
+ * @return The removed item.
*/
T remove();
@@ -83,8 +79,7 @@ public interface Tape<T> {
*
* The cursor can't go past zero.
*
- * @return
- * True if the cursor was moved left.
+ * @return True if the cursor was moved left.
*/
boolean left();
@@ -95,18 +90,16 @@ public interface Tape<T> {
* that would exceed zero don't move the cursor at all.
*
* @param amt
- * The amount to attempt to move the cursor left.
+ * The amount to attempt to move the cursor left.
*
- * @return
- * True if the cursor was moved left.
+ * @return True if the cursor was moved left.
*/
boolean left(int amt);
/**
* Move the cursor one space right.
*
- * @return
- * Whether the cursor was moved right.
+ * @return Whether the cursor was moved right.
*/
boolean right();
@@ -114,18 +107,16 @@ public interface Tape<T> {
* Move the cursor the specified amount right.
*
* @param amt
- * The amount to move the cursor right by.
+ * The amount to move the cursor right by.
*
- * @return
- * Whether the cursor was moved right.
+ * @return Whether the cursor was moved right.
*/
boolean right(int amt);
/**
* Is this tape double sided?
*
- * @return
- * Whether or not this tape is double-sided.
+ * @return Whether or not this tape is double-sided.
*/
boolean isDoubleSided();
}
diff --git a/base/src/main/java/bjc/utils/esodata/TapeChanger.java b/base/src/main/java/bjc/utils/esodata/TapeChanger.java
index 08f56c1..2623ad3 100644
--- a/base/src/main/java/bjc/utils/esodata/TapeChanger.java
+++ b/base/src/main/java/bjc/utils/esodata/TapeChanger.java
@@ -10,13 +10,13 @@ package bjc.utils.esodata;
* either return null/false.
*
* @param <T>
- * The element type of the tapes.
+ * The element type of the tapes.
*/
public class TapeChanger<T> implements Tape<T> {
/* Our list of tapes. */
private Tape<Tape<T>> tapes;
/* The current tape. */
- private Tape<T> currentTape;
+ private Tape<T> currentTape;
/** Create a new empty tape changer. */
public TapeChanger() {
@@ -27,10 +27,10 @@ public class TapeChanger<T> implements Tape<T> {
* Create a new tape changer with the specified tapes.
*
* @param current
- * The tape to mount first.
+ * The tape to mount first.
*
* @param others
- * The tapes to put in this tape changer.
+ * The tapes to put in this tape changer.
*/
@SafeVarargs
public TapeChanger(final Tape<T> current, final Tape<T>... others) {
@@ -38,7 +38,7 @@ public class TapeChanger<T> implements Tape<T> {
tapes.insertBefore(current);
- for (final Tape<T> tp : others) {
+ for(final Tape<T> tp : others) {
tapes.insertAfter(tp);
tapes.right();
}
@@ -49,63 +49,63 @@ public class TapeChanger<T> implements Tape<T> {
@Override
public T item() {
- if (currentTape == null) return null;
+ if(currentTape == null) return null;
return currentTape.item();
}
@Override
public void item(final T itm) {
- if (currentTape == null) return;
+ if(currentTape == null) return;
currentTape.item(itm);
}
@Override
public int size() {
- if (currentTape == null) return 0;
+ if(currentTape == null) return 0;
return currentTape.size();
}
@Override
public int position() {
- if (currentTape == null) return 0;
+ if(currentTape == null) return 0;
return currentTape.position();
}
@Override
public void insertBefore(final T itm) {
- if (currentTape == null) return;
+ if(currentTape == null) return;
currentTape.insertBefore(itm);
}
@Override
public void insertAfter(final T itm) {
- if (currentTape == null) return;
+ if(currentTape == null) return;
currentTape.insertAfter(itm);
}
@Override
public T remove() {
- if (currentTape == null) return null;
+ if(currentTape == null) return null;
return currentTape.remove();
}
@Override
public void first() {
- if (currentTape == null) return;
+ if(currentTape == null) return;
currentTape.first();
}
@Override
public void last() {
- if (currentTape == null) return;
+ if(currentTape == null) return;
currentTape.last();
}
@@ -117,7 +117,7 @@ public class TapeChanger<T> implements Tape<T> {
@Override
public boolean left(final int amt) {
- if (currentTape == null) return false;
+ if(currentTape == null) return false;
return currentTape.left(amt);
}
@@ -129,7 +129,7 @@ public class TapeChanger<T> implements Tape<T> {
@Override
public boolean right(final int amt) {
- if (currentTape == null) return false;
+ if(currentTape == null) return false;
return currentTape.right(amt);
}
@@ -143,16 +143,16 @@ public class TapeChanger<T> implements Tape<T> {
* If the current tape is not double-sided, does nothing.
*/
public void flip() {
- if (currentTape == null) return;
+ if(currentTape == null) return;
- if (currentTape.isDoubleSided()) {
+ if(currentTape.isDoubleSided()) {
((DoubleTape<T>) currentTape).flip();
}
}
@Override
public boolean isDoubleSided() {
- if (currentTape == null) return false;
+ if(currentTape == null) return false;
return currentTape.isDoubleSided();
}
@@ -160,8 +160,7 @@ public class TapeChanger<T> implements Tape<T> {
/**
* Check if a tape is currently loaded.
*
- * @return
- * Whether or not a tape is loaded.
+ * @return Whether or not a tape is loaded.
*/
public boolean isLoaded() {
return currentTape != null;
@@ -173,13 +172,12 @@ public class TapeChanger<T> implements Tape<T> {
* Attempting to load a tape that isn't there won't eject the current
* tape.
*
- * @return
- * Whether or not the next tape was loaded.
+ * @return Whether or not the next tape was loaded.
*/
public boolean nextTape() {
final boolean succ = tapes.right();
- if (succ) {
+ if(succ) {
currentTape = tapes.item();
}
@@ -192,13 +190,12 @@ public class TapeChanger<T> implements Tape<T> {
* Attempting to load a tape that isn't there won't eject the current
* tape.
*
- * @return
- * Whether or not the previous tape was loaded.
+ * @return Whether or not the previous tape was loaded.
*/
public boolean prevTape() {
final boolean succ = tapes.left();
- if (succ) {
+ if(succ) {
currentTape = tapes.item();
}
@@ -213,7 +210,7 @@ public class TapeChanger<T> implements Tape<T> {
* The specified tape is loaded.
*
* @param tp
- * The tape to insert and load.
+ * The tape to insert and load.
*/
public void insertTape(final Tape<T> tp) {
tapes.insertAfter(tp);
@@ -229,11 +226,10 @@ public class TapeChanger<T> implements Tape<T> {
*
* Loads the previous tape, if there is one.
*
- * @return
- * The removed tape.
+ * @return The removed tape.
*/
public Tape<T> removeTape() {
- if (currentTape == null) return null;
+ if(currentTape == null) return null;
final Tape<T> tp = tapes.remove();
currentTape = tapes.item();
@@ -253,8 +249,7 @@ public class TapeChanger<T> implements Tape<T> {
/**
* Get how many tapes are currently in the changer.
*
- * @return
- * How many tapes are currently in the changer.
+ * @return How many tapes are currently in the changer.
*/
public int tapeCount() {
return tapes.size();
@@ -271,19 +266,19 @@ public class TapeChanger<T> implements Tape<T> {
@Override
public boolean equals(final Object obj) {
- if (this == obj) return true;
- if (obj == null) return false;
- if (!(obj instanceof TapeChanger<?>)) return false;
+ if(this == obj) return true;
+ if(obj == null) return false;
+ if(!(obj instanceof TapeChanger<?>)) return false;
final TapeChanger<?> other = (TapeChanger<?>) obj;
- if (currentTape == null) {
- if (other.currentTape != null) return false;
- } else if (!currentTape.equals(other.currentTape)) return false;
+ if(currentTape == null) {
+ if(other.currentTape != null) return false;
+ } else if(!currentTape.equals(other.currentTape)) return false;
- if (tapes == null) {
- if (other.tapes != null) return false;
- } else if (!tapes.equals(other.tapes)) return false;
+ if(tapes == null) {
+ if(other.tapes != null) return false;
+ } else if(!tapes.equals(other.tapes)) return false;
return true;
}
diff --git a/base/src/main/java/bjc/utils/esodata/TapeLibrary.java b/base/src/main/java/bjc/utils/esodata/TapeLibrary.java
index 00e2e99..4ebfd6c 100644
--- a/base/src/main/java/bjc/utils/esodata/TapeLibrary.java
+++ b/base/src/main/java/bjc/utils/esodata/TapeLibrary.java
@@ -13,13 +13,13 @@ import java.util.Map;
* either return null/false.
*
* @param <T>
- * The element type of the tapes.
+ * The element type of the tapes.
*/
public class TapeLibrary<T> implements Tape<T> {
/* Our backing store of tapes. */
private final Map<String, Tape<T>> tapes;
/* The current tape. */
- private Tape<T> currentTape;
+ private Tape<T> currentTape;
/** Create a new empty tape library. */
public TapeLibrary() {
@@ -28,63 +28,63 @@ public class TapeLibrary<T> implements Tape<T> {
@Override
public T item() {
- if (currentTape == null) return null;
+ if(currentTape == null) return null;
return currentTape.item();
}
@Override
public void item(final T itm) {
- if (currentTape == null) return;
+ if(currentTape == null) return;
currentTape.item(itm);
}
@Override
public int size() {
- if (currentTape == null) return 0;
+ if(currentTape == null) return 0;
return currentTape.size();
}
@Override
public int position() {
- if (currentTape == null) return 0;
+ if(currentTape == null) return 0;
return currentTape.position();
}
@Override
public void insertBefore(final T itm) {
- if (currentTape == null) return;
+ if(currentTape == null) return;
currentTape.insertBefore(itm);
}
@Override
public void insertAfter(final T itm) {
- if (currentTape == null) return;
+ if(currentTape == null) return;
currentTape.insertAfter(itm);
}
@Override
public T remove() {
- if (currentTape == null) return null;
+ if(currentTape == null) return null;
return currentTape.remove();
}
@Override
public void first() {
- if (currentTape == null) return;
+ if(currentTape == null) return;
currentTape.first();
}
@Override
public void last() {
- if (currentTape == null) return;
+ if(currentTape == null) return;
currentTape.last();
}
@@ -96,7 +96,7 @@ public class TapeLibrary<T> implements Tape<T> {
@Override
public boolean left(final int amt) {
- if (currentTape == null) return false;
+ if(currentTape == null) return false;
return currentTape.left(amt);
}
@@ -108,7 +108,7 @@ public class TapeLibrary<T> implements Tape<T> {
@Override
public boolean right(final int amt) {
- if (currentTape == null) return false;
+ if(currentTape == null) return false;
return currentTape.right(amt);
}
@@ -122,16 +122,16 @@ public class TapeLibrary<T> implements Tape<T> {
* If the current tape is not double-sided, does nothing.
*/
public void flip() {
- if (currentTape == null) return;
+ if(currentTape == null) return;
- if (currentTape.isDoubleSided()) {
+ if(currentTape.isDoubleSided()) {
((DoubleTape<T>) currentTape).flip();
}
}
@Override
public boolean isDoubleSided() {
- if (currentTape == null) return false;
+ if(currentTape == null) return false;
return currentTape.isDoubleSided();
}
@@ -139,8 +139,7 @@ public class TapeLibrary<T> implements Tape<T> {
/**
* Check if a tape is currently loaded.
*
- * @return
- * Whether or not a tape is loaded.
+ * @return Whether or not a tape is loaded.
*/
public boolean isLoaded() {
return currentTape != null;
@@ -153,13 +152,12 @@ public class TapeLibrary<T> implements Tape<T> {
* tape.
*
* @param label
- * The label of the tape to load.
+ * The label of the tape to load.
*
- * @return
- * Whether or not the next tape was loaded.
+ * @return Whether or not the next tape was loaded.
*/
public boolean switchTape(final String label) {
- if (tapes.containsKey(label)) {
+ if(tapes.containsKey(label)) {
currentTape = tapes.get(label);
return true;
}
@@ -177,10 +175,10 @@ public class TapeLibrary<T> implements Tape<T> {
* Adding a duplicate tape will overwrite any existing types.
*
* @param label
- * The label of the tape to add.
+ * The label of the tape to add.
*
* @param tp
- * The tape to insert and load.
+ * The tape to insert and load.
*/
public void insertTape(final String label, final Tape<T> tp) {
tapes.put(label, tp);
@@ -194,10 +192,9 @@ public class TapeLibrary<T> implements Tape<T> {
* Does nothing if there is not a tape of that name loaded.
*
* @param label
- * The tape to remove.
+ * The tape to remove.
*
- * @return
- * The removed tape.
+ * @return The removed tape.
*/
public Tape<T> removeTape(final String label) {
return tapes.remove(label);
@@ -215,8 +212,7 @@ public class TapeLibrary<T> implements Tape<T> {
/**
* Get how many tapes are currently in the library.
*
- * @return
- * How many tapes are currently in the library.
+ * @return How many tapes are currently in the library.
*/
public int tapeCount() {
return tapes.size();
@@ -226,10 +222,9 @@ public class TapeLibrary<T> implements Tape<T> {
* Check if a specific tape is loaded into the library.
*
* @param label
- * The tape to check for.
+ * The tape to check for.
*
- * @return
- * Whether or not a tape of that name exists
+ * @return Whether or not a tape of that name exists
*/
public boolean hasTape(final String label) {
return tapes.containsKey(label);
@@ -248,19 +243,19 @@ public class TapeLibrary<T> implements Tape<T> {
@Override
public boolean equals(final Object obj) {
- if (this == obj) return true;
- if (obj == null) return false;
- if (!(obj instanceof TapeLibrary<?>)) return false;
+ if(this == obj) return true;
+ if(obj == null) return false;
+ if(!(obj instanceof TapeLibrary<?>)) return false;
final TapeLibrary<?> other = (TapeLibrary<?>) obj;
- if (currentTape == null) {
- if (other.currentTape != null) return false;
- } else if (!currentTape.equals(other.currentTape)) return false;
+ if(currentTape == null) {
+ if(other.currentTape != null) return false;
+ } else if(!currentTape.equals(other.currentTape)) return false;
- if (tapes == null) {
- if (other.tapes != null) return false;
- } else if (!tapes.equals(other.tapes)) return false;
+ if(tapes == null) {
+ if(other.tapes != null) return false;
+ } else if(!tapes.equals(other.tapes)) return false;
return true;
}
diff --git a/base/src/main/java/bjc/utils/esodata/UnifiedDirectory.java b/base/src/main/java/bjc/utils/esodata/UnifiedDirectory.java
index ed71512..75d3440 100644
--- a/base/src/main/java/bjc/utils/esodata/UnifiedDirectory.java
+++ b/base/src/main/java/bjc/utils/esodata/UnifiedDirectory.java
@@ -11,10 +11,10 @@ import bjc.utils.funcdata.IMap;
* @author EVE
*
* @param <K>
- * The key type of the directory.
+ * The key type of the directory.
*
* @param <V>
- * The value type of the directory.
+ * The value type of the directory.
*/
public class UnifiedDirectory<K, V> implements Directory<K, V> {
/* Our directory children. */
@@ -40,7 +40,7 @@ public class UnifiedDirectory<K, V> implements Directory<K, V> {
@Override
public Directory<K, V> putSubdirectory(final K key, final Directory<K, V> val) {
- if (data.containsKey(key)) {
+ if(data.containsKey(key)) {
final String msg = String.format("Key %s is already used for data", key);
throw new IllegalArgumentException(msg);
@@ -61,7 +61,7 @@ public class UnifiedDirectory<K, V> implements Directory<K, V> {
@Override
public V putKey(final K key, final V val) {
- if (children.containsKey(key)) {
+ if(children.containsKey(key)) {
final String msg = String.format("Key %s is already used for sub-directories.", key);
throw new IllegalArgumentException(msg);
@@ -81,19 +81,19 @@ public class UnifiedDirectory<K, V> implements Directory<K, V> {
@Override
public boolean equals(final Object obj) {
- if (this == obj) return true;
- if (obj == null) return false;
- if (!(obj instanceof UnifiedDirectory<?, ?>)) return false;
+ if(this == obj) return true;
+ if(obj == null) return false;
+ if(!(obj instanceof UnifiedDirectory<?, ?>)) return false;
final UnifiedDirectory<?, ?> other = (UnifiedDirectory<?, ?>) obj;
- if (children == null) {
- if (other.children != null) return false;
- } else if (!children.equals(other.children)) return false;
+ if(children == null) {
+ if(other.children != null) return false;
+ } else if(!children.equals(other.children)) return false;
- if (data == null) {
- if (other.data != null) return false;
- } else if (!data.equals(other.data)) return false;
+ if(data == null) {
+ if(other.data != null) return false;
+ } else if(!data.equals(other.data)) return false;
return true;
}