Example usage for java.util Currency equals

List of usage examples for java.util Currency equals

Introduction

In this page you can find the example usage for java.util Currency equals.

Prototype

public boolean equals(Object obj) 

Source Link

Document

Indicates whether some other object is "equal to" this one.

Usage

From source file:net.sourceforge.eclipsetrader.core.CurrencyConverter.java

public double convert(double amount, Currency from, Currency to) {
    if (from == null || to == null || from.equals(to))
        return amount;
    return convert(null, amount, from.getCurrencyCode(), to.getCurrencyCode());
}

From source file:net.sourceforge.eclipsetrader.core.CurrencyConverter.java

public double convert(Date date, double amount, Currency from, Currency to) {
    if (from == null || to == null || from.equals(to))
        return amount;
    return convert(date, amount, from.getCurrencyCode(), to.getCurrencyCode());
}

From source file:net.sourceforge.eclipsetrader.core.CurrencyConverter.java

public double convert(Double amount, Currency from, Currency to) {
    if (from == null || to == null || from.equals(to))
        return amount.doubleValue();
    return convert(null, amount.doubleValue(), from.getCurrencyCode(), to.getCurrencyCode());
}

From source file:net.sourceforge.eclipsetrader.core.CurrencyConverter.java

public double convert(Date date, Double amount, Currency from, Currency to) {
    if (from == null || to == null || from.equals(to))
        return amount.doubleValue();
    return convert(date, amount.doubleValue(), from.getCurrencyCode(), to.getCurrencyCode());
}

From source file:net.sourceforge.eclipsetrader.core.CurrencyConverter.java

public void setExchangeRatio(Currency from, Currency to, double ratio) {
    if (from != null && to != null && !from.equals(to))
        setExchangeRatio(from.getCurrencyCode(), to.getCurrencyCode(), ratio);
}

From source file:org.totschnig.myexpenses.activity.ExpenseEdit.java

private void configureTransferInput() {
    final Account transferAccount = Account.getInstanceFromDb(mTransferAccountSpinner.getSelectedItemId());
    final Currency currency = getCurrentAccount().currency;
    final boolean isSame = currency.equals(transferAccount.currency);
    findViewById(R.id.TransferAmountRow).setVisibility(isSame ? View.GONE : View.VISIBLE);
    findViewById(R.id.ExchangeRateRow)//from w ww  .j  av  a  2  s .c o m
            .setVisibility(isSame || (mTransaction instanceof Template) ? View.GONE : View.VISIBLE);
    final String symbol2 = transferAccount.currency.getSymbol();
    //noinspection SetTextI18n
    addCurrencyToLabel((TextView) findViewById(R.id.TransferAmountLabel), symbol2);
    mTransferAmountText.setFractionDigits(Money.getFractionDigits(transferAccount.currency));
    final String symbol1 = currency.getSymbol();
    ((TextView) findViewById(R.id.ExchangeRateLabel_1_1)).setText(String.format("1 %s =", symbol1));
    ((TextView) findViewById(R.id.ExchangeRateLabel_1_2)).setText(symbol2);
    ((TextView) findViewById(R.id.ExchangeRateLabel_2_1)).setText(String.format("1 %s =", symbol2));
    ((TextView) findViewById(R.id.ExchangeRateLabel_2_2)).setText(symbol1);

    Bundle bundle = new Bundle(2);
    bundle.putStringArray(KEY_CURRENCY,
            new String[] { currency.getCurrencyCode(), transferAccount.currency.getCurrencyCode() });
    if (!isSame && !mSavedInstance && (mNewInstance || mPlanInstanceId == -1)
            && !(mTransaction instanceof Template)) {
        mManager.restartLoader(LAST_EXCHANGE_CURSOR, bundle, this);
    }
}