Skip to content

Commit

Permalink
a6.8.1
Browse files Browse the repository at this point in the history
  • Loading branch information
Mararsh committed May 18, 2024
1 parent 812255e commit 2cebf0d
Show file tree
Hide file tree
Showing 23 changed files with 280 additions and 517 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,7 @@ public boolean makeExpression(Data2D data2D,
expression = replaceAll(expression, placeholder, variableName);
variableNames.put(placeholderQuoted, variableName);
variableValues.put(variableName, value);
// MyBoxLog.console(variableName + " " + value);
}
expression = replaceAll(expression, "#{" + message("DataRowNumber") + "}", dataRowNumber + "");
// MyBoxLog.console(info());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -864,7 +864,7 @@ public DataTableGroup groupData(DataTableGroup.TargetType targetType,
if (groupController == null) {
return null;
}
TmpTable tmpTable = tmpTable(data2D.getDataName(), data2D.columnIndices(), true);
TmpTable tmpTable = tmpTable(data2D.dataName(), data2D.columnIndices(), true);
if (tmpTable == null) {
return null;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,29 +1,57 @@
package mara.mybox.controller;

import java.util.List;
import mara.mybox.data2d.Data2D;
import mara.mybox.data2d.DataMatrix;
import mara.mybox.dev.MyBoxLog;
import mara.mybox.fxml.FxTask;

/**
* @Author Mara
* @CreateDate 2021-10-18
* @License Apache License Version 2.0
*/
public class ControlData2DMatrix extends BaseData2DRowsColumnsController {

protected DataMatrix dataMatrix;
public class ControlData2DMatrix extends ControlData2DSource {

@Override
public void initControls() {
try {
super.initControls();

createData(Data2D.DataType.Matrix);
dataMatrix = (DataMatrix) data2D;
createData(Data2D.DataType.CSV);

} catch (Exception e) {
MyBoxLog.error(e);
}
}

public double[][] pickMatrix(FxTask task) {
List<List<String>> data = selectedData(task, checkedColsIndices, false);
if (data == null || data.isEmpty()) {
return null;
}
int rowsNumber = data.size();
int colsNumber = data.get(0).size();
if (rowsNumber <= 0 || colsNumber <= 0) {
return null;
}
double[][] matrix = new double[(int) rowsNumber][(int) colsNumber];
for (int r = 0; r < rowsNumber; r++) {
List<String> row = data.get(r);
for (int c = 0; c < row.size(); c++) {
try {
matrix[r][c] = Double.parseDouble(row.get(c).replaceAll(",", ""));
} catch (Exception e) {
}
}
}
return matrix;
}

protected boolean isSquare(double[][] data) {
if (data == null || data.length == 0) {
return false;
}
return data.length == data[0].length;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ public void dataAction() {
popError(message("NoData"));
return;
}
Data2DManufactureController.openData(data2D.getDataName(),
Data2DManufactureController.openData(data2D.dataName(),
data2D.getColumns(), data2D.tableRows());
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ public void updateStatus() {
if (dataManufactureButton != null) {
dataManufactureButton.setDisable(!isValidData());
}

} catch (Exception e) {
MyBoxLog.error(e);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ public TargetType checkTarget() {
String name = name();
if (name == null || name.isBlank()) {
if (data2D != null) {
name = data2D.getDataName();
name = data2D.dataName();
}
}
if (name == null || name.isBlank()) {
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ public boolean checkOptions() {
tabPane.getSelectionModel().select(targetTab);
return false;
}
filePrefix = data2D.getDataName();
filePrefix = data2D.dataName();
if (filePrefix == null || filePrefix.isBlank()) {
filePrefix = DateTools.nowFileString();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ public void sourceChanged() {

isSettingValues = false;

String dname = data2D.getDataName();
String dname = data2D.dataName();

File file = null;
if (dname != null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public void okAction() {
popError(message("SelectToHandle"));
return;
}
targetController.loadDef(listController.viewController.data2D);
targetController.loadDef(listController.viewController.data2D, false);
close();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ public boolean handleAllData(FxTask currentTask, Data2DWriter writer) {
}
TmpTable tmpTable = new TmpTable()
.setSourceData(tmp2D)
.setTargetName(data2D.getDataName())
.setTargetName(data2D.dataName())
.setSourcePickIndice(checkedColsIndices)
.setImportData(true)
.setForStatistic(false)
Expand Down
Loading

0 comments on commit 2cebf0d

Please sign in to comment.