mv.java 5.22 KB
import com.google.common.annotations.GwtCompatible;
import com.google.common.annotations.GwtIncompatible;
import com.google.common.base.Preconditions;
import com.google.common.collect.Maps;
import com.google.common.collect.Multiset.Entry;
import com.google.common.collect.Multisets.a;
import com.google.common.primitives.Ints;
import java.io.Serializable;
import java.util.Collection;
import java.util.ConcurrentModificationException;
import java.util.Iterator;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;
import javax.annotation.Nullable;

@GwtCompatible(emulated=true)
public abstract class mv<E>
  extends my<E>
  implements Serializable
{
  @GwtIncompatible("not needed in emulated source.")
  private static final long serialVersionUID = -2250766705698539974L;
  protected transient Map<E, np> a;
  private transient long b;
  
  protected mv(Map<E, np> paramMap)
  {
    this.a = ((Map)Preconditions.checkNotNull(paramMap));
    this.b = super.size();
  }
  
  private static int a(np paramnp, int paramInt)
  {
    if (paramnp == null) {
      return 0;
    }
    return paramnp.b(paramInt);
  }
  
  final Iterator<Multiset.Entry<E>> a()
  {
    new Iterator()
    {
      Map.Entry<E, np> a;
      
      public final boolean hasNext()
      {
        return this.b.hasNext();
      }
      
      public final void remove()
      {
        if (this.a != null) {}
        for (boolean bool = true;; bool = false)
        {
          Preconditions.checkState(bool, "no calls to next() since the last call to remove()");
          mv.a(mv.this, ((np)this.a.getValue()).b(0));
          this.b.remove();
          this.a = null;
          return;
        }
      }
    };
  }
  
  public int add(@Nullable E paramE, int paramInt)
  {
    int i = 0;
    if (paramInt == 0) {
      return count(paramE);
    }
    if (paramInt > 0) {}
    np localnp;
    for (boolean bool = true;; bool = false)
    {
      Preconditions.checkArgument(bool, "occurrences cannot be negative: %s", new Object[] { Integer.valueOf(paramInt) });
      localnp = (np)this.a.get(paramE);
      if (localnp != null) {
        break;
      }
      this.a.put(paramE, new np(paramInt));
      this.b += paramInt;
      return i;
    }
    i = localnp.a;
    long l = i + paramInt;
    if (l <= 2147483647L) {}
    for (bool = true;; bool = false)
    {
      Preconditions.checkArgument(bool, "too many occurrences: %s", new Object[] { Long.valueOf(l) });
      localnp.a += paramInt;
      break;
    }
  }
  
  final int b()
  {
    return this.a.size();
  }
  
  public void clear()
  {
    Iterator localIterator = this.a.values().iterator();
    while (localIterator.hasNext()) {
      ((np)localIterator.next()).a = 0;
    }
    this.a.clear();
    this.b = 0L;
  }
  
  public int count(@Nullable Object paramObject)
  {
    paramObject = (np)Maps.a(this.a, paramObject);
    if (paramObject == null) {
      return 0;
    }
    return ((np)paramObject).a;
  }
  
  public Set<Multiset.Entry<E>> entrySet()
  {
    return super.entrySet();
  }
  
  public Iterator<E> iterator()
  {
    return new mv.a();
  }
  
  public int remove(@Nullable Object paramObject, int paramInt)
  {
    int i = 0;
    if (paramInt == 0)
    {
      i = count(paramObject);
      return i;
    }
    if (paramInt > 0) {}
    for (boolean bool = true;; bool = false)
    {
      Preconditions.checkArgument(bool, "occurrences cannot be negative: %s", new Object[] { Integer.valueOf(paramInt) });
      np localnp = (np)this.a.get(paramObject);
      if (localnp == null) {
        break;
      }
      int j = localnp.a;
      i = paramInt;
      if (j <= paramInt)
      {
        this.a.remove(paramObject);
        i = j;
      }
      localnp.a(-i);
      this.b -= i;
      return j;
    }
  }
  
  public int setCount(@Nullable E paramE, int paramInt)
  {
    nj.a(paramInt, "count");
    int i;
    if (paramInt == 0) {
      i = a((np)this.a.remove(paramE), paramInt);
    }
    for (;;)
    {
      this.b += paramInt - i;
      return i;
      np localnp = (np)this.a.get(paramE);
      i = a(localnp, paramInt);
      if (localnp == null) {
        this.a.put(paramE, new np(paramInt));
      }
    }
  }
  
  public int size()
  {
    return Ints.saturatedCast(this.b);
  }
  
  final class a
    implements Iterator<E>
  {
    final Iterator<Map.Entry<E, np>> a = mv.a(mv.this).entrySet().iterator();
    Map.Entry<E, np> b;
    int c;
    boolean d;
    
    a() {}
    
    public final boolean hasNext()
    {
      return (this.c > 0) || (this.a.hasNext());
    }
    
    public final E next()
    {
      if (this.c == 0)
      {
        this.b = ((Map.Entry)this.a.next());
        this.c = ((np)this.b.getValue()).a;
      }
      this.c -= 1;
      this.d = true;
      return (E)this.b.getKey();
    }
    
    public final void remove()
    {
      Preconditions.checkState(this.d, "no calls to next() since the last call to remove()");
      if (((np)this.b.getValue()).a <= 0) {
        throw new ConcurrentModificationException();
      }
      if (((np)this.b.getValue()).a(-1) == 0) {
        this.a.remove();
      }
      mv.b(mv.this);
      this.d = false;
    }
  }
}


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