diff options
author | Alkalus <3060479+draknyte1@users.noreply.github.com> | 2019-11-24 16:14:12 +0000 |
---|---|---|
committer | Alkalus <3060479+draknyte1@users.noreply.github.com> | 2019-11-24 16:14:12 +0000 |
commit | f3a698a3af1826ef6f5ac719d31334b930e0005e (patch) | |
tree | 5964a9e90c6c3bd3fd71a3e65a48d3ff3f9277e9 /src/Java/gtPlusPlus/api/objects/data | |
parent | 9ba6d563d1b69bc8aa88d48754c273dae77aa713 (diff) | |
download | GT5-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')
4 files changed, 124 insertions, 0 deletions
diff --git a/src/Java/gtPlusPlus/api/objects/data/AutoMap.java b/src/Java/gtPlusPlus/api/objects/data/AutoMap.java index 9e7f702200..02517097cf 100644 --- a/src/Java/gtPlusPlus/api/objects/data/AutoMap.java +++ b/src/Java/gtPlusPlus/api/objects/data/AutoMap.java @@ -70,6 +70,20 @@ public class AutoMap<V> implements Iterable<V>, Cloneable, Serializable, Collect } } } + + /** + * Generates an AutoMap from a Array. + * @param aArray - Data to be inserted into the AutoMap. + */ + public AutoMap(V[] aArray) { + mInternalMap = new LinkedHashMap<Integer, V>(); + mInternalNameMap = new LinkedHashMap<String, Integer>(); + if (aArray != null && aArray.length > 0) { + for (V obj : aArray) { + add(obj); + } + } + } @Override public Iterator<V> iterator() { diff --git a/src/Java/gtPlusPlus/api/objects/data/ConcurrentHashSet.java b/src/Java/gtPlusPlus/api/objects/data/ConcurrentHashSet.java new file mode 100644 index 0000000000..991908e402 --- /dev/null +++ b/src/Java/gtPlusPlus/api/objects/data/ConcurrentHashSet.java @@ -0,0 +1,18 @@ +package gtPlusPlus.api.objects.data; + +import java.util.concurrent.ConcurrentHashMap; +import java.util.concurrent.ConcurrentMap; + +public class ConcurrentHashSet<V> extends ConcurrentSet<V> { + + private static final long serialVersionUID = -1293478938482781728L; + + public ConcurrentHashSet() { + this(new ConcurrentHashMap<Integer, V>()); + } + + public ConcurrentHashSet(ConcurrentMap<Integer, V> defaultMapType) { + super(defaultMapType); + } + +} 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(); + } +} diff --git a/src/Java/gtPlusPlus/api/objects/data/FlexiblePair.java b/src/Java/gtPlusPlus/api/objects/data/FlexiblePair.java new file mode 100644 index 0000000000..64f57b4e5a --- /dev/null +++ b/src/Java/gtPlusPlus/api/objects/data/FlexiblePair.java @@ -0,0 +1,39 @@ +package gtPlusPlus.api.objects.data; + +import java.io.Serializable; + +import com.google.common.base.Objects; + +public class FlexiblePair<K,V> implements Serializable { + + /** + * SVUID + */ + private static final long serialVersionUID = 1250550491092812443L; + private final K key; + private V value; + + public FlexiblePair(final K key, final V value){ + this.key = key; + this.value = value; + } + + final public K getKey(){ + return this.key; + } + + final public V getValue(){ + return this.value; + } + + final public void setValue(V aObj) { + value = aObj; + } + + @Override + public int hashCode() { + Integer aCode = Objects.hashCode(getKey(), getValue()); + return aCode != null ? aCode : super.hashCode(); + } + +}
\ No newline at end of file |