This commit is contained in:
John M. Penn 2017-06-13 15:54:07 -05:00
commit 6988aa77c2
3 changed files with 17 additions and 3 deletions

View File

@ -12,7 +12,7 @@ public class VSDouble extends VSValue<Double> {
@Override
public void fromVariableServer(String string) {
setValue(Double.parseDouble(string.trim()));
setValue(Double.parseDouble(handleUndefinedValues(string).trim()));
}
@Override

View File

@ -12,7 +12,6 @@ public class VSFloat extends VSValue<Float> {
@Override
public void fromVariableServer(String string) {
setValue(Float.parseFloat(string.trim()));
setValue(Float.parseFloat(handleUndefinedValues(string).trim()));
}
}

View File

@ -44,4 +44,19 @@ public abstract class VSValue<T> implements VariableServerFluent, Cloneable {
}
}
protected String handleUndefinedValues(String input) {
if(input.equals("inf")) {
input = "Infinity";
}
else if(input.equals("-inf")) {
input = "-Infinity";
}
else if(input.equals("nan")) {
input = "NaN";
}
else if(input.equals("-nan")) {
input = "-NaN";
}
return input;
}
}