pq.java 4.6 KB
import com.google.common.annotations.GwtCompatible;
import com.google.common.base.Preconditions;
import com.google.common.collect.ImmutableCollection;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableSet;
import com.google.common.collect.ImmutableSet.Builder;
import com.google.common.collect.ImmutableTable;
import com.google.common.collect.Lists;
import com.google.common.collect.Table.Cell;
import com.google.common.collect.UnmodifiableIterator;
import java.util.Collections;
import java.util.Comparator;
import java.util.Iterator;
import java.util.List;
import javax.annotation.Nullable;

@GwtCompatible
public abstract class pq<R, C, V>
  extends ImmutableTable<R, C, V>
{
  public static final <R, C, V> pq<R, C, V> a(Iterable<Table.Cell<R, C, V>> paramIterable, @Nullable Comparator<? super R> paramComparator, @Nullable Comparator<? super C> paramComparator1)
  {
    Object localObject = ImmutableSet.builder();
    ImmutableSet.Builder localBuilder = ImmutableSet.builder();
    ImmutableList localImmutableList = ImmutableList.copyOf(paramIterable);
    paramIterable = localImmutableList.iterator();
    while (paramIterable.hasNext())
    {
      Table.Cell localCell = (Table.Cell)paramIterable.next();
      ((ImmutableSet.Builder)localObject).add(localCell.getRowKey());
      localBuilder.add(localCell.getColumnKey());
    }
    localObject = ((ImmutableSet.Builder)localObject).build();
    paramIterable = (Iterable<Table.Cell<R, C, V>>)localObject;
    if (paramComparator != null)
    {
      paramIterable = Lists.newArrayList((Iterable)localObject);
      Collections.sort(paramIterable, paramComparator);
      paramIterable = ImmutableSet.copyOf(paramIterable);
    }
    localObject = localBuilder.build();
    paramComparator = (Comparator<? super R>)localObject;
    if (paramComparator1 != null)
    {
      paramComparator = Lists.newArrayList((Iterable)localObject);
      Collections.sort(paramComparator, paramComparator1);
      paramComparator = ImmutableSet.copyOf(paramComparator);
    }
    if (localImmutableList.size() > paramIterable.size() * paramComparator.size() / 2L) {
      return new nr(localImmutableList, paramIterable, paramComparator);
    }
    return new qc(localImmutableList, paramIterable, paramComparator);
  }
  
  public static <R, C, V> pq<R, C, V> a(List<Table.Cell<R, C, V>> paramList, @Nullable Comparator<? super R> paramComparator, @Nullable final Comparator<? super C> paramComparator1)
  {
    Preconditions.checkNotNull(paramList);
    if ((paramComparator != null) || (paramComparator1 != null)) {
      Collections.sort(paramList, new Comparator() {});
    }
    return a(paramList, paramComparator, paramComparator1);
  }
  
  abstract Table.Cell<R, C, V> a(int paramInt);
  
  abstract V b(int paramInt);
  
  final ImmutableSet<Table.Cell<R, C, V>> e()
  {
    if (isEmpty()) {
      return ImmutableSet.of();
    }
    return new pq.a((byte)0);
  }
  
  final ImmutableCollection<V> f()
  {
    if (isEmpty()) {
      return ImmutableList.of();
    }
    return new pq.b((byte)0);
  }
  
  final class a
    extends ImmutableSet<Table.Cell<R, C, V>>
  {
    private a() {}
    
    final boolean a()
    {
      return false;
    }
    
    final ImmutableList<Table.Cell<R, C, V>> c()
    {
      new op()
      {
        final ImmutableCollection<Table.Cell<R, C, V>> b()
        {
          return pq.a.this;
        }
      };
    }
    
    public final boolean contains(@Nullable Object paramObject)
    {
      boolean bool2 = false;
      boolean bool1 = bool2;
      if ((paramObject instanceof Table.Cell))
      {
        paramObject = (Table.Cell)paramObject;
        Object localObject = pq.this.get(((Table.Cell)paramObject).getRowKey(), ((Table.Cell)paramObject).getColumnKey());
        bool1 = bool2;
        if (localObject != null)
        {
          bool1 = bool2;
          if (localObject.equals(((Table.Cell)paramObject).getValue())) {
            bool1 = true;
          }
        }
      }
      return bool1;
    }
    
    public final UnmodifiableIterator<Table.Cell<R, C, V>> iterator()
    {
      return asList().iterator();
    }
    
    public final int size()
    {
      return pq.this.size();
    }
  }
  
  final class b
    extends ImmutableList<V>
  {
    private b() {}
    
    final boolean a()
    {
      return true;
    }
    
    public final V get(int paramInt)
    {
      return (V)pq.this.b(paramInt);
    }
    
    public final int size()
    {
      return pq.this.size();
    }
  }
}


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