public Value getFeeValue() { if (feeProvider != null) { return feeProvider.getFeeValue(this); } else { return getDefaultFeeValue(); } }
/** * Parses an amount expressed in the way humans are used to.<p> * <p/> * This takes string in a format understood by {@link java.math.BigDecimal#BigDecimal(String)}, * for example "0", "1", "0.10", "1.23E3", "1234.5E-5". * * @throws IllegalArgumentException if you try to specify fractional units, or a value out of range. */ public static Value parse(final String currencyCode, final String str) { return Value.parse(FiatType.get(currencyCode), str); } }
@Test public void testEquals() { Value btcSatoshi = Value.valueOf(BitcoinMain.get(), 1); Value btcSatoshi2 = Value.valueOf(BitcoinMain.get(), 1); Value btcValue = Value.parse(BitcoinMain.get(), "3.14159"); Value ltcSatoshi = Value.valueOf(LitecoinMain.get(), 1); Value ppcValue = Value.parse(PeercoinMain.get(), "3.14159"); assertTrue(btcSatoshi.equals(btcSatoshi2)); assertFalse(btcSatoshi.equals(ltcSatoshi)); assertFalse(btcSatoshi.equals(btcValue)); assertFalse(btcSatoshi.equals(ppcValue)); assertFalse(btcValue.equals(ppcValue)); }
public TransactionCreator(TransactionWatcherWallet account) { this.account = account; lock = account.lock; coinType = account.type; minNonDust = coinType.getMinNonDust().toCoin(); softDustLimit = coinType.getSoftDustLimit().toCoin(); }
@Override public String toString() { return toPlainString() + type.getSymbol(); }
public boolean isDust() { return compareTo(type.getMinNonDust()) < 0; }
/** * Returns true if and only if this instance represents zero monetary value, * otherwise false. */ public boolean isZero() { return signum() == 0; }
/** * Returns true if the monetary value represented by this instance is greater than that * of the given other Value, otherwise false. */ public boolean isGreaterThan(Value other) { return compareTo(other) > 0; }
public ShapeShiftExchangeRate(ValueType depositType, ValueType withdrawType, String rateString, String minerFeeString) { super(depositType, withdrawType, rateString); if (minerFeeString != null) { minerFee = withdrawType.value(minerFeeString); } else { minerFee = null; } }
@Override public int hashCode() { int result = type.hashCode(); result = 31 * result + (int) (accountId ^ (accountId >>> 32)); return result; } }
private void setupFeeProvider() { CoinType.setFeeProvider(new CoinType.FeeProvider() { @Override public Value getFeeValue(CoinType type) { return config.getFeeValue(type); } }); }
/** * Returns true if and only if this instance represents a monetary value greater than zero, * otherwise false. */ public boolean isPositive() { return signum() == 1; }
/** * Returns true if the monetary value represented by this instance is less than that * of the given other Value, otherwise false. */ public boolean isLessThan(Value other) { return compareTo(other) < 0; }
/** * Returns true if and only if this instance represents a monetary value less than zero, * otherwise false. */ public boolean isNegative() { return signum() == -1; }