Commit edb136d8 authored by Nico Mack's avatar Nico Mack

Minor code cleanup

parent f1470f0c
......@@ -624,36 +624,33 @@ public class EquationSystemBuilder {
HashMap<String, String> resultAttributes;
Element resultsNode = equation.getChild(EquationSystemBundle.RESULTS_ELEMENT);
if (resultsNode == null) {
equationResults.put(equationName, declarations);
return;
}
List<Element> results = resultsNode.getChildren(EquationSystemBundle.RESULT_ELEMENT);
for (Element result : results) {
resultAttributes = this.extractAttributesForVariables(result);
String identifier = resultAttributes.get(EquationSystemBundle.NAME_ATTRIBUTE);
Variable<?> variable = this.getDependentVariable(resultAttributes);
if (variable != null) {
Declaration declaration = this.buildDeclaration(variable, resultAttributes);
declarations.add(declaration);
} else {
String message = StringUtils.build("Undefined result {} encountered! Check equation file!", identifier); //$NON-NLS-1$
LOGGER.error(message);
throw new EquationSystemException(message);
}
if (resultsNode != null) {
List<Element> results = resultsNode.getChildren(EquationSystemBundle.RESULT_ELEMENT);
for (Element result : results) {
resultAttributes = this.extractAttributesForVariables(result);
String identifier = resultAttributes.get(EquationSystemBundle.NAME_ATTRIBUTE);
Variable<?> variable = this.getDependentVariable(resultAttributes);
if (variable != null) {
Declaration declaration = this.buildDeclaration(variable, resultAttributes);
declarations.add(declaration);
} else {
String message = StringUtils.build("Undefined result {} encountered! Check equation file!", identifier); //$NON-NLS-1$
LOGGER.error(message);
throw new EquationSystemException(message);
}
if (resultDependencies.containsKey(identifier)) {
resultDependencies.get(identifier).add(equationName);
} else {
List<String> dependencies = new ArrayList<>();
dependencies.add(equationName);
resultDependencies.put(identifier, dependencies);
}
if (resultDependencies.containsKey(identifier)) {
resultDependencies.get(identifier).add(equationName);
} else {
List<String> dependencies = new ArrayList<>();
dependencies.add(equationName);
resultDependencies.put(identifier, dependencies);
}
if (this.independentVariables.containsKey(identifier)) {
this.independentVariables.remove(identifier);
if (this.independentVariables.containsKey(identifier)) {
this.independentVariables.remove(identifier);
}
}
}
equationResults.put(equationName, declarations);
......
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