aboutsummaryrefslogtreecommitdiff
path: root/src/Java/gtPlusPlus/api/objects/data/ConcurrentSet.java
diff options
context:
space:
mode:
authorAlkalus <3060479+draknyte1@users.noreply.github.com>2019-11-24 16:14:12 +0000
committerAlkalus <3060479+draknyte1@users.noreply.github.com>2019-11-24 16:14:12 +0000
commitf3a698a3af1826ef6f5ac719d31334b930e0005e (patch)
tree5964a9e90c6c3bd3fd71a3e65a48d3ff3f9277e9 /src/Java/gtPlusPlus/api/objects/data/ConcurrentSet.java
parent9ba6d563d1b69bc8aa88d48754c273dae77aa713 (diff)
downloadGT5-Unofficial-f3a698a3af1826ef6f5ac719d31334b930e0005e.tar.gz
GT5-Unofficial-f3a698a3af1826ef6f5ac719d31334b930e0005e.tar.bz2
GT5-Unofficial-f3a698a3af1826ef6f5ac719d31334b930e0005e.zip
+ Added Concurrent Set objects to the API.
+ Added Flexible Pair objects to the API. + Added logging to ICO formation code. % Adjusted position of GUI elements in NEI for Chemical Plant recipes. % Adjusted the recipe for the Lava Filter. % Adjusted which fluids are returned when requesting tiered fluids from CI. This will inevitably adjust many recipes as a result. % Adjusted handling of the creative energy buffer. % Adjusted Achievement handler for Dev Mode. % Adjusted Tank Capacity on my Chemical Plants. $ Fixed Output buffer checks on multiblocks, Closes #574. $ Fixed LuV Super Bus recipes, Closes #575. (ULV super bus recipe is still broken for the time being) $ Attempted once more to fix Hot Water localization.
Diffstat (limited to 'src/Java/gtPlusPlus/api/objects/data/ConcurrentSet.java')
-rw-r--r--src/Java/gtPlusPlus/api/objects/data/ConcurrentSet.java53
1 files changed, 53 insertions, 0 deletions
diff --git a/src/Java/gtPlusPlus/api/objects/data/ConcurrentSet.java b/src/Java/gtPlusPlus/api/objects/data/ConcurrentSet.java
new file mode 100644
index 0000000000..1d3ffc1c01
--- /dev/null
+++ b/src/Java/gtPlusPlus/api/objects/data/ConcurrentSet.java
@@ -0,0 +1,53 @@
+package gtPlusPlus.api.objects.data;
+
+import java.io.Serializable;
+import java.util.AbstractSet;
+import java.util.Iterator;
+import java.util.concurrent.ConcurrentMap;
+
+public abstract class ConcurrentSet<E> extends AbstractSet<E> implements Serializable {
+
+ private static final long serialVersionUID = -6761513279741915432L;
+
+ private final ConcurrentMap<Integer, E> mInternalMap;
+
+ private int mInternalID = 0;
+
+ /**
+ * Creates a new instance which wraps the specified {@code map}.
+ */
+ public ConcurrentSet(ConcurrentMap<Integer, E> aMap) {
+ mInternalMap = aMap;
+ }
+
+ @Override
+ public int size() {
+ return mInternalMap.size();
+ }
+
+ @Override
+ public boolean contains(Object o) {
+ return mInternalMap.containsKey(o);
+ }
+
+ @Override
+ public boolean add(E o) {
+ return mInternalMap.putIfAbsent(mInternalID++, o) == null;
+ }
+
+ @Override
+ public boolean remove(Object o) {
+ return mInternalMap.remove(o) != null;
+ }
+
+ @Override
+ public void clear() {
+ this.mInternalID = 0;
+ mInternalMap.clear();
+ }
+
+ @Override
+ public Iterator<E> iterator() {
+ return mInternalMap.values().iterator();
+ }
+}