@Test public void parseCoin() { assertEquals(13370000, BTC.value("0.1337").value); assertEquals(13370000, BTC.value(".1337").value); assertEquals(133700000, BTC.value("1.337").value); assertEquals(133700, BTC.value("0.001337").value); assertEquals(1337000, PPC.value("1.337").value); assertEquals(1337, PPC.value("0.001337").value); assertEquals(13370, NBT.value("1.337").value); assertEquals(13, NBT.value("0.0013").value); }
Value(final ValueType type, final long units) { this.type = checkNotNull(type); this.value = units; }
Value implements Monetary, Comparable<Value>, Serializable { Value(final ValueType type, final long units) { this.type = checkNotNull(type); this.value = units; } }
Value implements Monetary, Comparable<Value>, Serializable { Value(final ValueType type, final long units) { this.type = checkNotNull(type); this.value = units; } Value(final ValueType type, final long units); }
Value implements Monetary, Comparable<Value>, Serializable { Value(final ValueType type, final long units) { this.type = checkNotNull(type); this.value = units; } Value(final ValueType type, final long units); static Value valueOf(final ValueType type, final long units); static Value valueOf(final ValueType type, final Coin coin); @Override int smallestUnitExponent(); @Override long getValue(); Coin toCoin(); static Value valueOf(final ValueType type, final int coins, final int cents); static Value parse(final ValueType type, final String str); static Value parse(final ValueType type, final BigDecimal decimal); Value add(final Value value); Value add(final Coin value); Value subtract(final Value value); Value subtract(String str); Value multiply(final long factor); Value divide(final long divisor); Value[] divideAndRemainder(final long divisor); long divide(final Value divisor); boolean isPositive(); boolean isNegative(); boolean isZero(); boolean isGreaterThan(Value other); boolean isLessThan(Value other); Value shiftLeft(final int n); Value shiftRight(final int n); @Override int signum(); Value negate(); String toFriendlyString(); String toPlainString(); @Override String toString(); @Override boolean equals(final Object o); @Override int hashCode(); @Override int compareTo(@Nonnull final Value other); boolean isDust(); boolean isOfType(ValueType otherType); boolean isOfType(Value otherValue); boolean within(Value min, Value max); static Value max(Value value1, Value value2); static Value min(Value value1, Value value2); boolean canCompare(Value other); static boolean canCompare(@Nullable Value amount1, @Nullable Value amount2); }
Value implements Monetary, Comparable<Value>, Serializable { Value(final ValueType type, final long units) { this.type = checkNotNull(type); this.value = units; } Value(final ValueType type, final long units); static Value valueOf(final ValueType type, final long units); static Value valueOf(final ValueType type, final Coin coin); @Override int smallestUnitExponent(); @Override long getValue(); Coin toCoin(); static Value valueOf(final ValueType type, final int coins, final int cents); static Value parse(final ValueType type, final String str); static Value parse(final ValueType type, final BigDecimal decimal); Value add(final Value value); Value add(final Coin value); Value subtract(final Value value); Value subtract(String str); Value multiply(final long factor); Value divide(final long divisor); Value[] divideAndRemainder(final long divisor); long divide(final Value divisor); boolean isPositive(); boolean isNegative(); boolean isZero(); boolean isGreaterThan(Value other); boolean isLessThan(Value other); Value shiftLeft(final int n); Value shiftRight(final int n); @Override int signum(); Value negate(); String toFriendlyString(); String toPlainString(); @Override String toString(); @Override boolean equals(final Object o); @Override int hashCode(); @Override int compareTo(@Nonnull final Value other); boolean isDust(); boolean isOfType(ValueType otherType); boolean isOfType(Value otherValue); boolean within(Value min, Value max); static Value max(Value value1, Value value2); static Value min(Value value1, Value value2); boolean canCompare(Value other); static boolean canCompare(@Nullable Value amount1, @Nullable Value amount2); final ValueType type; final long value; }