aboutsummaryrefslogtreecommitdiff
path: root/src/Java/gtPlusPlus/api
diff options
context:
space:
mode:
authorAlkalus <3060479+draknyte1@users.noreply.github.com>2019-02-14 20:03:07 +0000
committerAlkalus <3060479+draknyte1@users.noreply.github.com>2019-02-14 20:03:07 +0000
commit1f48c6da89afb649c3b73674cb3c0664fa322a09 (patch)
tree493e5d87627fd9bb4de7eeb4094640108c04bf64 /src/Java/gtPlusPlus/api
parente562aa2059d09840cf2a3ad9333e477bcb670cd9 (diff)
downloadGT5-Unofficial-1f48c6da89afb649c3b73674cb3c0664fa322a09.tar.gz
GT5-Unofficial-1f48c6da89afb649c3b73674cb3c0664fa322a09.tar.bz2
GT5-Unofficial-1f48c6da89afb649c3b73674cb3c0664fa322a09.zip
+ Added recipes for the Large Arc Furnace and Casings.
- Disabled power output on Alternative Fusion. % Made the AutoMap implement Collection and Queue. $ Fixed energy buffers return bad inventory name.
Diffstat (limited to 'src/Java/gtPlusPlus/api')
-rw-r--r--src/Java/gtPlusPlus/api/objects/data/AutoMap.java139
1 files changed, 103 insertions, 36 deletions
diff --git a/src/Java/gtPlusPlus/api/objects/data/AutoMap.java b/src/Java/gtPlusPlus/api/objects/data/AutoMap.java
index d5e016bbf8..4663229514 100644
--- a/src/Java/gtPlusPlus/api/objects/data/AutoMap.java
+++ b/src/Java/gtPlusPlus/api/objects/data/AutoMap.java
@@ -3,7 +3,7 @@ package gtPlusPlus.api.objects.data;
import java.io.Serializable;
import java.util.*;
-public class AutoMap<V> implements Iterable<V>, Cloneable, Serializable {
+public class AutoMap<V> implements Iterable<V>, Cloneable, Serializable, Collection<V>, Queue<V> {
/**
* The Internal Map
@@ -47,8 +47,8 @@ public class AutoMap<V> implements Iterable<V>, Cloneable, Serializable {
return set(object);
}
- public synchronized V add(V object){
- return set(object);
+ public synchronized boolean add(V object){
+ return set(object) != null;
}
public synchronized V set(V object){
@@ -87,62 +87,129 @@ public class AutoMap<V> implements Iterable<V>, Cloneable, Serializable {
return mInternalMap.isEmpty();
}
- public synchronized boolean clear(){
+ public synchronized void clear(){
this.mInternalID = 0;
this.mInternalMap.clear();
this.mInternalNameMap.clear();
- return true;
- }
-
- private final Class getMapType() {
- Class<? extends Object> g = mInternalMap.get(0).getClass();
- return g;
+ return;
}
+ @SuppressWarnings("unchecked")
public synchronized V[] toArray() {
- /*Collection<V> col = this.mInternalMap.values();
+ Collection<V> col = this.mInternalMap.values();
List<V> abcList = new ArrayList<V>();
for (V g : col) {
abcList.add(g);
}
- return (V[]) abcList.toArray();*/
- return (V[]) new AutoArray(this).getGenericArray();
+ return (V[]) abcList.toArray();
+ //return (V[]) new AutoArray(this).getGenericArray();
}
public synchronized final int getInternalID() {
return mInternalID;
- }
+ }
- public synchronized final boolean remove(V value) {
+ public synchronized final boolean remove(Object value) {
value.getClass();
if (this.mInternalMap.containsValue(value)) {
return this.mInternalMap.remove(mInternalNameMap.get(""+value.hashCode()), value);
}
return false;
- }
-
- private class AutoArray<E> {
-
- private final V[] arr;
- public final int length;
-
- public AutoArray(AutoMap aMap) {
- this.arr = (V[]) java.lang.reflect.Array.newInstance(aMap.getMapType(), aMap.size());
- this.length = aMap.size();
- }
- private V get(int i) {
- return arr[i];
- }
- private void set(int i, V e) {
- arr[i] = e;
+ }
+
+ @Override
+ public boolean contains(Object o) {
+ for (V g : this.mInternalMap.values()) {
+ if (g.equals(o)) {
+ return true;
+ }
}
- protected V[] getGenericArray() {
- return arr;
+ return false;
+ }
+
+ @SuppressWarnings("unchecked")
+ @Override
+ public <V> V[] toArray(V[] a) {
+ return (V[]) toArray();
+ }
+
+ @Override
+ public boolean containsAll(Collection<?> c) {
+ boolean aTrue = true;
+ for (Object g : c) {
+ if (!this.contains(g)) {
+ aTrue = false;
+ }
+ }
+ return aTrue;
+ }
+
+ @Override
+ public boolean addAll(Collection<? extends V> c) {
+ boolean aTrue = true;
+ for (V g : c) {
+ if (!this.add(g)) {
+ aTrue = false;
+ }
+ }
+ return aTrue;
+ }
+
+ @Override
+ public boolean removeAll(Collection<?> c) {
+ boolean aTrue = true;
+ for (Object g : c) {
+ if (!this.remove(g)) {
+ aTrue = false;
+ }
+ }
+ return aTrue;
+ }
+
+ @Override
+ public boolean retainAll(Collection<?> c) {
+ AutoMap<?> aTempAllocation = new AutoMap();
+ boolean aTrue = false;
+ aTempAllocation = this;
+ aTempAllocation.removeAll(c);
+ aTrue = this.removeAll(aTempAllocation);
+ aTempAllocation.clear();
+ return aTrue;
+ }
+
+ @Override
+ public boolean offer(V e) {
+ return add(e);
+ }
+
+ @Override
+ public V remove() {
+ V y = this.get(0);
+ if (remove(y))
+ return y;
+ else
+ return null;
+ }
+
+ @Override
+ public V poll() {
+ if (this.mInternalMap.isEmpty()) {
+ return null;
}
- @Override
- public String toString() {
- return Arrays.toString(arr);
+ return remove();
+ }
+
+ @Override
+ public V element() {
+ if (this.mInternalMap.isEmpty()) {
+ return null;
}
+ return this.get(0);
+ }
+
+ @Override
+ public V peek() {
+ return element();
}
}