mirror of
https://github.com/DanilaFe/abacus
synced 2024-12-22 15:30:09 -08:00
Merge pull request #27 from DanilaFe/fixes
Fix a number of small issues not worthy of their own branches.
This commit is contained in:
commit
07581557c7
4
.gitignore
vendored
4
.gitignore
vendored
|
@ -24,7 +24,9 @@ hs_err_pid*
|
||||||
# Custom Stuff
|
# Custom Stuff
|
||||||
# Gradle
|
# Gradle
|
||||||
.gradle/*
|
.gradle/*
|
||||||
build/*
|
**/build/*
|
||||||
|
**/out/**
|
||||||
|
**/.DS_Store
|
||||||
|
|
||||||
# IntelliJ
|
# IntelliJ
|
||||||
.idea/*
|
.idea/*
|
||||||
|
|
|
@ -5,7 +5,7 @@ import org.nwapw.abacus.exception.ComputationInterruptedException;
|
||||||
/**
|
/**
|
||||||
* An interface used to represent a number.
|
* An interface used to represent a number.
|
||||||
*/
|
*/
|
||||||
public abstract class NumberInterface {
|
public abstract class NumberInterface implements Comparable<NumberInterface> {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check if the thread was interrupted and
|
* Check if the thread was interrupted and
|
||||||
|
@ -158,14 +158,6 @@ public abstract class NumberInterface {
|
||||||
return intPowInternal(exponent);
|
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().
|
* Same as Math.signum().
|
||||||
*
|
*
|
||||||
|
|
|
@ -68,6 +68,7 @@ class Abacus(val configuration: Configuration) {
|
||||||
pluginManager.reload()
|
pluginManager.reload()
|
||||||
with(mutableContext) {
|
with(mutableContext) {
|
||||||
numberImplementation = pluginManager.numberImplementationFor(configuration.numberImplementation)
|
numberImplementation = pluginManager.numberImplementationFor(configuration.numberImplementation)
|
||||||
|
?: StandardPlugin.IMPLEMENTATION_NAIVE
|
||||||
clearVariables()
|
clearVariables()
|
||||||
clearDefinitions()
|
clearDefinitions()
|
||||||
}
|
}
|
||||||
|
@ -87,7 +88,7 @@ class Abacus(val configuration: Configuration) {
|
||||||
* @param input the input string to parse
|
* @param input the input string to parse
|
||||||
* @return the resulting tree, null if the tree builder or the produced tree are null.
|
* @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.
|
* Evaluates the given tree.
|
||||||
*
|
*
|
||||||
|
|
Loading…
Reference in New Issue
Block a user