Commit 491ff8bd authored by Christoph Richter's avatar Christoph Richter
Browse files

MathInformationRegister: Enhanced function tryGetDoubleValue

parent 9df9cca3
Pipeline #61629 passed with stage
in 2 minutes and 39 seconds
......@@ -194,8 +194,13 @@ public class MathInformationRegister {
// is number
MathNumberExpressionSymbol numberSymbol = (MathNumberExpressionSymbol) symbol;
result = Optional.of(numberSymbol.getValue().getRealNumber().doubleValue());
} else {
// TODO resolve variable
} else if (symbol instanceof MathValueSymbol) {
result = tryGetDoubleValue(((MathValueSymbol) symbol).getValue());
} else if (symbol instanceof MathNameExpressionSymbol) {
Optional<MathValueSymbol> resolvedSymbol = symbol.getEnclosingScope().resolve(((MathNameExpressionSymbol) symbol).getNameToResolveValue(), MathValueSymbol.KIND);
if (resolvedSymbol.isPresent()) {
result = tryGetDoubleValue(resolvedSymbol.get());
}
}
}
return result;
......@@ -260,7 +265,7 @@ public class MathInformationRegister {
}
return result;
}
private MathExpressionSymbol getSubstituteByName(String name, MathExpressionSymbol expr, String atomarValueName) {
MathExpressionSymbol result;
MathValueSymbol declaration = getMathValueSymbol(name);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment