ImmutableTable.java
5.77 KB
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
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
package com.google.common.collect;
import com.google.common.annotations.GwtCompatible;
import com.google.common.base.MoreObjects;
import com.google.common.base.Preconditions;
import java.util.Comparator;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;
import javax.annotation.Nullable;
import nf;
import pq;
import px;
import qc;
@GwtCompatible
public abstract class ImmutableTable<R, C, V>
extends nf<R, C, V>
{
private static final ImmutableTable<Object, Object, Object> a = new qc(ImmutableList.of(), ImmutableSet.of(), ImmutableSet.of());
protected static <R, C, V> Table.Cell<R, C, V> a(R paramR, C paramC, V paramV)
{
return Tables.immutableCell(Preconditions.checkNotNull(paramR), Preconditions.checkNotNull(paramC), Preconditions.checkNotNull(paramV));
}
public static <R, C, V> Builder<R, C, V> builder()
{
return new Builder();
}
public static <R, C, V> ImmutableTable<R, C, V> copyOf(Table<? extends R, ? extends C, ? extends V> paramTable)
{
if ((paramTable instanceof ImmutableTable)) {
return (ImmutableTable)paramTable;
}
ImmutableSet.Builder localBuilder;
switch (paramTable.size())
{
default:
localBuilder = ImmutableSet.builder();
paramTable = paramTable.cellSet().iterator();
}
while (paramTable.hasNext())
{
Table.Cell localCell = (Table.Cell)paramTable.next();
localBuilder.add(a(localCell.getRowKey(), localCell.getColumnKey(), localCell.getValue()));
continue;
return of();
paramTable = (Table.Cell)Iterables.getOnlyElement(paramTable.cellSet());
return of(paramTable.getRowKey(), paramTable.getColumnKey(), paramTable.getValue());
}
return pq.a(localBuilder.build(), null, null);
}
public static <R, C, V> ImmutableTable<R, C, V> of()
{
return a;
}
public static <R, C, V> ImmutableTable<R, C, V> of(R paramR, C paramC, V paramV)
{
return new px(paramR, paramC, paramV);
}
public ImmutableSet<Table.Cell<R, C, V>> cellSet()
{
return (ImmutableSet)super.cellSet();
}
@Deprecated
public final void clear()
{
throw new UnsupportedOperationException();
}
public ImmutableMap<R, V> column(C paramC)
{
Preconditions.checkNotNull(paramC);
return (ImmutableMap)MoreObjects.firstNonNull((ImmutableMap)columnMap().get(paramC), ImmutableMap.of());
}
public ImmutableSet<C> columnKeySet()
{
return columnMap().keySet();
}
public abstract ImmutableMap<C, Map<R, V>> columnMap();
public boolean contains(@Nullable Object paramObject1, @Nullable Object paramObject2)
{
return get(paramObject1, paramObject2) != null;
}
public boolean containsValue(@Nullable Object paramObject)
{
return values().contains(paramObject);
}
final Iterator<V> d()
{
throw new AssertionError("should never be called");
}
protected abstract ImmutableSet<Table.Cell<R, C, V>> e();
protected abstract ImmutableCollection<V> f();
@Deprecated
public final V put(R paramR, C paramC, V paramV)
{
throw new UnsupportedOperationException();
}
@Deprecated
public final void putAll(Table<? extends R, ? extends C, ? extends V> paramTable)
{
throw new UnsupportedOperationException();
}
@Deprecated
public final V remove(Object paramObject1, Object paramObject2)
{
throw new UnsupportedOperationException();
}
public ImmutableMap<C, V> row(R paramR)
{
Preconditions.checkNotNull(paramR);
return (ImmutableMap)MoreObjects.firstNonNull((ImmutableMap)rowMap().get(paramR), ImmutableMap.of());
}
public ImmutableSet<R> rowKeySet()
{
return rowMap().keySet();
}
public abstract ImmutableMap<R, Map<C, V>> rowMap();
public ImmutableCollection<V> values()
{
return (ImmutableCollection)super.values();
}
public static final class Builder<R, C, V>
{
private final List<Table.Cell<R, C, V>> a = Lists.newArrayList();
private Comparator<? super R> b;
private Comparator<? super C> c;
public final ImmutableTable<R, C, V> build()
{
switch (this.a.size())
{
default:
return pq.a(this.a, this.b, this.c);
case 0:
return ImmutableTable.of();
}
return new px((Table.Cell)Iterables.getOnlyElement(this.a));
}
public final Builder<R, C, V> orderColumnsBy(Comparator<? super C> paramComparator)
{
this.c = ((Comparator)Preconditions.checkNotNull(paramComparator));
return this;
}
public final Builder<R, C, V> orderRowsBy(Comparator<? super R> paramComparator)
{
this.b = ((Comparator)Preconditions.checkNotNull(paramComparator));
return this;
}
public final Builder<R, C, V> put(Table.Cell<? extends R, ? extends C, ? extends V> paramCell)
{
if ((paramCell instanceof Tables.b))
{
Preconditions.checkNotNull(paramCell.getRowKey());
Preconditions.checkNotNull(paramCell.getColumnKey());
Preconditions.checkNotNull(paramCell.getValue());
this.a.add(paramCell);
return this;
}
put(paramCell.getRowKey(), paramCell.getColumnKey(), paramCell.getValue());
return this;
}
public final Builder<R, C, V> put(R paramR, C paramC, V paramV)
{
this.a.add(ImmutableTable.a(paramR, paramC, paramV));
return this;
}
public final Builder<R, C, V> putAll(Table<? extends R, ? extends C, ? extends V> paramTable)
{
paramTable = paramTable.cellSet().iterator();
while (paramTable.hasNext()) {
put((Table.Cell)paramTable.next());
}
return this;
}
}
}
/* Location: /home/merong/decompile/hackery-dex2jar.jar!/com/google/common/collect/ImmutableTable.class
* Java compiler version: 6 (50.0)
* JD-Core Version: 0.7.1
*/