From 540e5d609975ae466494d30a2d9e41b8b89fed16 Mon Sep 17 00:00:00 2001 From: Danila Fedorin Date: Sat, 16 Sep 2017 00:16:32 -0700 Subject: [PATCH 1/4] Load default implementation if one is not found. --- core/src/main/kotlin/org/nwapw/abacus/Abacus.kt | 1 + 1 file changed, 1 insertion(+) diff --git a/core/src/main/kotlin/org/nwapw/abacus/Abacus.kt b/core/src/main/kotlin/org/nwapw/abacus/Abacus.kt index 0363646..4b78256 100644 --- a/core/src/main/kotlin/org/nwapw/abacus/Abacus.kt +++ b/core/src/main/kotlin/org/nwapw/abacus/Abacus.kt @@ -68,6 +68,7 @@ class Abacus(val configuration: Configuration) { pluginManager.reload() with(mutableContext) { numberImplementation = pluginManager.numberImplementationFor(configuration.numberImplementation) + ?: StandardPlugin.IMPLEMENTATION_NAIVE clearVariables() clearDefinitions() } From 88e3bb710918a41041eb8cdef74426d5a85c42a9 Mon Sep 17 00:00:00 2001 From: Danila Fedorin Date: Sat, 16 Sep 2017 00:16:48 -0700 Subject: [PATCH 2/4] Remove unnecessary nullability from parseString. --- core/src/main/kotlin/org/nwapw/abacus/Abacus.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/src/main/kotlin/org/nwapw/abacus/Abacus.kt b/core/src/main/kotlin/org/nwapw/abacus/Abacus.kt index 4b78256..4272aa8 100644 --- a/core/src/main/kotlin/org/nwapw/abacus/Abacus.kt +++ b/core/src/main/kotlin/org/nwapw/abacus/Abacus.kt @@ -88,7 +88,7 @@ class Abacus(val configuration: Configuration) { * @param input the input string to parse * @return the resulting tree, null if the tree builder or the produced tree are null. */ - fun parseString(input: String): TreeNode? = treeBuilder.fromString(input) + fun parseString(input: String): TreeNode = treeBuilder.fromString(input) /** * Evaluates the given tree. * From 0ff071e21251e0c353dd49912bbd33256daabc13 Mon Sep 17 00:00:00 2001 From: Danila Fedorin Date: Sat, 16 Sep 2017 00:17:03 -0700 Subject: [PATCH 3/4] Add a more complete .gitignore --- .gitignore | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 724d50a..31e9878 100644 --- a/.gitignore +++ b/.gitignore @@ -24,7 +24,9 @@ hs_err_pid* # Custom Stuff # Gradle .gradle/* -build/* +**/build/* +**/out/** +**/.DS_Store # IntelliJ .idea/* From 14ac9c67f4ccc24e227d1703edeb3cb958203abd Mon Sep 17 00:00:00 2001 From: Danila Fedorin Date: Sat, 16 Sep 2017 00:18:43 -0700 Subject: [PATCH 4/4] Implement the comparable interface. --- .../java/org/nwapw/abacus/number/NumberInterface.java | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/core/src/main/java/org/nwapw/abacus/number/NumberInterface.java b/core/src/main/java/org/nwapw/abacus/number/NumberInterface.java index 8727425..e37c4fb 100755 --- a/core/src/main/java/org/nwapw/abacus/number/NumberInterface.java +++ b/core/src/main/java/org/nwapw/abacus/number/NumberInterface.java @@ -5,7 +5,7 @@ import org.nwapw.abacus.exception.ComputationInterruptedException; /** * An interface used to represent a number. */ -public abstract class NumberInterface { +public abstract class NumberInterface implements Comparable { /** * Check if the thread was interrupted and @@ -158,14 +158,6 @@ public abstract class NumberInterface { return intPowInternal(exponent); } - /** - * Compares this number to another. - * - * @param number the number to compare to. - * @return same as Integer.compare(); - */ - public abstract int compareTo(NumberInterface number); - /** * Same as Math.signum(). *