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 10, 2024
1 parent 9f3b7eb commit 36730cd
Show file tree
Hide file tree
Showing 36 changed files with 421 additions and 281 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package mara.mybox.fxml;
package mara.mybox.calculation;

import java.util.ArrayList;
import java.util.HashMap;
Expand Down Expand Up @@ -76,18 +76,23 @@ private boolean executeScript() {
}
}

public String calculate(String script) {
public String calculate(String script, Map<String, Object> variables) {
reset();
this.expression = script;
if (variables != null) {
for (String v : variables.keySet()) {
variableValues.put(v, variables.get(v));
}
}
if (executeScript()) {
return result;
} else {
return null;
}
}

public boolean condition(String script) {
calculate(script);
public boolean condition(String script, Map<String, Object> variables) {
calculate(script, variables);
return "true".equals(result);
}

Expand Down Expand Up @@ -210,7 +215,8 @@ public boolean validateExpression(Data2D data2D, String script, boolean allPages
}
List<String> row = new ArrayList<>();
for (int i = 0; i < data2D.columnsNumber(); i++) {
row.add("0");
Data2DColumn column = data2D.columns.get(i);
row.add(column.makeDefaultValue());
}
String filledScript = replaceDummyStatistic(data2D, script);
if (allPages) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,8 +123,6 @@ public static enum SaveAsType {
protected ComboBox<String> dpiSelector;
@FXML
protected TabPane tabPane;
@FXML
protected CheckBox errorContinueCheck;

public void setFileType() {
setFileType(FileType.All);
Expand Down
Loading

0 comments on commit 36730cd

Please sign in to comment.