CrackMe.apk
Download file
package com.google.common.collect;
import com.google.common.base.Function;
import com.google.common.base.Preconditions;
import com.google.common.base.Predicate;
import com.google.common.base.Predicates;
import com.google.common.base.Supplier;
import com.google.common.collect.Maps;
import com.google.common.collect.Sets;
import com.google.common.collect.Table;
import java.io.Serializable;
import java.util.Collection;
import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.Map;
import java.util.Objects;
import java.util.Set;
import javax.annotation.CheckForNull;
@ElementTypesAreNonnullByDefault
class StandardTable<R, C, V> extends AbstractTable<R, C, V> implements Serializable {
private static final long serialVersionUID = 0;
@GwtTransient
final Map<R, Map<C, V>> backingMap;
@CheckForNull
private transient Set<C> columnKeySet;
@CheckForNull
private transient StandardTable<R, C, V>.ColumnMap columnMap;
@GwtTransient
final Supplier<? extends Map<C, V>> factory;
@CheckForNull
private transient Map<R, Map<C, V>> rowMap;
StandardTable(Map<R, Map<C, V>> map, Supplier<? extends Map<C, V>> supplier) {
this.backingMap = map;
this.factory = supplier;
}
public boolean contains(@CheckForNull Object obj, @CheckForNull Object obj2) {
return (obj == null || obj2 == null || !super.contains(obj, obj2)) ? false : true;
}
public boolean containsColumn(@CheckForNull Object obj) {
if (obj == null) {
return false;
}
for (Map<C, V> safeContainsKey : this.backingMap.values()) {
if (Maps.safeContainsKey(safeContainsKey, obj)) {
return true;
}
}
return false;
}
public boolean containsRow(@CheckForNull Object obj) {
return obj != null && Maps.safeContainsKey(this.backingMap, obj);
}
public boolean containsValue(@CheckForNull Object obj) {
return obj != null && super.containsValue(obj);
}
@CheckForNull
public V get(@CheckForNull Object obj, @CheckForNull Object obj2) {
if (obj == null || obj2 == null) {
return null;
}
return super.get(obj, obj2);
}
public boolean isEmpty() {
return this.backingMap.isEmpty();
}
public int size() {
int i = 0;
for (Map<C, V> size : this.backingMap.values()) {
i += size.size();
}
return i;
}
public void clear() {
this.backingMap.clear();
}
private Map<C, V> getOrCreate(R r) {
Map<C, V> map = this.backingMap.get(r);
if (map != null) {
return map;
}
Map<C, V> map2 = (Map) this.factory.get();
this.backingMap.put(r, map2);
return map2;
}
@CheckForNull
public V put(R r, C c, V v) {
Preconditions.checkNotNull(r);
Preconditions.checkNotNull(c);
Preconditions.checkNotNull(v);
return getOrCreate(r).put(c, v);
}
@CheckForNull
public V remove(@CheckForNull Object obj, @CheckForNull Object obj2) {
Map map;
if (obj == null || obj2 == null || (map = (Map) Maps.safeGet(this.backingMap, obj)) == null) {
return null;
}
V remove = map.remove(obj2);
if (map.isEmpty()) {
this.backingMap.remove(obj);
}
return remove;
}
/* access modifiers changed from: private */
public Map<R, V> removeColumn(@CheckForNull Object obj) {
LinkedHashMap linkedHashMap = new LinkedHashMap();
Iterator<Map.Entry<R, Map<C, V>>> it = this.backingMap.entrySet().iterator();
while (it.hasNext()) {
Map.Entry next = it.next();
Object remove = ((Map) next.getValue()).remove(obj);
if (remove != null) {
linkedHashMap.put(next.getKey(), remove);
if (((Map) next.getValue()).isEmpty()) {
it.remove();
}
}
}
return linkedHashMap;
}
/* access modifiers changed from: private */
public boolean containsMapping(@CheckForNull Object obj, @CheckForNull Object obj2, @CheckForNull Object obj3) {
return obj3 != null && obj3.equals(get(obj, obj2));
}
/* access modifiers changed from: private */
public boolean removeMapping(@CheckForNull Object obj, @CheckForNull Object obj2, @CheckForNull Object obj3) {
if (!containsMapping(obj, obj2, obj3)) {
return false;
}
remove(obj, obj2);
return true;
}
private abstract class TableSet<T> extends Sets.ImprovedAbstractSet<T> {
private TableSet() {
}
public boolean isEmpty() {
return StandardTable.this.backingMap.isEmpty();
}
public void clear() {
StandardTable.this.backingMap.clear();
}
}
public Set<Table.Cell<R, C, V>> cellSet() {
return super.cellSet();
}
/* access modifiers changed from: package-private */
public Iterator<Table.Cell<R, C, V>> cellIterator() {
return new CellIterator();
}
private class CellIterator implements Iterator<Table.Cell<R, C, V>> {
Iterator<Map.Entry<C, V>> columnIterator;
@CheckForNull
Map.Entry<R, Map<C, V>> rowEntry;
final Iterator<Map.Entry<R, Map<C, V>>> rowIterator;
private CellIterator() {
this.rowIterator = StandardTable.this.backingMap.entrySet().iterator();
this.columnIterator = Iterators.emptyModifiableIterator();
}
public boolean hasNext() {
return this.rowIterator.hasNext() || this.columnIterator.hasNext();
}
public Table.Cell<R, C, V> next() {
if (!this.columnIterator.hasNext()) {
Map.Entry<R, Map<C, V>> next = this.rowIterator.next();
this.rowEntry = next;
this.columnIterator = next.getValue().entrySet().iterator();
}
Objects.requireNonNull(this.rowEntry);
Map.Entry next2 = this.columnIterator.next();
return Tables.immutableCell(this.rowEntry.getKey(), next2.getKey(), next2.getValue());
}
public void remove() {
this.columnIterator.remove();
Map.Entry<R, Map<C, V>> entry = this.rowEntry;
Objects.requireNonNull(entry);
Map.Entry entry2 = entry;
if (entry.getValue().isEmpty()) {
this.rowIterator.remove();
this.rowEntry = null;
}
}
}
public Map<C, V> row(R r) {
return new Row(r);
}
class Row extends Maps.IteratorBasedAbstractMap<C, V> {
@CheckForNull
Map<C, V> backingRowMap;
final R rowKey;
Row(R r) {
this.rowKey = Preconditions.checkNotNull(r);
}
/* access modifiers changed from: package-private */
public final void updateBackingRowMapField() {
Map<C, V> map = this.backingRowMap;
if (map == null || (map.isEmpty() && StandardTable.this.backingMap.containsKey(this.rowKey))) {
this.backingRowMap = computeBackingRowMap();
}
}
/* access modifiers changed from: package-private */
@CheckForNull
public Map<C, V> computeBackingRowMap() {
return StandardTable.this.backingMap.get(this.rowKey);
}
/* access modifiers changed from: package-private */
public void maintainEmptyInvariant() {
updateBackingRowMapField();
Map<C, V> map = this.backingRowMap;
if (map != null && map.isEmpty()) {
StandardTable.this.backingMap.remove(this.rowKey);
this.backingRowMap = null;
}
}
/* JADX WARNING: Code restructure failed: missing block: B:2:0x0005, code lost:
r0 = r1.backingRowMap;
*/
/* Code decompiled incorrectly, please refer to instructions dump. */
public boolean containsKey(@javax.annotation.CheckForNull java.lang.Object r2) {
/*
r1 = this;
r1.updateBackingRowMapField()
if (r2 == 0) goto L_0x0011
java.util.Map<C, V> r0 = r1.backingRowMap
if (r0 == 0) goto L_0x0011
boolean r2 = com.google.common.collect.Maps.safeContainsKey(r0, r2)
if (r2 == 0) goto L_0x0011
r2 = 1
goto L_0x0012
L_0x0011:
r2 = 0
L_0x0012:
return r2
*/
throw new UnsupportedOperationException("Method not decompiled: com.google.common.collect.StandardTable.Row.containsKey(java.lang.Object):boolean");
}
@CheckForNull
public V get(@CheckForNull Object obj) {
Map<C, V> map;
updateBackingRowMapField();
if (obj == null || (map = this.backingRowMap) == null) {
return null;
}
return Maps.safeGet(map, obj);
}
@CheckForNull
public V put(C c, V v) {
Preconditions.checkNotNull(c);
Preconditions.checkNotNull(v);
Map<C, V> map = this.backingRowMap;
if (map == null || map.isEmpty()) {
return StandardTable.this.put(this.rowKey, c, v);
}
return this.backingRowMap.put(c, v);
}
@CheckForNull
public V remove(@CheckForNull Object obj) {
updateBackingRowMapField();
Map<C, V> map = this.backingRowMap;
if (map == null) {
return null;
}
V safeRemove = Maps.safeRemove(map, obj);
maintainEmptyInvariant();
return safeRemove;
}
public void clear() {
updateBackingRowMapField();
Map<C, V> map = this.backingRowMap;
if (map != null) {
map.clear();
}
maintainEmptyInvariant();
}
public int size() {
updateBackingRowMapField();
Map<C, V> map = this.backingRowMap;
if (map == null) {
return 0;
}
return map.size();
}
/* access modifiers changed from: package-private */
public Iterator<Map.Entry<C, V>> entryIterator() {
updateBackingRowMapField();
Map<C, V> map = this.backingRowMap;
if (map == null) {
return Iterators.emptyModifiableIterator();
}
final Iterator<Map.Entry<C, V>> it = map.entrySet().iterator();
return new Iterator<Map.Entry<C, V>>() {
public boolean hasNext() {
return it.hasNext();
}
public Map.Entry<C, V> next() {
return Row.this.wrapEntry((Map.Entry) it.next());
}
public void remove() {
it.remove();
Row.this.maintainEmptyInvariant();
}
};
}
/* access modifiers changed from: package-private */
public Map.Entry<C, V> wrapEntry(final Map.Entry<C, V> entry) {
return new ForwardingMapEntry<C, V>(this) {
/* access modifiers changed from: protected */
public Map.Entry<C, V> delegate() {
return entry;
}
public V setValue(V v) {
return super.setValue(Preconditions.checkNotNull(v));
}
public boolean equals(@CheckForNull Object obj) {
return standardEquals(obj);
}
};
}
}
public Map<R, V> column(C c) {
return new Column(c);
}
private class Column extends Maps.ViewCachingAbstractMap<R, V> {
final C columnKey;
Column(C c) {
this.columnKey = Preconditions.checkNotNull(c);
}
@CheckForNull
public V put(R r, V v) {
return StandardTable.this.put(r, this.columnKey, v);
}
@CheckForNull
public V get(@CheckForNull Object obj) {
return StandardTable.this.get(obj, this.columnKey);
}
public boolean containsKey(@CheckForNull Object obj) {
return StandardTable.this.contains(obj, this.columnKey);
}
@CheckForNull
public V remove(@CheckForNull Object obj) {
return StandardTable.this.remove(obj, this.columnKey);
}
/* access modifiers changed from: package-private */
public boolean removeFromColumnIf(Predicate<? super Map.Entry<R, V>> predicate) {
Iterator<Map.Entry<R, Map<C, V>>> it = StandardTable.this.backingMap.entrySet().iterator();
boolean z = false;
while (it.hasNext()) {
Map.Entry next = it.next();
Map map = (Map) next.getValue();
Object obj = map.get(this.columnKey);
if (obj != null && predicate.apply(Maps.immutableEntry(next.getKey(), obj))) {
map.remove(this.columnKey);
z = true;
if (map.isEmpty()) {
it.remove();
}
}
}
return z;
}
/* access modifiers changed from: package-private */
public Set<Map.Entry<R, V>> createEntrySet() {
return new EntrySet();
}
private class EntrySet extends Sets.ImprovedAbstractSet<Map.Entry<R, V>> {
private EntrySet() {
}
public Iterator<Map.Entry<R, V>> iterator() {
return new EntrySetIterator();
}
public int size() {
int i = 0;
for (Map<C, V> containsKey : StandardTable.this.backingMap.values()) {
if (containsKey.containsKey(Column.this.columnKey)) {
i++;
}
}
return i;
}
public boolean isEmpty() {
return !StandardTable.this.containsColumn(Column.this.columnKey);
}
public void clear() {
Column.this.removeFromColumnIf(Predicates.alwaysTrue());
}
public boolean contains(@CheckForNull Object obj) {
if (!(obj instanceof Map.Entry)) {
return false;
}
Map.Entry entry = (Map.Entry) obj;
return StandardTable.this.containsMapping(entry.getKey(), Column.this.columnKey, entry.getValue());
}
public boolean remove(@CheckForNull Object obj) {
if (!(obj instanceof Map.Entry)) {
return false;
}
Map.Entry entry = (Map.Entry) obj;
return StandardTable.this.removeMapping(entry.getKey(), Column.this.columnKey, entry.getValue());
}
public boolean retainAll(Collection<?> collection) {
return Column.this.removeFromColumnIf(Predicates.not(Predicates.in(collection)));
}
}
private class EntrySetIterator extends AbstractIterator<Map.Entry<R, V>> {
final Iterator<Map.Entry<R, Map<C, V>>> iterator;
private EntrySetIterator() {
this.iterator = StandardTable.this.backingMap.entrySet().iterator();
}
/* access modifiers changed from: protected */
@CheckForNull
public Map.Entry<R, V> computeNext() {
while (this.iterator.hasNext()) {
final Map.Entry next = this.iterator.next();
if (((Map) next.getValue()).containsKey(Column.this.columnKey)) {
return new AbstractMapEntry<R, V>() {
public R getKey() {
return next.getKey();
}
public V getValue() {
return ((Map) next.getValue()).get(Column.this.columnKey);
}
public V setValue(V v) {
return NullnessCasts.uncheckedCastNullableTToT(((Map) next.getValue()).put(Column.this.columnKey, Preconditions.checkNotNull(v)));
}
};
}
}
return (Map.Entry) endOfData();
}
}
/* access modifiers changed from: package-private */
public Set<R> createKeySet() {
return new KeySet();
}
private class KeySet extends Maps.KeySet<R, V> {
KeySet() {
super(Column.this);
}
public boolean contains(@CheckForNull Object obj) {
return StandardTable.this.contains(obj, Column.this.columnKey);
}
public boolean remove(@CheckForNull Object obj) {
return StandardTable.this.remove(obj, Column.this.columnKey) != null;
}
public boolean retainAll(Collection<?> collection) {
return Column.this.removeFromColumnIf(Maps.keyPredicateOnEntries(Predicates.not(Predicates.in(collection))));
}
}
/* access modifiers changed from: package-private */
public Collection<V> createValues() {
return new Values();
}
private class Values extends Maps.Values<R, V> {
Values() {
super(Column.this);
}
public boolean remove(@CheckForNull Object obj) {
return obj != null && Column.this.removeFromColumnIf(Maps.valuePredicateOnEntries(Predicates.equalTo(obj)));
}
public boolean removeAll(Collection<?> collection) {
return Column.this.removeFromColumnIf(Maps.valuePredicateOnEntries(Predicates.in(collection)));
}
public boolean retainAll(Collection<?> collection) {
return Column.this.removeFromColumnIf(Maps.valuePredicateOnEntries(Predicates.not(Predicates.in(collection))));
}
}
}
public Set<R> rowKeySet() {
return rowMap().keySet();
}
public Set<C> columnKeySet() {
Set<C> set = this.columnKeySet;
if (set != null) {
return set;
}
ColumnKeySet columnKeySet2 = new ColumnKeySet();
this.columnKeySet = columnKeySet2;
return columnKeySet2;
}
private class ColumnKeySet extends StandardTable<R, C, V>.TableSet<C> {
private ColumnKeySet() {
super();
}
public Iterator<C> iterator() {
return StandardTable.this.createColumnKeyIterator();
}
public int size() {
return Iterators.size(iterator());
}
public boolean remove(@CheckForNull Object obj) {
boolean z = false;
if (obj == null) {
return false;
}
Iterator<Map<C, V>> it = StandardTable.this.backingMap.values().iterator();
while (it.hasNext()) {
Map next = it.next();
if (next.keySet().remove(obj)) {
z = true;
if (next.isEmpty()) {
it.remove();
}
}
}
return z;
}
public boolean removeAll(Collection<?> collection) {
Preconditions.checkNotNull(collection);
Iterator<Map<C, V>> it = StandardTable.this.backingMap.values().iterator();
boolean z = false;
while (it.hasNext()) {
Map next = it.next();
if (Iterators.removeAll(next.keySet().iterator(), collection)) {
z = true;
if (next.isEmpty()) {
it.remove();
}
}
}
return z;
}
public boolean retainAll(Collection<?> collection) {
Preconditions.checkNotNull(collection);
Iterator<Map<C, V>> it = StandardTable.this.backingMap.values().iterator();
boolean z = false;
while (it.hasNext()) {
Map next = it.next();
if (next.keySet().retainAll(collection)) {
z = true;
if (next.isEmpty()) {
it.remove();
}
}
}
return z;
}
public boolean contains(@CheckForNull Object obj) {
return StandardTable.this.containsColumn(obj);
}
}
/* access modifiers changed from: package-private */
public Iterator<C> createColumnKeyIterator() {
return new ColumnKeyIterator();
}
private class ColumnKeyIterator extends AbstractIterator<C> {
Iterator<Map.Entry<C, V>> entryIterator;
final Iterator<Map<C, V>> mapIterator;
final Map<C, V> seen;
private ColumnKeyIterator() {
this.seen = (Map) StandardTable.this.factory.get();
this.mapIterator = StandardTable.this.backingMap.values().iterator();
this.entryIterator = Iterators.emptyIterator();
}
/* access modifiers changed from: protected */
@CheckForNull
public C computeNext() {
while (true) {
if (this.entryIterator.hasNext()) {
Map.Entry next = this.entryIterator.next();
if (!this.seen.containsKey(next.getKey())) {
this.seen.put(next.getKey(), next.getValue());
return next.getKey();
}
} else if (!this.mapIterator.hasNext()) {
return endOfData();
} else {
this.entryIterator = this.mapIterator.next().entrySet().iterator();
}
}
}
}
public Collection<V> values() {
return super.values();
}
public Map<R, Map<C, V>> rowMap() {
Map<R, Map<C, V>> map = this.rowMap;
if (map != null) {
return map;
}
Map<R, Map<C, V>> createRowMap = createRowMap();
this.rowMap = createRowMap;
return createRowMap;
}
/* access modifiers changed from: package-private */
public Map<R, Map<C, V>> createRowMap() {
return new RowMap();
}
class RowMap extends Maps.ViewCachingAbstractMap<R, Map<C, V>> {
RowMap() {
}
public boolean containsKey(@CheckForNull Object obj) {
return StandardTable.this.containsRow(obj);
}
@CheckForNull
public Map<C, V> get(@CheckForNull Object obj) {
if (!StandardTable.this.containsRow(obj)) {
return null;
}
StandardTable standardTable = StandardTable.this;
Objects.requireNonNull(obj);
return standardTable.row(obj);
}
@CheckForNull
public Map<C, V> remove(@CheckForNull Object obj) {
if (obj == null) {
return null;
}
return StandardTable.this.backingMap.remove(obj);
}
/* access modifiers changed from: protected */
public Set<Map.Entry<R, Map<C, V>>> createEntrySet() {
return new EntrySet();
}
class EntrySet extends StandardTable<R, C, V>.TableSet<Map.Entry<R, Map<C, V>>> {
EntrySet() {
super();
}
public Iterator<Map.Entry<R, Map<C, V>>> iterator() {
return Maps.asMapEntryIterator(StandardTable.this.backingMap.keySet(), new Function<R, Map<C, V>>() {
public Map<C, V> apply(R r) {
return StandardTable.this.row(r);
}
});
}
public int size() {
return StandardTable.this.backingMap.size();
}
public boolean contains(@CheckForNull Object obj) {
if (!(obj instanceof Map.Entry)) {
return false;
}
Map.Entry entry = (Map.Entry) obj;
if (entry.getKey() == null || !(entry.getValue() instanceof Map) || !Collections2.safeContains(StandardTable.this.backingMap.entrySet(), entry)) {
return false;
}
return true;
}
public boolean remove(@CheckForNull Object obj) {
if (!(obj instanceof Map.Entry)) {
return false;
}
Map.Entry entry = (Map.Entry) obj;
if (entry.getKey() == null || !(entry.getValue() instanceof Map) || !StandardTable.this.backingMap.entrySet().remove(entry)) {
return false;
}
return true;
}
}
}
public Map<C, Map<R, V>> columnMap() {
StandardTable<R, C, V>.ColumnMap columnMap2 = this.columnMap;
if (columnMap2 != null) {
return columnMap2;
}
StandardTable<R, C, V>.ColumnMap columnMap3 = new ColumnMap();
this.columnMap = columnMap3;
return columnMap3;
}
private class ColumnMap extends Maps.ViewCachingAbstractMap<C, Map<R, V>> {
private ColumnMap() {
}
@CheckForNull
public Map<R, V> get(@CheckForNull Object obj) {
if (!StandardTable.this.containsColumn(obj)) {
return null;
}
StandardTable standardTable = StandardTable.this;
Objects.requireNonNull(obj);
return standardTable.column(obj);
}
public boolean containsKey(@CheckForNull Object obj) {
return StandardTable.this.containsColumn(obj);
}
@CheckForNull
public Map<R, V> remove(@CheckForNull Object obj) {
if (StandardTable.this.containsColumn(obj)) {
return StandardTable.this.removeColumn(obj);
}
return null;
}
public Set<Map.Entry<C, Map<R, V>>> createEntrySet() {
return new ColumnMapEntrySet();
}
public Set<C> keySet() {
return StandardTable.this.columnKeySet();
}
/* access modifiers changed from: package-private */
public Collection<Map<R, V>> createValues() {
return new ColumnMapValues();
}
class ColumnMapEntrySet extends StandardTable<R, C, V>.TableSet<Map.Entry<C, Map<R, V>>> {
ColumnMapEntrySet() {
super();
}
public Iterator<Map.Entry<C, Map<R, V>>> iterator() {
return Maps.asMapEntryIterator(StandardTable.this.columnKeySet(), new Function<C, Map<R, V>>() {
public Map<R, V> apply(C c) {
return StandardTable.this.column(c);
}
});
}
public int size() {
return StandardTable.this.columnKeySet().size();
}
public boolean contains(@CheckForNull Object obj) {
if (!(obj instanceof Map.Entry)) {
return false;
}
Map.Entry entry = (Map.Entry) obj;
if (!StandardTable.this.containsColumn(entry.getKey())) {
return false;
}
Map map = ColumnMap.this.get(entry.getKey());
Objects.requireNonNull(map);
Map map2 = map;
return map.equals(entry.getValue());
}
public boolean remove(@CheckForNull Object obj) {
if (!contains(obj) || !(obj instanceof Map.Entry)) {
return false;
}
Map unused = StandardTable.this.removeColumn(((Map.Entry) obj).getKey());
return true;
}
public boolean removeAll(Collection<?> collection) {
Preconditions.checkNotNull(collection);
return Sets.removeAllImpl((Set<?>) this, collection.iterator());
}
public boolean retainAll(Collection<?> collection) {
Preconditions.checkNotNull(collection);
Iterator it = Lists.newArrayList(StandardTable.this.columnKeySet().iterator()).iterator();
boolean z = false;
while (it.hasNext()) {
Object next = it.next();
if (!collection.contains(Maps.immutableEntry(next, StandardTable.this.column(next)))) {
Map unused = StandardTable.this.removeColumn(next);
z = true;
}
}
return z;
}
}
private class ColumnMapValues extends Maps.Values<C, Map<R, V>> {
ColumnMapValues() {
super(ColumnMap.this);
}
public boolean remove(@CheckForNull Object obj) {
for (Map.Entry entry : ColumnMap.this.entrySet()) {
if (((Map) entry.getValue()).equals(obj)) {
Map unused = StandardTable.this.removeColumn(entry.getKey());
return true;
}
}
return false;
}
public boolean removeAll(Collection<?> collection) {
Preconditions.checkNotNull(collection);
Iterator it = Lists.newArrayList(StandardTable.this.columnKeySet().iterator()).iterator();
boolean z = false;
while (it.hasNext()) {
Object next = it.next();
if (collection.contains(StandardTable.this.column(next))) {
Map unused = StandardTable.this.removeColumn(next);
z = true;
}
}
return z;
}
public boolean retainAll(Collection<?> collection) {
Preconditions.checkNotNull(collection);
Iterator it = Lists.newArrayList(StandardTable.this.columnKeySet().iterator()).iterator();
boolean z = false;
while (it.hasNext()) {
Object next = it.next();
if (!collection.contains(StandardTable.this.column(next))) {
Map unused = StandardTable.this.removeColumn(next);
z = true;
}
}
return z;
}
}
}
}
Download file