nr.java 6.29 KB
import com.google.common.annotations.GwtCompatible;
import com.google.common.base.Preconditions;
import com.google.common.collect.AbstractIterator;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.ImmutableMap.Builder;
import com.google.common.collect.ImmutableSet;
import com.google.common.collect.Table.Cell;
import com.google.common.collect.UnmodifiableIterator;
import java.lang.reflect.Array;
import java.util.Iterator;
import java.util.Map;
import java.util.Map.Entry;
import javax.annotation.Nullable;
import javax.annotation.concurrent.Immutable;

@GwtCompatible
@Immutable
final class nr<R, C, V>
  extends pq<R, C, V>
{
  private final ImmutableMap<R, Integer> a;
  private final ImmutableMap<C, Integer> b;
  private final ImmutableMap<R, Map<C, V>> c;
  private final ImmutableMap<C, Map<R, V>> d;
  private final int[] e;
  private final int[] f;
  private final V[][] g;
  private final int[] h;
  private final int[] i;
  
  nr(ImmutableList<Table.Cell<R, C, V>> paramImmutableList, ImmutableSet<R> paramImmutableSet, ImmutableSet<C> paramImmutableSet1)
  {
    this.g = ((Object[][])Array.newInstance(Object.class, new int[] { paramImmutableSet.size(), paramImmutableSet1.size() }));
    this.a = a(paramImmutableSet);
    this.b = a(paramImmutableSet1);
    this.e = new int[this.a.size()];
    this.f = new int[this.b.size()];
    paramImmutableSet = new int[paramImmutableList.size()];
    paramImmutableSet1 = new int[paramImmutableList.size()];
    int j = 0;
    if (j < paramImmutableList.size())
    {
      Object localObject1 = (Table.Cell)paramImmutableList.get(j);
      Object localObject2 = ((Table.Cell)localObject1).getRowKey();
      Object localObject3 = ((Table.Cell)localObject1).getColumnKey();
      int k = ((Integer)this.a.get(localObject2)).intValue();
      int m = ((Integer)this.b.get(localObject3)).intValue();
      if (this.g[k][m] == null) {}
      for (boolean bool = true;; bool = false)
      {
        Preconditions.checkArgument(bool, "duplicate key: (%s, %s)", new Object[] { localObject2, localObject3 });
        this.g[k][m] = ((Table.Cell)localObject1).getValue();
        localObject1 = this.e;
        localObject1[k] += 1;
        localObject1 = this.f;
        localObject1[m] += 1;
        paramImmutableSet[j] = k;
        paramImmutableSet1[j] = m;
        j += 1;
        break;
      }
    }
    this.h = paramImmutableSet;
    this.i = paramImmutableSet1;
    this.c = new nr.e((byte)0);
    this.d = new nr.b((byte)0);
  }
  
  private static <E> ImmutableMap<E, Integer> a(ImmutableSet<E> paramImmutableSet)
  {
    ImmutableMap.Builder localBuilder = ImmutableMap.builder();
    int j = 0;
    paramImmutableSet = paramImmutableSet.iterator();
    while (paramImmutableSet.hasNext())
    {
      localBuilder.put(paramImmutableSet.next(), Integer.valueOf(j));
      j += 1;
    }
    return localBuilder.build();
  }
  
  final Table.Cell<R, C, V> a(int paramInt)
  {
    int j = this.h[paramInt];
    paramInt = this.i[paramInt];
    return a(rowKeySet().asList().get(j), columnKeySet().asList().get(paramInt), this.g[j][paramInt]);
  }
  
  final V b(int paramInt)
  {
    return (V)this.g[this.h[paramInt]][this.i[paramInt]];
  }
  
  public final ImmutableMap<C, Map<R, V>> columnMap()
  {
    return this.d;
  }
  
  public final V get(@Nullable Object paramObject1, @Nullable Object paramObject2)
  {
    paramObject1 = (Integer)this.a.get(paramObject1);
    paramObject2 = (Integer)this.b.get(paramObject2);
    if ((paramObject1 == null) || (paramObject2 == null)) {
      return null;
    }
    return (V)this.g[paramObject1.intValue()][paramObject2.intValue()];
  }
  
  public final ImmutableMap<R, Map<C, V>> rowMap()
  {
    return this.c;
  }
  
  public final int size()
  {
    return this.h.length;
  }
  
  final class a
    extends nr.c<R, V>
  {
    private final int b;
    
    a(int paramInt)
    {
      super();
      this.b = paramInt;
    }
    
    final ImmutableMap<R, Integer> a()
    {
      return nr.e(nr.this);
    }
    
    final V a(int paramInt)
    {
      return (V)nr.c(nr.this)[paramInt][this.b];
    }
    
    final boolean b()
    {
      return true;
    }
  }
  
  final class b
    extends nr.c<C, Map<R, V>>
  {
    private b()
    {
      super();
    }
    
    final ImmutableMap<C, Integer> a()
    {
      return nr.b(nr.this);
    }
    
    final boolean b()
    {
      return false;
    }
  }
  
  static abstract class c<K, V>
    extends ImmutableMap<K, V>
  {
    private final int a;
    
    c(int paramInt)
    {
      this.a = paramInt;
    }
    
    abstract ImmutableMap<K, Integer> a();
    
    @Nullable
    abstract V a(int paramInt);
    
    final ImmutableSet<K> c()
    {
      if (this.a == a().size()) {}
      for (int i = 1; i != 0; i = 0) {
        return a().keySet();
      }
      return super.c();
    }
    
    final ImmutableSet<Map.Entry<K, V>> d()
    {
      new ou()
      {
        final ImmutableMap<K, V> b()
        {
          return nr.c.this;
        }
        
        public final UnmodifiableIterator<Map.Entry<K, V>> iterator()
        {
          new AbstractIterator()
          {
            private int b = -1;
            private final int c = nr.c.this.a().size();
          };
        }
      };
    }
    
    public V get(@Nullable Object paramObject)
    {
      paramObject = (Integer)a().get(paramObject);
      if (paramObject == null) {
        return null;
      }
      return (V)a(((Integer)paramObject).intValue());
    }
    
    public int size()
    {
      return this.a;
    }
  }
  
  final class d
    extends nr.c<C, V>
  {
    private final int b;
    
    d(int paramInt)
    {
      super();
      this.b = paramInt;
    }
    
    final ImmutableMap<C, Integer> a()
    {
      return nr.b(nr.this);
    }
    
    final V a(int paramInt)
    {
      return (V)nr.c(nr.this)[this.b][paramInt];
    }
    
    final boolean b()
    {
      return true;
    }
  }
  
  final class e
    extends nr.c<R, Map<C, V>>
  {
    private e()
    {
      super();
    }
    
    final ImmutableMap<R, Integer> a()
    {
      return nr.e(nr.this);
    }
    
    final boolean b()
    {
      return false;
    }
  }
}


/* Location:              /home/merong/decompile/hackery-dex2jar.jar!/nr.class
 * Java compiler version: 6 (50.0)
 * JD-Core Version:       0.7.1
 */