package com.google.common.collect; import com.google.android.gms.measurement.api.AppMeasurementSdk; import com.google.common.base.MoreObjects; import com.google.common.base.Preconditions; import com.google.common.collect.ImmutableList; import com.google.common.collect.Table; import com.google.common.collect.Tables; import java.io.Serializable; import java.util.Comparator; import java.util.Iterator; import java.util.List; import java.util.Map; /* loaded from: classes2.dex */ public abstract class ImmutableTable extends AbstractTable implements Serializable { @Override // com.google.common.collect.Table public abstract ImmutableMap> columnMap(); /* JADX INFO: Access modifiers changed from: package-private */ @Override // com.google.common.collect.AbstractTable public abstract ImmutableSet> createCellSet(); abstract SerializedForm createSerializedForm(); /* JADX INFO: Access modifiers changed from: package-private */ @Override // com.google.common.collect.AbstractTable public abstract ImmutableCollection createValues(); @Override // com.google.common.collect.Table public abstract ImmutableMap> rowMap(); /* JADX WARN: Multi-variable type inference failed */ @Override // com.google.common.collect.Table public /* bridge */ /* synthetic */ Map column(Object obj) { return column((ImmutableTable) obj); } @Override // com.google.common.collect.AbstractTable, com.google.common.collect.Table public /* bridge */ /* synthetic */ boolean containsColumn(Object obj) { return super.containsColumn(obj); } @Override // com.google.common.collect.AbstractTable, com.google.common.collect.Table public /* bridge */ /* synthetic */ boolean containsRow(Object obj) { return super.containsRow(obj); } @Override // com.google.common.collect.AbstractTable, com.google.common.collect.Table public /* bridge */ /* synthetic */ boolean equals(Object obj) { return super.equals(obj); } @Override // com.google.common.collect.AbstractTable, com.google.common.collect.Table public /* bridge */ /* synthetic */ Object get(Object obj, Object obj2) { return super.get(obj, obj2); } @Override // com.google.common.collect.AbstractTable, com.google.common.collect.Table public /* bridge */ /* synthetic */ int hashCode() { return super.hashCode(); } @Override // com.google.common.collect.AbstractTable, com.google.common.collect.Table public /* bridge */ /* synthetic */ boolean isEmpty() { return super.isEmpty(); } /* JADX WARN: Multi-variable type inference failed */ @Override // com.google.common.collect.Table public /* bridge */ /* synthetic */ Map row(Object obj) { return row((ImmutableTable) obj); } @Override // com.google.common.collect.AbstractTable public /* bridge */ /* synthetic */ String toString() { return super.toString(); } public static ImmutableTable of() { return (ImmutableTable) SparseImmutableTable.EMPTY; } public static ImmutableTable of(R r, C c, V v) { return new SingletonImmutableTable(r, c, v); } public static ImmutableTable copyOf(Table table) { if (table instanceof ImmutableTable) { return (ImmutableTable) table; } return copyOf(table.cellSet()); } static ImmutableTable copyOf(Iterable> iterable) { Builder builder = builder(); Iterator> it = iterable.iterator(); while (it.hasNext()) { builder.put(it.next()); } return builder.build(); } public static Builder builder() { return new Builder<>(); } /* JADX INFO: Access modifiers changed from: package-private */ public static Table.Cell cellOf(R r, C c, V v) { return Tables.immutableCell(Preconditions.checkNotNull(r, "rowKey"), Preconditions.checkNotNull(c, "columnKey"), Preconditions.checkNotNull(v, AppMeasurementSdk.ConditionalUserProperty.VALUE)); } /* loaded from: classes2.dex */ public static final class Builder { private final List> cells = Lists.newArrayList(); private Comparator columnComparator; private Comparator rowComparator; public final Builder orderRowsBy(Comparator comparator) { this.rowComparator = (Comparator) Preconditions.checkNotNull(comparator, "rowComparator"); return this; } public final Builder orderColumnsBy(Comparator comparator) { this.columnComparator = (Comparator) Preconditions.checkNotNull(comparator, "columnComparator"); return this; } public final Builder put(R r, C c, V v) { this.cells.add(ImmutableTable.cellOf(r, c, v)); return this; } public final Builder put(Table.Cell cell) { if (cell instanceof Tables.ImmutableCell) { Preconditions.checkNotNull(cell.getRowKey(), "row"); Preconditions.checkNotNull(cell.getColumnKey(), "column"); Preconditions.checkNotNull(cell.getValue(), AppMeasurementSdk.ConditionalUserProperty.VALUE); this.cells.add(cell); } else { put(cell.getRowKey(), cell.getColumnKey(), cell.getValue()); } return this; } public final Builder putAll(Table table) { Iterator> it = table.cellSet().iterator(); while (it.hasNext()) { put(it.next()); } return this; } final Builder combine(Builder builder) { this.cells.addAll(builder.cells); return this; } public final ImmutableTable build() { int size = this.cells.size(); if (size == 0) { return ImmutableTable.of(); } if (size == 1) { return new SingletonImmutableTable((Table.Cell) Iterables.getOnlyElement(this.cells)); } return RegularImmutableTable.forCells(this.cells, this.rowComparator, this.columnComparator); } } @Override // com.google.common.collect.AbstractTable, com.google.common.collect.Table public ImmutableSet> cellSet() { return (ImmutableSet) super.cellSet(); } /* JADX INFO: Access modifiers changed from: package-private */ @Override // com.google.common.collect.AbstractTable public final UnmodifiableIterator> cellIterator() { throw new AssertionError("should never be called"); } @Override // com.google.common.collect.AbstractTable, com.google.common.collect.Table public ImmutableCollection values() { return (ImmutableCollection) super.values(); } @Override // com.google.common.collect.AbstractTable final Iterator valuesIterator() { throw new AssertionError("should never be called"); } @Override // com.google.common.collect.Table public ImmutableMap column(C c) { Preconditions.checkNotNull(c, "columnKey"); return (ImmutableMap) MoreObjects.firstNonNull((ImmutableMap) columnMap().get(c), ImmutableMap.of()); } @Override // com.google.common.collect.AbstractTable, com.google.common.collect.Table public ImmutableSet columnKeySet() { return columnMap().keySet(); } @Override // com.google.common.collect.Table public ImmutableMap row(R r) { Preconditions.checkNotNull(r, "rowKey"); return (ImmutableMap) MoreObjects.firstNonNull((ImmutableMap) rowMap().get(r), ImmutableMap.of()); } @Override // com.google.common.collect.AbstractTable, com.google.common.collect.Table public ImmutableSet rowKeySet() { return rowMap().keySet(); } @Override // com.google.common.collect.AbstractTable, com.google.common.collect.Table public boolean contains(Object obj, Object obj2) { return get(obj, obj2) != null; } @Override // com.google.common.collect.AbstractTable, com.google.common.collect.Table public boolean containsValue(Object obj) { return values().contains(obj); } @Override // com.google.common.collect.AbstractTable, com.google.common.collect.Table @Deprecated public final void clear() { throw new UnsupportedOperationException(); } @Override // com.google.common.collect.AbstractTable, com.google.common.collect.Table @Deprecated public final V put(R r, C c, V v) { throw new UnsupportedOperationException(); } @Override // com.google.common.collect.AbstractTable, com.google.common.collect.Table @Deprecated public final void putAll(Table table) { throw new UnsupportedOperationException(); } @Override // com.google.common.collect.AbstractTable, com.google.common.collect.Table @Deprecated public final V remove(Object obj, Object obj2) { throw new UnsupportedOperationException(); } /* loaded from: classes2.dex */ static final class SerializedForm implements Serializable { private static final long serialVersionUID = 0; private final int[] cellColumnIndices; private final int[] cellRowIndices; private final Object[] cellValues; private final Object[] columnKeys; private final Object[] rowKeys; private SerializedForm(Object[] objArr, Object[] objArr2, Object[] objArr3, int[] iArr, int[] iArr2) { this.rowKeys = objArr; this.columnKeys = objArr2; this.cellValues = objArr3; this.cellRowIndices = iArr; this.cellColumnIndices = iArr2; } /* JADX INFO: Access modifiers changed from: package-private */ public static SerializedForm create(ImmutableTable immutableTable, int[] iArr, int[] iArr2) { return new SerializedForm(immutableTable.rowKeySet().toArray(), immutableTable.columnKeySet().toArray(), immutableTable.values().toArray(), iArr, iArr2); } final Object readResolve() { Object[] objArr = this.cellValues; if (objArr.length == 0) { return ImmutableTable.of(); } int i = 0; if (objArr.length == 1) { return ImmutableTable.of(this.rowKeys[0], this.columnKeys[0], objArr[0]); } ImmutableList.Builder builder = new ImmutableList.Builder(objArr.length); while (true) { Object[] objArr2 = this.cellValues; if (i < objArr2.length) { builder.add((ImmutableList.Builder) ImmutableTable.cellOf(this.rowKeys[this.cellRowIndices[i]], this.columnKeys[this.cellColumnIndices[i]], objArr2[i])); i++; } else { return RegularImmutableTable.forOrderedComponents(builder.build(), ImmutableSet.copyOf(this.rowKeys), ImmutableSet.copyOf(this.columnKeys)); } } } } final Object writeReplace() { return createSerializedForm(); } }