diff options
author | Jakub <53441451+kuba6000@users.noreply.github.com> | 2022-08-29 16:04:28 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-08-29 16:04:28 +0200 |
commit | 7d1f51a8937e0a86486267437d444696e81e8aa0 (patch) | |
tree | a5b145e7271998f7b4b968a2212ed487e54a92b5 /src/main/java/gtPlusPlus/api/objects/minecraft/NoConflictGTRecipeMap.java | |
parent | 5267969156d30b4bb5f4cb2279ebb49db6bd40e2 (diff) | |
download | GT5-Unofficial-7d1f51a8937e0a86486267437d444696e81e8aa0.tar.gz GT5-Unofficial-7d1f51a8937e0a86486267437d444696e81e8aa0.tar.bz2 GT5-Unofficial-7d1f51a8937e0a86486267437d444696e81e8aa0.zip |
Buildscript + Spotless (#318)
* Convert AES.java to readable class
* Buildscript
* Spotless
Diffstat (limited to 'src/main/java/gtPlusPlus/api/objects/minecraft/NoConflictGTRecipeMap.java')
-rw-r--r-- | src/main/java/gtPlusPlus/api/objects/minecraft/NoConflictGTRecipeMap.java | 225 |
1 files changed, 111 insertions, 114 deletions
diff --git a/src/main/java/gtPlusPlus/api/objects/minecraft/NoConflictGTRecipeMap.java b/src/main/java/gtPlusPlus/api/objects/minecraft/NoConflictGTRecipeMap.java index 78e925fe04..a8768f7604 100644 --- a/src/main/java/gtPlusPlus/api/objects/minecraft/NoConflictGTRecipeMap.java +++ b/src/main/java/gtPlusPlus/api/objects/minecraft/NoConflictGTRecipeMap.java @@ -1,123 +1,120 @@ package gtPlusPlus.api.objects.minecraft; -import java.util.Collection; -import java.util.Iterator; - import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.util.GT_Recipe; - import gtPlusPlus.api.objects.data.AutoMap; +import java.util.Collection; +import java.util.Iterator; public class NoConflictGTRecipeMap implements Collection<GT_Recipe> { - private AutoMap<GT_Recipe> mRecipeCache = new AutoMap<GT_Recipe>(); - private final IGregTechTileEntity mMachineType; - - public NoConflictGTRecipeMap () { - this(null); - } - - public NoConflictGTRecipeMap (IGregTechTileEntity tile0) { - this.mMachineType = tile0; - } - public boolean put(GT_Recipe recipe) { - return add(recipe); - } - - public boolean add(GT_Recipe recipe) { - return mRecipeCache.setValue(recipe); - } - - public Collection<GT_Recipe> getRecipeMap() { - return mRecipeCache.values(); - } - - public boolean isMapValidForMachine(IGregTechTileEntity tile) { - return tile == mMachineType; - } - - @Override - public boolean addAll(Collection<? extends GT_Recipe> arg0) { - int a = 0; - for (Object v : arg0) { - if (!this.mRecipeCache.containsValue((GT_Recipe) v)) { - this.mRecipeCache.put((GT_Recipe) v); - a++; - } - } - return a > 0; - } - - @Override - public void clear() { - mRecipeCache.clear(); - } - - @Override - public boolean contains(Object arg0) { - return mRecipeCache.containsValue((GT_Recipe) arg0); - } - - @Override - public boolean containsAll(Collection<?> arg0) { - int a = 0; - for (Object v : arg0) { - if (this.mRecipeCache.containsValue((GT_Recipe) v)) { - a++; - } - } - return a == arg0.size(); - } - - @Override - public boolean isEmpty() { - return mRecipeCache.isEmpty(); - } - - @Override - public Iterator<GT_Recipe> iterator() { - return mRecipeCache.iterator(); - } - - @Override - public boolean remove(Object arg0) { - return mRecipeCache.remove((GT_Recipe) arg0); - } - - @Override - public boolean removeAll(Collection<?> arg0) { - int a = 0; - for (Object v : arg0) { - if (this.mRecipeCache.containsValue((GT_Recipe) v)) { - this.mRecipeCache.remove((GT_Recipe) v); - a++; - } - } - return a > 0; - } - - @Override - public boolean retainAll(Collection<?> arg0) { - int mStartSize = this.mRecipeCache.size(); - this.mRecipeCache = (AutoMap<GT_Recipe>) arg0; - int mEndsize = this.mRecipeCache.size(); - return mStartSize != mEndsize; - } - - @Override - public int size() { - return this.mRecipeCache.size(); - } - - @Override - public Object[] toArray() { - return this.mRecipeCache.toArray(); - } - - @Override - public <T> T[] toArray(T[] arg0) { - return (T[]) this.mRecipeCache.toArray(); - } - - + private AutoMap<GT_Recipe> mRecipeCache = new AutoMap<GT_Recipe>(); + private final IGregTechTileEntity mMachineType; + + public NoConflictGTRecipeMap() { + this(null); + } + + public NoConflictGTRecipeMap(IGregTechTileEntity tile0) { + this.mMachineType = tile0; + } + + public boolean put(GT_Recipe recipe) { + return add(recipe); + } + + public boolean add(GT_Recipe recipe) { + return mRecipeCache.setValue(recipe); + } + + public Collection<GT_Recipe> getRecipeMap() { + return mRecipeCache.values(); + } + + public boolean isMapValidForMachine(IGregTechTileEntity tile) { + return tile == mMachineType; + } + + @Override + public boolean addAll(Collection<? extends GT_Recipe> arg0) { + int a = 0; + for (Object v : arg0) { + if (!this.mRecipeCache.containsValue((GT_Recipe) v)) { + this.mRecipeCache.put((GT_Recipe) v); + a++; + } + } + return a > 0; + } + + @Override + public void clear() { + mRecipeCache.clear(); + } + + @Override + public boolean contains(Object arg0) { + return mRecipeCache.containsValue((GT_Recipe) arg0); + } + + @Override + public boolean containsAll(Collection<?> arg0) { + int a = 0; + for (Object v : arg0) { + if (this.mRecipeCache.containsValue((GT_Recipe) v)) { + a++; + } + } + return a == arg0.size(); + } + + @Override + public boolean isEmpty() { + return mRecipeCache.isEmpty(); + } + + @Override + public Iterator<GT_Recipe> iterator() { + return mRecipeCache.iterator(); + } + + @Override + public boolean remove(Object arg0) { + return mRecipeCache.remove((GT_Recipe) arg0); + } + + @Override + public boolean removeAll(Collection<?> arg0) { + int a = 0; + for (Object v : arg0) { + if (this.mRecipeCache.containsValue((GT_Recipe) v)) { + this.mRecipeCache.remove((GT_Recipe) v); + a++; + } + } + return a > 0; + } + + @Override + public boolean retainAll(Collection<?> arg0) { + int mStartSize = this.mRecipeCache.size(); + this.mRecipeCache = (AutoMap<GT_Recipe>) arg0; + int mEndsize = this.mRecipeCache.size(); + return mStartSize != mEndsize; + } + + @Override + public int size() { + return this.mRecipeCache.size(); + } + + @Override + public Object[] toArray() { + return this.mRecipeCache.toArray(); + } + + @Override + public <T> T[] toArray(T[] arg0) { + return (T[]) this.mRecipeCache.toArray(); + } } |