|
@ -128,15 +128,37 @@ public class MatrixCalcController { |
|
|
MatrixCalcIOUtils util = new MatrixCalcIOUtils(); |
|
|
MatrixCalcIOUtils util = new MatrixCalcIOUtils(); |
|
|
|
|
|
|
|
|
String stringMatrixB = matrixBTextArea.getText(); |
|
|
String stringMatrixB = matrixBTextArea.getText(); |
|
|
if (util.checkInput(stringMatrixB)) { |
|
|
|
|
|
|
|
|
boolean stop = false; |
|
|
|
|
|
try { |
|
|
|
|
|
|
|
|
double[][] matrixB = util.stringToMatrix(stringMatrixB); |
|
|
|
|
|
double result = math.calcDeterminat(matrixB); |
|
|
|
|
|
|
|
|
util.checkInput(stringMatrixB); |
|
|
|
|
|
|
|
|
String DisplayableString = Double.toString(result); |
|
|
|
|
|
|
|
|
} catch (IllegalArgumentException e) { |
|
|
|
|
|
stop = true; |
|
|
|
|
|
|
|
|
outputText.setText(DisplayableString); |
|
|
|
|
|
|
|
|
outputText.setText(e.getMessage()); |
|
|
outputText.setTextAlignment(TextAlignment.CENTER); |
|
|
outputText.setTextAlignment(TextAlignment.CENTER); |
|
|
|
|
|
|
|
|
|
|
|
e.printStackTrace(); |
|
|
|
|
|
} |
|
|
|
|
|
if (util.checkInput(stringMatrixB) && !stop) { |
|
|
|
|
|
|
|
|
|
|
|
double[][] matrixB = util.stringToMatrix(stringMatrixB); |
|
|
|
|
|
try { |
|
|
|
|
|
double result = math.calcDeterminat(matrixB); |
|
|
|
|
|
|
|
|
|
|
|
String DisplayableString = Double.toString(result); |
|
|
|
|
|
|
|
|
|
|
|
outputText.setText(DisplayableString); |
|
|
|
|
|
outputText.setTextAlignment(TextAlignment.CENTER); |
|
|
|
|
|
|
|
|
|
|
|
} catch (IllegalArgumentException e) { |
|
|
|
|
|
|
|
|
|
|
|
outputText.setText(e.getMessage()); |
|
|
|
|
|
outputText.setTextAlignment(TextAlignment.CENTER); |
|
|
|
|
|
|
|
|
|
|
|
e.printStackTrace(); |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
}); |
|
|
}); |
|
|
} |
|
|
} |