UnsignedLong.java 4.62 KB
package com.google.common.primitives;

import com.google.common.annotations.GwtCompatible;
import com.google.common.base.Preconditions;
import java.io.Serializable;
import java.math.BigInteger;
import javax.annotation.CheckReturnValue;
import javax.annotation.Nullable;

@GwtCompatible(serializable=true)
public final class UnsignedLong
  extends Number
  implements Serializable, Comparable<UnsignedLong>
{
  public static final UnsignedLong MAX_VALUE = new UnsignedLong(-1L);
  public static final UnsignedLong ONE;
  public static final UnsignedLong ZERO = new UnsignedLong(0L);
  private final long a;
  
  static
  {
    ONE = new UnsignedLong(1L);
  }
  
  private UnsignedLong(long paramLong)
  {
    this.a = paramLong;
  }
  
  public static UnsignedLong fromLongBits(long paramLong)
  {
    return new UnsignedLong(paramLong);
  }
  
  public static UnsignedLong valueOf(long paramLong)
  {
    if (paramLong >= 0L) {}
    for (boolean bool = true;; bool = false)
    {
      Preconditions.checkArgument(bool, "value (%s) is outside the range for an unsigned long value", new Object[] { Long.valueOf(paramLong) });
      return fromLongBits(paramLong);
    }
  }
  
  public static UnsignedLong valueOf(String paramString)
  {
    return valueOf(paramString, 10);
  }
  
  public static UnsignedLong valueOf(String paramString, int paramInt)
  {
    return fromLongBits(UnsignedLongs.parseUnsignedLong(paramString, paramInt));
  }
  
  public static UnsignedLong valueOf(BigInteger paramBigInteger)
  {
    Preconditions.checkNotNull(paramBigInteger);
    if ((paramBigInteger.signum() >= 0) && (paramBigInteger.bitLength() <= 64)) {}
    for (boolean bool = true;; bool = false)
    {
      Preconditions.checkArgument(bool, "value (%s) is outside the range for an unsigned long value", new Object[] { paramBigInteger });
      return fromLongBits(paramBigInteger.longValue());
    }
  }
  
  public final BigInteger bigIntegerValue()
  {
    BigInteger localBigInteger2 = BigInteger.valueOf(this.a & 0x7FFFFFFFFFFFFFFF);
    BigInteger localBigInteger1 = localBigInteger2;
    if (this.a < 0L) {
      localBigInteger1 = localBigInteger2.setBit(63);
    }
    return localBigInteger1;
  }
  
  public final int compareTo(UnsignedLong paramUnsignedLong)
  {
    Preconditions.checkNotNull(paramUnsignedLong);
    return UnsignedLongs.compare(this.a, paramUnsignedLong.a);
  }
  
  @CheckReturnValue
  public final UnsignedLong dividedBy(UnsignedLong paramUnsignedLong)
  {
    return fromLongBits(UnsignedLongs.divide(this.a, ((UnsignedLong)Preconditions.checkNotNull(paramUnsignedLong)).a));
  }
  
  public final double doubleValue()
  {
    double d2 = this.a & 0x7FFFFFFFFFFFFFFF;
    double d1 = d2;
    if (this.a < 0L) {
      d1 = d2 + 9.223372036854776E18D;
    }
    return d1;
  }
  
  public final boolean equals(@Nullable Object paramObject)
  {
    boolean bool2 = false;
    boolean bool1 = bool2;
    if ((paramObject instanceof UnsignedLong))
    {
      paramObject = (UnsignedLong)paramObject;
      bool1 = bool2;
      if (this.a == ((UnsignedLong)paramObject).a) {
        bool1 = true;
      }
    }
    return bool1;
  }
  
  public final float floatValue()
  {
    float f2 = (float)(this.a & 0x7FFFFFFFFFFFFFFF);
    float f1 = f2;
    if (this.a < 0L) {
      f1 = f2 + 9.223372E18F;
    }
    return f1;
  }
  
  public final int hashCode()
  {
    return Longs.hashCode(this.a);
  }
  
  public final int intValue()
  {
    return (int)this.a;
  }
  
  public final long longValue()
  {
    return this.a;
  }
  
  public final UnsignedLong minus(UnsignedLong paramUnsignedLong)
  {
    return fromLongBits(this.a - ((UnsignedLong)Preconditions.checkNotNull(paramUnsignedLong)).a);
  }
  
  @CheckReturnValue
  public final UnsignedLong mod(UnsignedLong paramUnsignedLong)
  {
    return fromLongBits(UnsignedLongs.remainder(this.a, ((UnsignedLong)Preconditions.checkNotNull(paramUnsignedLong)).a));
  }
  
  public final UnsignedLong plus(UnsignedLong paramUnsignedLong)
  {
    long l = this.a;
    return fromLongBits(((UnsignedLong)Preconditions.checkNotNull(paramUnsignedLong)).a + l);
  }
  
  @CheckReturnValue
  public final UnsignedLong times(UnsignedLong paramUnsignedLong)
  {
    long l = this.a;
    return fromLongBits(((UnsignedLong)Preconditions.checkNotNull(paramUnsignedLong)).a * l);
  }
  
  public final String toString()
  {
    return UnsignedLongs.toString(this.a);
  }
  
  public final String toString(int paramInt)
  {
    return UnsignedLongs.toString(this.a, paramInt);
  }
}


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