|
@ -37,7 +37,11 @@ public class MatrixCalcController { |
|
|
|
|
|
|
|
|
String stringMatrixA = matrixATextArea.getText(); |
|
|
String stringMatrixA = matrixATextArea.getText(); |
|
|
String stringMatrixB = matrixBTextArea.getText(); |
|
|
String stringMatrixB = matrixBTextArea.getText(); |
|
|
if (util.checkInput(stringMatrixA) && util.checkInput(stringMatrixB)) { |
|
|
|
|
|
|
|
|
try { |
|
|
|
|
|
|
|
|
|
|
|
} catch (Exception e) { |
|
|
|
|
|
//TODO: handle exception |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
double[][] matrixA = util.stringToMatrix(stringMatrixA); |
|
|
double[][] matrixA = util.stringToMatrix(stringMatrixA); |
|
|
double[][] matrixB = util.stringToMatrix(stringMatrixB); |
|
|
double[][] matrixB = util.stringToMatrix(stringMatrixB); |
|
@ -47,7 +51,6 @@ public class MatrixCalcController { |
|
|
|
|
|
|
|
|
outputText.setText(DisplayableString); |
|
|
outputText.setText(DisplayableString); |
|
|
outputText.setTextAlignment(TextAlignment.CENTER); |
|
|
outputText.setTextAlignment(TextAlignment.CENTER); |
|
|
} |
|
|
|
|
|
// System.out.println(matrixATextArea.getText()); |
|
|
// System.out.println(matrixATextArea.getText()); |
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
@ -56,7 +59,11 @@ public class MatrixCalcController { |
|
|
MatrixCalcIOUtils util = new MatrixCalcIOUtils(); |
|
|
MatrixCalcIOUtils util = new MatrixCalcIOUtils(); |
|
|
|
|
|
|
|
|
String stringMatrixA = matrixATextArea.getText(); |
|
|
String stringMatrixA = matrixATextArea.getText(); |
|
|
if (util.checkInput(stringMatrixA)) { |
|
|
|
|
|
|
|
|
try { |
|
|
|
|
|
|
|
|
|
|
|
} catch (Exception e) { |
|
|
|
|
|
//TODO: handle exception |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
double[][] matrixA = util.stringToMatrix(stringMatrixA); |
|
|
double[][] matrixA = util.stringToMatrix(stringMatrixA); |
|
|
double[][] result = math.matrixTransponation(matrixA); |
|
|
double[][] result = math.matrixTransponation(matrixA); |
|
@ -65,7 +72,6 @@ public class MatrixCalcController { |
|
|
|
|
|
|
|
|
outputText.setText(DisplayableString); |
|
|
outputText.setText(DisplayableString); |
|
|
outputText.setTextAlignment(TextAlignment.CENTER); |
|
|
outputText.setTextAlignment(TextAlignment.CENTER); |
|
|
} |
|
|
|
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
|
addButton.setOnMouseClicked((event) -> { |
|
|
addButton.setOnMouseClicked((event) -> { |
|
@ -74,7 +80,11 @@ public class MatrixCalcController { |
|
|
|
|
|
|
|
|
String stringMatrixA = matrixATextArea.getText(); |
|
|
String stringMatrixA = matrixATextArea.getText(); |
|
|
String stringMatrixB = matrixBTextArea.getText(); |
|
|
String stringMatrixB = matrixBTextArea.getText(); |
|
|
if (util.checkInput(stringMatrixA) && util.checkInput(stringMatrixB)) { |
|
|
|
|
|
|
|
|
try { |
|
|
|
|
|
|
|
|
|
|
|
} catch (Exception e) { |
|
|
|
|
|
//TODO: handle exception |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
double[][] matrixA = util.stringToMatrix(stringMatrixA); |
|
|
double[][] matrixA = util.stringToMatrix(stringMatrixA); |
|
|
double[][] matrixB = util.stringToMatrix(stringMatrixB); |
|
|
double[][] matrixB = util.stringToMatrix(stringMatrixB); |
|
@ -84,7 +94,6 @@ public class MatrixCalcController { |
|
|
|
|
|
|
|
|
outputText.setText(DisplayableString); |
|
|
outputText.setText(DisplayableString); |
|
|
outputText.setTextAlignment(TextAlignment.CENTER); |
|
|
outputText.setTextAlignment(TextAlignment.CENTER); |
|
|
} |
|
|
|
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
|
substractButton.setOnMouseClicked((event) -> { |
|
|
substractButton.setOnMouseClicked((event) -> { |
|
@ -94,13 +103,9 @@ public class MatrixCalcController { |
|
|
String stringMatrixA = matrixATextArea.getText(); |
|
|
String stringMatrixA = matrixATextArea.getText(); |
|
|
String stringMatrixB = matrixBTextArea.getText(); |
|
|
String stringMatrixB = matrixBTextArea.getText(); |
|
|
|
|
|
|
|
|
boolean stop = false; |
|
|
|
|
|
|
|
|
|
|
|
try { |
|
|
try { |
|
|
util.checkInput(stringMatrixA); |
|
|
util.checkInput(stringMatrixA); |
|
|
} catch (Exception e) { |
|
|
} catch (Exception e) { |
|
|
stop = true; |
|
|
|
|
|
|
|
|
|
|
|
outputText.setText(e.getMessage() + "A"); |
|
|
outputText.setText(e.getMessage() + "A"); |
|
|
outputText.setTextAlignment(TextAlignment.CENTER); |
|
|
outputText.setTextAlignment(TextAlignment.CENTER); |
|
|
} |
|
|
} |
|
@ -108,14 +113,10 @@ public class MatrixCalcController { |
|
|
try { |
|
|
try { |
|
|
util.checkInput(stringMatrixB); |
|
|
util.checkInput(stringMatrixB); |
|
|
} catch (Exception e) { |
|
|
} catch (Exception e) { |
|
|
stop = true; |
|
|
|
|
|
|
|
|
|
|
|
outputText.setText(e.getMessage() + "B"); |
|
|
outputText.setText(e.getMessage() + "B"); |
|
|
outputText.setTextAlignment(TextAlignment.CENTER); |
|
|
outputText.setTextAlignment(TextAlignment.CENTER); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
if (util.checkInput(stringMatrixA) && util.checkInput(stringMatrixB) && !stop) { |
|
|
|
|
|
|
|
|
|
|
|
double[][] matrixA = util.stringToMatrix(stringMatrixA); |
|
|
double[][] matrixA = util.stringToMatrix(stringMatrixA); |
|
|
double[][] matrixB = util.stringToMatrix(stringMatrixB); |
|
|
double[][] matrixB = util.stringToMatrix(stringMatrixB); |
|
|
|
|
|
|
|
@ -131,10 +132,6 @@ public class MatrixCalcController { |
|
|
outputText.setText(e.getMessage()); |
|
|
outputText.setText(e.getMessage()); |
|
|
outputText.setTextAlignment(TextAlignment.CENTER); |
|
|
outputText.setTextAlignment(TextAlignment.CENTER); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
|
DetAButton.setOnMouseClicked((event) -> { |
|
|
DetAButton.setOnMouseClicked((event) -> { |
|
@ -143,18 +140,14 @@ public class MatrixCalcController { |
|
|
|
|
|
|
|
|
String stringMatrixA = matrixATextArea.getText(); |
|
|
String stringMatrixA = matrixATextArea.getText(); |
|
|
|
|
|
|
|
|
boolean stop = false; |
|
|
|
|
|
try { |
|
|
try { |
|
|
|
|
|
|
|
|
util.checkInput(stringMatrixA); |
|
|
util.checkInput(stringMatrixA); |
|
|
|
|
|
|
|
|
} catch (IllegalArgumentException e) { |
|
|
} catch (IllegalArgumentException e) { |
|
|
stop = true; |
|
|
|
|
|
|
|
|
|
|
|
outputText.setText(e.getMessage()); |
|
|
outputText.setText(e.getMessage()); |
|
|
outputText.setTextAlignment(TextAlignment.CENTER); |
|
|
outputText.setTextAlignment(TextAlignment.CENTER); |
|
|
} |
|
|
} |
|
|
if (util.checkInput(stringMatrixA) && !stop) { |
|
|
|
|
|
|
|
|
|
|
|
double[][] matrixA = util.stringToMatrix(stringMatrixA); |
|
|
double[][] matrixA = util.stringToMatrix(stringMatrixA); |
|
|
try { |
|
|
try { |
|
@ -170,7 +163,6 @@ public class MatrixCalcController { |
|
|
outputText.setText(e.getMessage()); |
|
|
outputText.setText(e.getMessage()); |
|
|
outputText.setTextAlignment(TextAlignment.CENTER); |
|
|
outputText.setTextAlignment(TextAlignment.CENTER); |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
|
DetBButton.setOnMouseClicked((event) -> { |
|
|
DetBButton.setOnMouseClicked((event) -> { |
|
@ -178,18 +170,14 @@ public class MatrixCalcController { |
|
|
MatrixCalcIOUtils util = new MatrixCalcIOUtils(); |
|
|
MatrixCalcIOUtils util = new MatrixCalcIOUtils(); |
|
|
|
|
|
|
|
|
String stringMatrixB = matrixBTextArea.getText(); |
|
|
String stringMatrixB = matrixBTextArea.getText(); |
|
|
boolean stop = false; |
|
|
|
|
|
try { |
|
|
try { |
|
|
|
|
|
|
|
|
util.checkInput(stringMatrixB); |
|
|
util.checkInput(stringMatrixB); |
|
|
|
|
|
|
|
|
} catch (IllegalArgumentException e) { |
|
|
} catch (IllegalArgumentException e) { |
|
|
stop = true; |
|
|
|
|
|
|
|
|
|
|
|
outputText.setText(e.getMessage()); |
|
|
outputText.setText(e.getMessage()); |
|
|
outputText.setTextAlignment(TextAlignment.CENTER); |
|
|
outputText.setTextAlignment(TextAlignment.CENTER); |
|
|
} |
|
|
} |
|
|
if (util.checkInput(stringMatrixB) && !stop) { |
|
|
|
|
|
|
|
|
|
|
|
double[][] matrixB = util.stringToMatrix(stringMatrixB); |
|
|
double[][] matrixB = util.stringToMatrix(stringMatrixB); |
|
|
try { |
|
|
try { |
|
@ -205,7 +193,6 @@ public class MatrixCalcController { |
|
|
outputText.setText(e.getMessage()); |
|
|
outputText.setText(e.getMessage()); |
|
|
outputText.setTextAlignment(TextAlignment.CENTER); |
|
|
outputText.setTextAlignment(TextAlignment.CENTER); |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
}); |
|
|
}); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |