From fbe73a2de925d012dddfa46b13e745028ce40679 Mon Sep 17 00:00:00 2001 From: Alkalus <3060479+draknyte1@users.noreply.github.com> Date: Thu, 14 Feb 2019 18:50:58 +0000 Subject: + Added Tags to tooltips, which can be used to control base tooltips inherited from parents. % Mild update to tooltips of a few multis. % Adjusted Large Arc Furnace casing texture. % Renamed the 3 Factory Grade multis. --- src/Java/gtPlusPlus/api/objects/data/AutoMap.java | 47 +++++++++++++++++++---- 1 file changed, 40 insertions(+), 7 deletions(-) (limited to 'src/Java/gtPlusPlus/api/objects/data') diff --git a/src/Java/gtPlusPlus/api/objects/data/AutoMap.java b/src/Java/gtPlusPlus/api/objects/data/AutoMap.java index ca231dbd63..d5e016bbf8 100644 --- a/src/Java/gtPlusPlus/api/objects/data/AutoMap.java +++ b/src/Java/gtPlusPlus/api/objects/data/AutoMap.java @@ -47,6 +47,10 @@ public class AutoMap implements Iterable, Cloneable, Serializable { return set(object); } + public synchronized V add(V object){ + return set(object); + } + public synchronized V set(V object){ if (object == null) { return null; @@ -90,15 +94,19 @@ public class AutoMap implements Iterable, Cloneable, Serializable { return true; } + private final Class getMapType() { + Class g = mInternalMap.get(0).getClass(); + return g; + } + public synchronized V[] toArray() { - Collection col = this.mInternalMap.values(); - V[] val = (V[]) new Object[col.size()]; - int counter = 0; - for (V i : col) { - val[counter] = i; - counter++; + /*Collection col = this.mInternalMap.values(); + List abcList = new ArrayList(); + for (V g : col) { + abcList.add(g); } - return val; + return (V[]) abcList.toArray();*/ + return (V[]) new AutoArray(this).getGenericArray(); } public synchronized final int getInternalID() { @@ -106,10 +114,35 @@ public class AutoMap implements Iterable, Cloneable, Serializable { } public synchronized final boolean remove(V value) { + value.getClass(); if (this.mInternalMap.containsValue(value)) { return this.mInternalMap.remove(mInternalNameMap.get(""+value.hashCode()), value); } return false; } + + private class AutoArray { + + 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; + } + protected V[] getGenericArray() { + return arr; + } + @Override + public String toString() { + return Arrays.toString(arr); + } + } } -- cgit