mirror of
https://github.com/nasa/trick.git
synced 2024-12-21 22:17:51 +00:00
Merge branch 'master' of https://github.com/nasa/trick
This commit is contained in:
commit
6988aa77c2
@ -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
|
||||
|
@ -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()));
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user