打包准备修复bug

pull/8/head
杨默涵 2 months ago
parent 4b03e751a2
commit e60efbd445

@ -402,45 +402,6 @@ private double calculateTrigFunction(String function, int angle) {
default: return 0;
}
}
/**
*
*/
private void ensureDivisibleOperations(List<Integer> operands, List<String> operators) {
for (int i = 0; i < operators.size(); i++) {
if (operators.get(i).equals("/")) {
int dividend = operands.get(i);
int divisor = operands.get(i + 1);
// 如果除不尽,调整被除数使其能被除数整除
if (dividend % divisor != 0) {
// 生成一个能被除数整除的新被除数
int newDividend = divisor * (1 + random.nextInt(MAX_OPERAND_VALUE / divisor));
operands.set(i, newDividend);
}
}
}
}
/**
* Double
*/
private void ensureDivisibleOperationsForDouble(List<Double> operands, List<String> operators) {
for (int i = 0; i < operators.size(); i++) {
if (operators.get(i).equals("/")) {
double dividend = operands.get(i);
double divisor = operands.get(i + 1);
// 只对整数部分进行除法检查
if (divisor != 0 && dividend % divisor != 0) {
// 生成一个能被除数整除的新被除数
int intDivisor = (int) divisor;
int newDividend = intDivisor * (1 + random.nextInt(MAX_OPERAND_VALUE / intDivisor));
operands.set(i, (double) newDividend);
}
}
}
}
/**
@ -515,9 +476,6 @@ private double calculateTrigFunction(String function, int angle) {
operators.add(selectedOp);
}
// 确保除法运算都能除尽
ensureDivisibleOperations(operands, operators);
// 构建表达式字符串
expression.append(operands.get(0));
for (int i = 0; i < operatorCount; i++) {
@ -582,7 +540,7 @@ private double calculateTrigFunction(String function, int angle) {
}
/**
*
*
*/
private String[] generateCompoundExpressionWithDivision(int operatorCount) {
StringBuilder expression = new StringBuilder();
@ -600,9 +558,6 @@ private double calculateTrigFunction(String function, int angle) {
operators.add(availableOps[random.nextInt(availableOps.length)]);
}
// 确保除法运算都能除尽
ensureDivisibleOperations(operands, operators);
// 构建表达式字符串
expression.append(operands.get(0));
for (int i = 0; i < operatorCount; i++) {
@ -686,9 +641,6 @@ private double calculateTrigFunction(String function, int angle) {
operators.add(selectedOp);
}
// 确保除法运算都能除尽(只对整数运算进行检查)
ensureDivisibleOperationsForDouble(operands, operators);
// 构建表达式字符串
expression.append(operands.get(0).intValue());
for (int i = 0; i < operatorCount; i++) {
@ -856,9 +808,7 @@ private double calculateTrigFunction(String function, int angle) {
ops.remove(i);
i--; // 调整索引
} else if (ops.get(i).equals("√")) {
// 计算开方结果
int result = (int) Math.sqrt(numbers.get(i));
numbers.set(i, result);
// 开方运算已经在生成时处理了
ops.remove(i);
i--; // 调整索引
}

@ -68,7 +68,7 @@ public class RegisterController {
*
* @param parentStage
*/
public void setParentStage(javafx.stage.Stage parentStage) {
public void setParentStage(Stage parentStage) {
this.parentStage = parentStage;
}

@ -1,10 +1,10 @@
module com.example.mathsystemtogether {
requires javafx.controls;
requires javafx.fxml;
requires transitive javafx.graphics;
requires jakarta.mail;
requires jakarta.activation;
opens com.example.mathsystemtogether to javafx.fxml;
exports com.example.mathsystemtogether;
}
Loading…
Cancel
Save