jimu-decompiled/sources/com/google/common/collect/AbstractTable.java
2025-05-13 19:24:51 +02:00

190 lines
5.7 KiB
Java

package com.google.common.collect;
import com.google.common.collect.Table;
import java.util.AbstractCollection;
import java.util.AbstractSet;
import java.util.Collection;
import java.util.Iterator;
import java.util.Map;
import java.util.Set;
/* loaded from: classes.dex */
abstract class AbstractTable<R, C, V> implements Table<R, C, V> {
private transient Set<Table.Cell<R, C, V>> cellSet;
private transient Collection<V> values;
class CellSet extends AbstractSet<Table.Cell<R, C, V>> {
CellSet() {
}
@Override // java.util.AbstractCollection, java.util.Collection, java.util.Set
public void clear() {
AbstractTable.this.clear();
}
@Override // java.util.AbstractCollection, java.util.Collection, java.util.Set
public boolean contains(Object obj) {
if (!(obj instanceof Table.Cell)) {
return false;
}
Table.Cell cell = (Table.Cell) obj;
Map map = (Map) Maps.e(AbstractTable.this.rowMap(), cell.b());
return map != null && Collections2.a(map.entrySet(), Maps.a(cell.a(), cell.getValue()));
}
@Override // java.util.AbstractCollection, java.util.Collection, java.lang.Iterable, java.util.Set
public Iterator<Table.Cell<R, C, V>> iterator() {
return AbstractTable.this.cellIterator();
}
@Override // java.util.AbstractCollection, java.util.Collection, java.util.Set
public boolean remove(Object obj) {
if (!(obj instanceof Table.Cell)) {
return false;
}
Table.Cell cell = (Table.Cell) obj;
Map map = (Map) Maps.e(AbstractTable.this.rowMap(), cell.b());
return map != null && Collections2.b(map.entrySet(), Maps.a(cell.a(), cell.getValue()));
}
@Override // java.util.AbstractCollection, java.util.Collection, java.util.Set
public int size() {
return AbstractTable.this.size();
}
}
class Values extends AbstractCollection<V> {
Values() {
}
@Override // java.util.AbstractCollection, java.util.Collection
public void clear() {
AbstractTable.this.clear();
}
@Override // java.util.AbstractCollection, java.util.Collection
public boolean contains(Object obj) {
return AbstractTable.this.containsValue(obj);
}
@Override // java.util.AbstractCollection, java.util.Collection, java.lang.Iterable
public Iterator<V> iterator() {
return AbstractTable.this.valuesIterator();
}
@Override // java.util.AbstractCollection, java.util.Collection
public int size() {
return AbstractTable.this.size();
}
}
AbstractTable() {
}
abstract Iterator<Table.Cell<R, C, V>> cellIterator();
@Override // com.google.common.collect.Table
public Set<Table.Cell<R, C, V>> cellSet() {
Set<Table.Cell<R, C, V>> set = this.cellSet;
if (set != null) {
return set;
}
Set<Table.Cell<R, C, V>> createCellSet = createCellSet();
this.cellSet = createCellSet;
return createCellSet;
}
public abstract void clear();
@Override // com.google.common.collect.Table
public abstract Set<C> columnKeySet();
public boolean contains(Object obj, Object obj2) {
Map map = (Map) Maps.e(rowMap(), obj);
return map != null && Maps.d(map, obj2);
}
public boolean containsColumn(Object obj) {
return Maps.d(columnMap(), obj);
}
public boolean containsRow(Object obj) {
return Maps.d(rowMap(), obj);
}
public boolean containsValue(Object obj) {
Iterator<Map<C, V>> it = rowMap().values().iterator();
while (it.hasNext()) {
if (it.next().containsValue(obj)) {
return true;
}
}
return false;
}
Set<Table.Cell<R, C, V>> createCellSet() {
return new CellSet();
}
Collection<V> createValues() {
return new Values();
}
public boolean equals(Object obj) {
return Tables.a(this, obj);
}
public V get(Object obj, Object obj2) {
Map map = (Map) Maps.e(rowMap(), obj);
if (map == null) {
return null;
}
return (V) Maps.e(map, obj2);
}
public int hashCode() {
return cellSet().hashCode();
}
public boolean isEmpty() {
return size() == 0;
}
public abstract V put(R r, C c, V v);
public void putAll(Table<? extends R, ? extends C, ? extends V> table) {
for (Table.Cell<? extends R, ? extends C, ? extends V> cell : table.cellSet()) {
put(cell.b(), cell.a(), cell.getValue());
}
}
public abstract V remove(Object obj, Object obj2);
@Override // com.google.common.collect.Table
public abstract Set<R> rowKeySet();
public String toString() {
return rowMap().toString();
}
public Collection<V> values() {
Collection<V> collection = this.values;
if (collection != null) {
return collection;
}
Collection<V> createValues = createValues();
this.values = createValues;
return createValues;
}
Iterator<V> valuesIterator() {
return new TransformedIterator<Table.Cell<R, C, V>, V>(this, cellSet().iterator()) { // from class: com.google.common.collect.AbstractTable.1
/* JADX INFO: Access modifiers changed from: package-private */
@Override // com.google.common.collect.TransformedIterator
public V a(Table.Cell<R, C, V> cell) {
return cell.getValue();
}
};
}
}