Remove deprecated method from Formatter

This commit is contained in:
Manfred Karrer 2014-09-26 14:23:35 +02:00
parent 87d89f2dc6
commit 026a3e4b93
2 changed files with 17 additions and 24 deletions

View File

@ -61,6 +61,8 @@ import de.jensd.fx.fontawesome.AwesomeIcon;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import static com.google.common.base.Preconditions.*;
// TODO Arbitration is very basic yet
public class ArbitratorRegistrationViewCB extends CachedViewCB {
private static final Logger log = LoggerFactory.getLogger(ArbitratorRegistrationViewCB.class);
@ -441,11 +443,11 @@ public class ArbitratorRegistrationViewCB extends CachedViewCB {
String messagePubKeyAsHex = DSAKeyUtil.getHexStringFromPublicKey(user.getMessagePublicKey());
String name = nameTextField.getText();
double maxTradeVolume = formatter.parseToDouble(maxTradeVolumeTextField.getText());
double passiveServiceFee = formatter.parseToDouble(passiveServiceFeeTextField.getText());
double minPassiveServiceFee = formatter.parseToDouble(minPassiveServiceFeeTextField.getText());
double arbitrationFee = formatter.parseToDouble(arbitrationFeeTextField.getText());
double minArbitrationFee = formatter.parseToDouble(minArbitrationFeeTextField.getText());
double maxTradeVolume = parseToDouble(maxTradeVolumeTextField.getText());
double passiveServiceFee = parseToDouble(passiveServiceFeeTextField.getText());
double minPassiveServiceFee = parseToDouble(minPassiveServiceFeeTextField.getText());
double arbitrationFee = parseToDouble(arbitrationFeeTextField.getText());
double minArbitrationFee = parseToDouble(minArbitrationFeeTextField.getText());
String webUrl = webPageTextField.getText();
String description = descriptionTextArea.getText();
@ -472,6 +474,15 @@ public class ArbitratorRegistrationViewCB extends CachedViewCB {
stage.close();
}
private double parseToDouble(String input) {
try {
checkNotNull(input);
checkArgument(input.length() > 0);
input = input.replace(",", ".").trim();
return Double.parseDouble(input);
} catch (Exception e) {
return 0;
}
}
}

View File

@ -44,8 +44,6 @@ import javax.inject.Inject;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import static com.google.common.base.Preconditions.*;
//TODO convert to non static
/**
@ -245,22 +243,6 @@ public class BSFormatter {
// Other
///////////////////////////////////////////////////////////////////////////////////////////
/**
* @param input String to be converted to a double. Both decimal points "." and ",
* " are supported. Thousands separator is not supported.
* @return Returns a double value. Any invalid value returns Double.NEGATIVE_INFINITY.
*/
@Deprecated //TODO use Fiat or Btc if possible
public double parseToDouble(String input) {
try {
checkNotNull(input);
checkArgument(input.length() > 0);
input = input.replace(",", ".").trim();
return Double.parseDouble(input);
} catch (Exception e) {
return 0;
}
}
public String formatDirection(Direction direction) {
return formatDirection(direction, true);