blob: 78e925fe04ec7f94bcc0525a56864d87d38f4110 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
|
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;
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();
}
}
|