Commit 5ec5a393 authored by Sascha Niklas Schneiders's avatar Sascha Niklas Schneiders
Browse files

continued refactoring

parent cf053753
......@@ -235,21 +235,20 @@ public class MathMatrixMultiplicationOrder implements MathOptimizationRule {
public List<MathExpressionSymbol> getNewExpressions(MathArithmeticExpressionSymbol mathArithmeticExpressionSymbol, List<MathExpressionSymbol> precedingExpressions) {
List<MathExpressionSymbol> mathExpressionSymbols = new ArrayList<>();
if (MathOptimizer.isArithmeticExpression(mathArithmeticExpressionSymbol.getLeftExpression().getRealMathExpressionSymbol(), "*", precedingExpressions)) {
if (MathOptimizer.isArithmeticMatrixExpression(mathArithmeticExpressionSymbol.getLeftExpression().getRealMathExpressionSymbol(), "*", precedingExpressions))
mathExpressionSymbols.addAll(getNewExpressions((MathMatrixArithmeticExpressionSymbol) mathArithmeticExpressionSymbol.getLeftExpression().getRealMathExpressionSymbol(), precedingExpressions));
else
mathExpressionSymbols.addAll(getNewExpressions((MathArithmeticExpressionSymbol) MathOptimizer.getCurrentAssignment(mathArithmeticExpressionSymbol.getLeftExpression().getRealMathExpressionSymbol(), precedingExpressions), precedingExpressions));
} else {
mathExpressionSymbols.add(mathArithmeticExpressionSymbol.getLeftExpression());
}
if (MathOptimizer.isArithmeticExpression(mathArithmeticExpressionSymbol.getRightExpression().getRealMathExpressionSymbol(), "*", precedingExpressions)) {
if (MathOptimizer.isArithmeticMatrixExpression(mathArithmeticExpressionSymbol.getRightExpression().getRealMathExpressionSymbol(), "*", precedingExpressions))
mathExpressionSymbols.addAll(getNewExpressions((MathMatrixArithmeticExpressionSymbol) mathArithmeticExpressionSymbol.getRightExpression().getRealMathExpressionSymbol(), precedingExpressions));
mathExpressionSymbols.addAll(getNewExpressions(mathArithmeticExpressionSymbol, mathArithmeticExpressionSymbol.getLeftExpression(), precedingExpressions));
mathExpressionSymbols.addAll(getNewExpressions(mathArithmeticExpressionSymbol, mathArithmeticExpressionSymbol.getRightExpression(), precedingExpressions));
return mathExpressionSymbols;
}
public List<MathExpressionSymbol> getNewExpressions(MathArithmeticExpressionSymbol mathArithmeticExpressionSymbol, MathExpressionSymbol mathExpressionSymbol, List<MathExpressionSymbol> precedingExpressions) {
List<MathExpressionSymbol> mathExpressionSymbols = new ArrayList<>();
if (MathOptimizer.isArithmeticExpression(mathExpressionSymbol.getRealMathExpressionSymbol(), "*", precedingExpressions)) {
if (MathOptimizer.isArithmeticMatrixExpression(mathExpressionSymbol.getRealMathExpressionSymbol(), "*", precedingExpressions))
mathExpressionSymbols.addAll(getNewExpressions((MathMatrixArithmeticExpressionSymbol) mathExpressionSymbol.getRealMathExpressionSymbol(), precedingExpressions));
else
mathExpressionSymbols.addAll(getNewExpressions((MathArithmeticExpressionSymbol) MathOptimizer.getCurrentAssignment(mathArithmeticExpressionSymbol.getRightExpression().getRealMathExpressionSymbol(), precedingExpressions), precedingExpressions));
mathExpressionSymbols.addAll(getNewExpressions((MathArithmeticExpressionSymbol) MathOptimizer.getCurrentAssignment(mathExpressionSymbol.getRealMathExpressionSymbol(), precedingExpressions), precedingExpressions));
} else {
mathExpressionSymbols.add(mathArithmeticExpressionSymbol.getRightExpression());
mathExpressionSymbols.add(mathExpressionSymbol);
}
return mathExpressionSymbols;
}
......
Supports Markdown
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