diff --git a/.classpath b/.classpath
index f227ca66..a76db42c 100644
--- a/.classpath
+++ b/.classpath
@@ -8,7 +8,6 @@
-
diff --git a/.project b/.project
index fe92fe4f..1a550173 100644
--- a/.project
+++ b/.project
@@ -17,13 +17,13 @@
- org.eclipse.m2e.core.maven2Builder
+ org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder
+ full,incremental,
- org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder
- full,incremental,
+ org.eclipse.m2e.core.maven2Builder
diff --git a/.settings/org.eclipse.core.resources.prefs b/.settings/org.eclipse.core.resources.prefs
index b6a3c7a1..55476ff2 100644
--- a/.settings/org.eclipse.core.resources.prefs
+++ b/.settings/org.eclipse.core.resources.prefs
@@ -1,4 +1,6 @@
eclipse.preferences.version=1
+encoding//src/main/java=UTF-8
encoding//src/main/java/org/warp/picalculator/gui/expression/blocks/BlockParenthesis.java=UTF-8
encoding//src/main/java/org/warp/picalculator/math/MathematicalSymbols.java=UTF-8
-encoding/=UTF-8
+encoding//src/main/resources=UTF-8
+encoding//src/test/java=UTF-8
diff --git a/pom.xml b/pom.xml
index 905b1d43..8ee94dcf 100755
--- a/pom.xml
+++ b/pom.xml
@@ -75,6 +75,15 @@
+
+ org.apache.maven.plugins
+ maven-resources-plugin
+ 3.0.2
+
+ UTF-8
+
+
+
org.apache.maven.plugins
@@ -83,6 +92,7 @@
1.8
+ UTF-8
diff --git a/src/main/java/org/warp/picalculator/math/functions/Division.java b/src/main/java/org/warp/picalculator/math/functions/Division.java
index 1b72c8d7..3c43d7d7 100755
--- a/src/main/java/org/warp/picalculator/math/functions/Division.java
+++ b/src/main/java/org/warp/picalculator/math/functions/Division.java
@@ -12,12 +12,6 @@ import org.warp.picalculator.gui.expression.blocks.BlockDivision;
import org.warp.picalculator.math.Function;
import org.warp.picalculator.math.FunctionOperator;
import org.warp.picalculator.math.MathContext;
-import org.warp.picalculator.math.rules.FractionsRule1;
-import org.warp.picalculator.math.rules.FractionsRule11;
-import org.warp.picalculator.math.rules.FractionsRule12;
-import org.warp.picalculator.math.rules.FractionsRule2;
-import org.warp.picalculator.math.rules.FractionsRule3;
-import org.warp.picalculator.math.rules.UndefinedRule2;
import org.warp.picalculator.math.rules.methods.DivisionRule1;
import it.unimi.dsi.fastutil.objects.ObjectArrayList;
diff --git a/src/main/java/org/warp/picalculator/math/functions/Multiplication.java b/src/main/java/org/warp/picalculator/math/functions/Multiplication.java
index bb915c01..6bee14e4 100755
--- a/src/main/java/org/warp/picalculator/math/functions/Multiplication.java
+++ b/src/main/java/org/warp/picalculator/math/functions/Multiplication.java
@@ -8,9 +8,6 @@ import org.warp.picalculator.math.Function;
import org.warp.picalculator.math.FunctionOperator;
import org.warp.picalculator.math.MathContext;
import org.warp.picalculator.math.MathematicalSymbols;
-import org.warp.picalculator.math.rules.FractionsRule14;
-import org.warp.picalculator.math.rules.NumberRule1;
-import org.warp.picalculator.math.rules.NumberRule2;
import org.warp.picalculator.math.rules.methods.MultiplicationMethod1;
import it.unimi.dsi.fastutil.objects.ObjectArrayList;
diff --git a/src/main/java/org/warp/picalculator/math/functions/Sum.java b/src/main/java/org/warp/picalculator/math/functions/Sum.java
index b6cc3f07..846c204a 100755
--- a/src/main/java/org/warp/picalculator/math/functions/Sum.java
+++ b/src/main/java/org/warp/picalculator/math/functions/Sum.java
@@ -10,12 +10,6 @@ import org.warp.picalculator.math.Function;
import org.warp.picalculator.math.FunctionOperator;
import org.warp.picalculator.math.MathContext;
import org.warp.picalculator.math.MathematicalSymbols;
-import org.warp.picalculator.math.rules.NumberRule3;
-import org.warp.picalculator.math.rules.NumberRule5;
-import org.warp.picalculator.math.rules.NumberRule7;
-import org.warp.picalculator.math.rules.VariableRule1;
-import org.warp.picalculator.math.rules.VariableRule2;
-import org.warp.picalculator.math.rules.VariableRule3;
import org.warp.picalculator.math.rules.methods.SumMethod1;
import it.unimi.dsi.fastutil.objects.ObjectArrayList;
diff --git a/src/main/java/org/warp/picalculator/math/rules/methods/DivisionRule1.java b/src/main/java/org/warp/picalculator/math/rules/methods/DivisionRule1.java
index 498ce555..2562145b 100755
--- a/src/main/java/org/warp/picalculator/math/rules/methods/DivisionRule1.java
+++ b/src/main/java/org/warp/picalculator/math/rules/methods/DivisionRule1.java
@@ -19,7 +19,7 @@ import it.unimi.dsi.fastutil.objects.ObjectArrayList;
public class DivisionRule1 {
public static boolean compare(Division f) throws InterruptedException {
- return f.getParameter1().isSimplified() && f.getParameter2().isSimplified() && (f.getParameter1() instanceof Multiplication || f.getParameter2() instanceof Multiplication) && getFirstWorkingDivisionCouple(getDivisionElements(f)) != null;
+ return false;//TODO: return f.getParameter1().isSimplified() && f.getParameter2().isSimplified() && (f.getParameter1() instanceof Multiplication || f.getParameter2() instanceof Multiplication) && getFirstWorkingDivisionCouple(getDivisionElements(f)) != null;
}
public static ObjectArrayList execute(Division f) throws Error, InterruptedException {
@@ -95,25 +95,27 @@ public class DivisionRule1 {
}
private static int[] getFirstWorkingDivisionCouple(ObjectArrayList[] elements) throws InterruptedException {
- final int[] size = new int[] { elements[0].size(), elements[1].size() };
- Function a;
- Function b;
- if (elements[0].size() + elements[1].size() <= 2) {
- return null;
- }
- for (int i = 0; i < size[0]; i++) {
- a = elements[0].get(i);
- for (int j = 0; j < size[1]; j++) {
- if (Thread.interrupted()) throw new InterruptedException();
- b = elements[1].get(j);
- Function testFunc;
- testFunc = new Division(a.getMathContext(), a, b);
- if (!testFunc.isSimplified()) {
- return new int[] { i, j };
- }
- }
- }
return null;
+ //TODO:
+// final int[] size = new int[] { elements[0].size(), elements[1].size() };
+// Function a;
+// Function b;
+// if (elements[0].size() + elements[1].size() <= 2) {
+// return null;
+// }
+// for (int i = 0; i < size[0]; i++) {
+// a = elements[0].get(i);
+// for (int j = 0; j < size[1]; j++) {
+// if (Thread.interrupted()) throw new InterruptedException();
+// b = elements[1].get(j);
+// Function testFunc;
+// testFunc = new Division(a.getMathContext(), a, b);
+// if (!testFunc.isSimplified()) {
+// return new int[] { i, j };
+// }
+// }
+// }
+// return null;
}
}
diff --git a/src/main/java/org/warp/picalculator/math/rules/methods/MultiplicationMethod1.java b/src/main/java/org/warp/picalculator/math/rules/methods/MultiplicationMethod1.java
index 6609ffa0..6661a0bf 100755
--- a/src/main/java/org/warp/picalculator/math/rules/methods/MultiplicationMethod1.java
+++ b/src/main/java/org/warp/picalculator/math/rules/methods/MultiplicationMethod1.java
@@ -18,7 +18,7 @@ import it.unimi.dsi.fastutil.objects.ObjectArrayList;
public class MultiplicationMethod1 {
public static boolean compare(Function f) throws InterruptedException {
- return ((Multiplication) f).getParameter1().isSimplified() && ((Multiplication) f).getParameter2().isSimplified() && !(((Multiplication) f).getParameter1() instanceof Number && ((Multiplication) f).getParameter2() instanceof Number) && getFirstWorkingMultiplicationCouple(getMultiplicationElements(f)) != null;
+ return false;//TODO: return ((Multiplication) f).getParameter1().isSimplified() && ((Multiplication) f).getParameter2().isSimplified() && !(((Multiplication) f).getParameter1() instanceof Number && ((Multiplication) f).getParameter2() instanceof Number) && getFirstWorkingMultiplicationCouple(getMultiplicationElements(f)) != null;
}
public static ObjectArrayList execute(Function f) throws Error, InterruptedException {
@@ -59,31 +59,33 @@ public class MultiplicationMethod1 {
}
private static int[] getFirstWorkingMultiplicationCouple(ObjectArrayList elements) throws InterruptedException {
- final int size = elements.size();
- Function a;
- Function b;
- if (elements.size() == 0) {
- return null;
- }
- if (elements.size() == 2) {
- return null;
- }
- final MathContext root = elements.get(0).getMathContext();
- for (int i = 0; i < size; i++) {
- a = elements.get(i);
- for (int j = 0; j < size; j++) {
- if (Thread.interrupted()) throw new InterruptedException();
- b = elements.get(j);
- if (i != j) {
- Function testFunc;
- testFunc = new Multiplication(root, a, b);
- if (!testFunc.isSimplified()) {
- return new int[] { i, j };
- }
- }
- }
- }
return null;
+ // TODO:
+// final int size = elements.size();
+// Function a;
+// Function b;
+// if (elements.size() == 0) {
+// return null;
+// }
+// if (elements.size() == 2) {
+// return null;
+// }
+// final MathContext root = elements.get(0).getMathContext();
+// for (int i = 0; i < size; i++) {
+// a = elements.get(i);
+// for (int j = 0; j < size; j++) {
+// if (Thread.interrupted()) throw new InterruptedException();
+// b = elements.get(j);
+// if (i != j) {
+// Function testFunc;
+// testFunc = new Multiplication(root, a, b);
+// if (!testFunc.isSimplified()) {
+// return new int[] { i, j };
+// }
+// }
+// }
+// }
+// return null;
}
}
diff --git a/src/main/java/org/warp/picalculator/math/rules/methods/SumMethod1.java b/src/main/java/org/warp/picalculator/math/rules/methods/SumMethod1.java
index 3de7b312..89f72a68 100755
--- a/src/main/java/org/warp/picalculator/math/rules/methods/SumMethod1.java
+++ b/src/main/java/org/warp/picalculator/math/rules/methods/SumMethod1.java
@@ -23,8 +23,10 @@ import it.unimi.dsi.fastutil.objects.ObjectArrayList;
public class SumMethod1 {
public static boolean compare(Function f) throws InterruptedException {
- final MathContext root = f.getMathContext();
- return (f instanceof Sum || f instanceof Subtraction) && ((FunctionOperator) f).getParameter1().isSimplified() && ((FunctionOperator) f).getParameter2().isSimplified() && !(((FunctionOperator) f).getParameter1() instanceof Number && ((FunctionOperator) f).getParameter2() instanceof Number) && getFirstWorkingSumCouple(root, getSumElements(f)) != null;
+ return false;
+ //TODO:
+// final MathContext root = f.getMathContext();
+// return (f instanceof Sum || f instanceof Subtraction) && ((FunctionOperator) f).getParameter1().isSimplified() && ((FunctionOperator) f).getParameter2().isSimplified() && !(((FunctionOperator) f).getParameter1() instanceof Number && ((FunctionOperator) f).getParameter2() instanceof Number) && getFirstWorkingSumCouple(root, getSumElements(f)) != null;
}
public static ObjectArrayList execute(Function f) throws Error, InterruptedException {
@@ -78,37 +80,38 @@ public class SumMethod1 {
}
private static int[] getFirstWorkingSumCouple(MathContext root, ObjectArrayList elements) throws InterruptedException {
- final int size = elements.size();
- Function a;
- Function b;
- if (elements.size() == 2) {
- return null;
- }
- for (int i = 0; i < size; i++) {
- a = elements.get(i);
- for (int j = 0; j < size; j++) {
- if (Thread.interrupted()) throw new InterruptedException();
- b = elements.get(j);
- if (i != j) {
- Function testFunc;
- if (b instanceof Negative) {
- testFunc = new Subtraction(root, a, ((Negative) b).getParameter());
- } else if (b instanceof Number && ((Number) b).getTerm().compareTo(BigDecimal.ZERO) < 0) {
- testFunc = new Subtraction(root, a, ((Number) b).multiply(new Number(root, -1)));
- } else if (a instanceof Negative) {
- testFunc = new Subtraction(root, b, ((Negative) a).getParameter());
- } else if (a instanceof Number && ((Number) a).getTerm().compareTo(BigDecimal.ZERO) < 0) {
- testFunc = new Subtraction(root, b, ((Number) a).multiply(new Number(root, -1)));
- } else {
- testFunc = new Sum(root, a, b);
- }
- if (!testFunc.isSimplified()) {
- return new int[] { i, j };
- }
- }
- }
- }
return null;
+// final int size = elements.size();
+// Function a;
+// Function b;
+// if (elements.size() == 2) {
+// return null;
+// }
+// for (int i = 0; i < size; i++) {
+// a = elements.get(i);
+// for (int j = 0; j < size; j++) {
+// if (Thread.interrupted()) throw new InterruptedException();
+// b = elements.get(j);
+// if (i != j) {
+// Function testFunc;
+// if (b instanceof Negative) {
+// testFunc = new Subtraction(root, a, ((Negative) b).getParameter());
+// } else if (b instanceof Number && ((Number) b).getTerm().compareTo(BigDecimal.ZERO) < 0) {
+// testFunc = new Subtraction(root, a, ((Number) b).multiply(new Number(root, -1)));
+// } else if (a instanceof Negative) {
+// testFunc = new Subtraction(root, b, ((Negative) a).getParameter());
+// } else if (a instanceof Number && ((Number) a).getTerm().compareTo(BigDecimal.ZERO) < 0) {
+// testFunc = new Subtraction(root, b, ((Number) a).multiply(new Number(root, -1)));
+// } else {
+// testFunc = new Sum(root, a, b);
+// }
+// if (!testFunc.isSimplified()) {
+// return new int[] { i, j };
+// }
+// }
+// }
+// }
+// return null;
}
}