Remove dead Code from BSFormatter

This commit is contained in:
Justin Carter 2019-09-11 16:29:46 +02:00
parent df6812a4c9
commit 06c2fa5ea0
No known key found for this signature in database
GPG Key ID: 4B8BB0D3F5018030

View File

@ -104,47 +104,6 @@ public class BSFormatter {
return FormattingUtils.formatCoinWithCode(Coin.valueOf(value), monetaryFormat); return FormattingUtils.formatCoinWithCode(Coin.valueOf(value), monetaryFormat);
} }
///////////////////////////////////////////////////////////////////////////////////////////
// FIAT
///////////////////////////////////////////////////////////////////////////////////////////
private static Fiat parseToFiat(String input, String currencyCode) {
if (input != null && input.length() > 0) {
try {
return Fiat.parseFiat(currencyCode, ParsingUtils.cleanDoubleInput(input));
} catch (Exception e) {
log.warn("Exception at parseToFiat: " + e.toString());
return Fiat.valueOf(currencyCode, 0);
}
} else {
return Fiat.valueOf(currencyCode, 0);
}
}
/**
* Converts to a fiat with max. 2 decimal places. Last place gets rounded.
* 0.234 -> 0.23
* 0.235 -> 0.24
*
* @param input
* @return
*/
public static Fiat parseToFiatWithPrecision(String input, String currencyCode) {
if (input != null && input.length() > 0) {
try {
return parseToFiat(new BigDecimal(ParsingUtils.cleanDoubleInput(input)).setScale(2, BigDecimal.ROUND_HALF_UP).toString(),
currencyCode);
} catch (Throwable t) {
log.warn("Exception at parseToFiatWithPrecision: " + t.toString());
return Fiat.valueOf(currencyCode, 0);
}
}
return Fiat.valueOf(currencyCode, 0);
}
public static String getDirectionWithCodeDetailed(OfferPayload.Direction direction, String currencyCode) { public static String getDirectionWithCodeDetailed(OfferPayload.Direction direction, String currencyCode) {
if (CurrencyUtil.isFiatCurrency(currencyCode)) if (CurrencyUtil.isFiatCurrency(currencyCode))
return (direction == OfferPayload.Direction.BUY) ? Res.get("shared.buyingBTCWith", currencyCode) : Res.get("shared.sellingBTCFor", currencyCode); return (direction == OfferPayload.Direction.BUY) ? Res.get("shared.buyingBTCWith", currencyCode) : Res.get("shared.sellingBTCFor", currencyCode);
@ -152,10 +111,6 @@ public class BSFormatter {
return (direction == OfferPayload.Direction.SELL) ? Res.get("shared.buyingCurrency", currencyCode) : Res.get("shared.sellingCurrency", currencyCode); return (direction == OfferPayload.Direction.SELL) ? Res.get("shared.buyingCurrency", currencyCode) : Res.get("shared.sellingCurrency", currencyCode);
} }
public static String arbitratorAddressesToString(List<NodeAddress> nodeAddresses) {
return nodeAddresses.stream().map(NodeAddress::getFullAddress).collect(Collectors.joining(", "));
}
public static String getDateFromBlockHeight(long blockHeight) { public static String getDateFromBlockHeight(long blockHeight) {
long now = new Date().getTime(); long now = new Date().getTime();
SimpleDateFormat dateFormatter = new SimpleDateFormat("dd MMM", Locale.getDefault()); SimpleDateFormat dateFormatter = new SimpleDateFormat("dd MMM", Locale.getDefault());