/** * Stelt een oplossing voor van het ordeningsalgoritme. */ public class MatrixMultiplication { private final Matrix matrix; private final MatrixMultiplication left; private final MatrixMultiplication right; public MatrixMultiplication(Matrix matrix) { this.matrix = matrix; left = right = null; } public MatrixMultiplication(MatrixMultiplication left, MatrixMultiplication right) { matrix = null; this.left = left; this.right = right; } Matrix getMatrix() { return matrix; } MatrixMultiplication getLeft() { return left; } MatrixMultiplication getRight() { return right; } @Override public String toString() { return toString(false); } private String toString(boolean haakjes) { if (matrix != null) return String.valueOf(matrix.name()); String s = left.toString(true) + right.toString(true); return haakjes ? "(" + s + ")" : s; } }