1
0
mirror of https://github.com/DanilaFe/abacus synced 2024-06-27 13:16:23 -07:00
Commit Graph

309 Commits

Author SHA1 Message Date
3ce74303ed Format code. 2017-07-30 21:11:32 -07:00
122874b97a Move all functions to a static context, stopping unnecessary lookups. 2017-07-30 21:10:11 -07:00
0125980c5a Write tests involving plugin loading, and generalize token testing code. 2017-07-30 19:21:26 -07:00
cb7d0f309b Remove the window as a part of the Abacus class. 2017-07-30 15:00:08 -07:00
cb98601ae5 Add some comments. 2017-07-30 14:59:20 -07:00
67b95edd44 Write basic tokenizer tests. 2017-07-30 14:52:10 -07:00
960f891393 Remove abacus dependency from PluginManager. 2017-07-30 14:42:06 -07:00
b599bef775 Write more tests for the Lexer. 2017-07-30 14:12:17 -07:00
28004ed98d Write tests for special cases. 2017-07-30 00:46:42 -07:00
317cc552e6 Write basic tests for string matching. 2017-07-29 23:48:01 -07:00
43c11f8454 Move the source files into a new default directory. 2017-07-29 23:44:21 -07:00
3131d96d07 Merge branch 'new-parser-prep' into unit-tests 2017-07-29 23:42:23 -07:00
7b2ee1c87a Create empty class, getting ready to write tests. 2017-07-29 21:49:36 -07:00
274826cc09 Replace the old TreeBuilder with the new TreeBuilder. 2017-07-29 21:37:55 -07:00
bfee4ec322 Implement a LexerTokenizer and a ShuntingYard parser.
These are basically two pieces of the old TreeBuilder, but decoupled
and reimplemented conventionally.
2017-07-29 21:37:32 -07:00
bd1f7b8786 Add comments to the two parsing interfaces. 2017-07-29 21:36:39 -07:00
90c6625108 Change matches to store the string they matched. 2017-07-29 21:20:11 -07:00
a99b6b647f Implement the components of a new tree builder. 2017-07-29 21:02:41 -07:00
9454620489 Remove precision specification as it seems detrimental. 2017-07-28 22:51:59 -07:00
1160768ee5 Allow plugins to register number implementations and use user's choice. 2017-07-28 22:17:22 -07:00
1ce9fc6b1c Add configuration object to Abacus. 2017-07-28 21:37:47 -07:00
acf3d85584 Merge branch 'configuration' into architecture 2017-07-28 21:31:45 -07:00
6c80d8fe93 Rewrite Abacus to be the central class of the application. 2017-07-28 21:25:02 -07:00
c230675855 Change precision to getMaxPrecision, as precision can be configured. 2017-07-28 20:04:13 -07:00
bd44307f2b Create a ConfigurationObject class. 2017-07-28 20:03:50 -07:00
a949a27da4 Make ClassFinder return generic List objects. 2017-07-28 19:36:34 -07:00
5c301e4afa Load default plugin without jars. 2017-07-28 15:22:38 -07:00
8c5306051e Add a toString for UnaryPrefixNode 2017-07-28 14:57:11 -07:00
c3bb3d7d3f Remove unused default value from PreciseNumber 2017-07-28 14:55:01 -07:00
556a72f946 Change the constructor for NumberNode 2017-07-28 14:47:34 -07:00
f303093a3f Add a promotion priority to PerciseNumber 2017-07-28 14:39:37 -07:00
8dae4a880e Comment class finder. 2017-07-28 14:32:27 -07:00
243dc81deb Change ClassFinder code to be static. 2017-07-28 14:21:43 -07:00
0c07695991 Merge branch 'unary' 2017-07-28 13:28:59 -07:00
ff689f9bd5 Merge branch 'big-decimal' 2017-07-28 13:18:44 -07:00
Arthur Drobot
c184b55738 Implement preciseNumber for arbitrary precision. 2017-07-28 11:38:22 -07:00
dc410917b3 Remove old ClassFinder and hardcoded folder names, and fix class filter. 2017-07-28 11:35:23 -07:00
9850f896bb Remove unneeded files from git. 2017-07-28 11:23:25 -07:00
0b3648d4f3 Fix null pointer exceptions associated with turning ! into an operator. 2017-07-28 11:19:41 -07:00
rileyJones
69e3b55643 Add external plugin support 2017-07-28 11:17:54 -07:00
2ba6e22fcb Rename OpNode to BinaryInfixNode. 2017-07-28 11:15:36 -07:00
5228773b5e Implement unary operators. 2017-07-28 11:14:45 -07:00
42393ca6a6 Add operator types. 2017-07-28 10:26:25 -07:00
b20ddc2013 Add rounding to naive number. 2017-07-28 09:57:39 -07:00
a881640bf6 Make the decimal matching optional. 2017-07-28 09:52:14 -07:00
0263086e10 Add link nodes to collections and check for their presence.
This prevents infinite loops, as Link nodes do not follow regular
addInto behavior.
2017-07-28 09:51:59 -07:00
c9fad36d16 Fix bug causing an NPE when sqrt() was called. 2017-07-27 19:30:40 -07:00
2cc4bd14ce Switch all uses of *List, *Map to just List and Map. 2017-07-27 18:19:12 -07:00
f119f19c04 Make pow an operator, represented by caret. 2017-07-27 16:55:18 -07:00
65772c8d57 Fix function argument order. 2017-07-27 16:52:16 -07:00
bbbb2e855e Fix typo. 2017-07-27 16:37:54 -07:00
8a29019852 Add ignoring whitespace and fix function precedence. 2017-07-27 16:36:13 -07:00
0d7a416446 Add a missing comment. 2017-07-27 16:27:26 -07:00
167e13cfe1 Merge branch 'master' of github.com:DanilaFe/abacus 2017-07-27 15:28:21 -07:00
b0ae3f90fc Add sanitization to TreeBuilder. 2017-07-27 15:26:02 -07:00
a7c2084254 Remove backslashes that will be obsolete. 2017-07-27 15:02:13 -07:00
rileyJones
bf6f48bf82 Jar Plugin Loader 2017-07-27 14:33:08 -07:00
f7da896fc0 Fix several bugs and register operations as operations. 2017-07-27 14:15:45 -07:00
6813643b15 Merge branch 'plugins' 2017-07-27 14:08:40 -07:00
e6cb755ec9 Merge branch 'master' of github.com:DanilaFe/abacus 2017-07-27 14:08:31 -07:00
2ca23fd427 Implement correct plugin loading and registration. 2017-07-27 14:06:57 -07:00
efbd6a4c20 Add missing return documentation. 2017-07-27 14:06:25 -07:00
a211884499 Prevent operation lookups, as they pollute the cache. 2017-07-27 14:06:15 -07:00
f2c280766d Add a PluginListener type for use in the PluginManager. 2017-07-27 14:06:04 -07:00
Arthur Drobot
088a45cf4c Add sqrt function. 2017-07-27 13:47:51 -07:00
Arthur Drobot
557bc66e53 Begin working on memoization for factorial. (Commented out for now.) 2017-07-27 13:39:19 -07:00
e6559015b3 Rename load to onLoad and add onDisable to plugin. 2017-07-27 13:26:17 -07:00
f931b9f322 Move parsing code into TreeBuilder, change lexing and parsing algorithms 2017-07-27 13:25:57 -07:00
Arthur Drobot
9666ef9019 Add pow function. 2017-07-27 13:17:22 -07:00
Arthur Drobot
ba30227b28 Add natural log function. May not be terribly efficient currently, but it works and is usable. 2017-07-27 13:04:41 -07:00
78e2d50f89 Add comments and clear appropriate cache. 2017-07-27 10:58:11 -07:00
07dd9d0a1a Support removing expressions. 2017-07-27 10:54:11 -07:00
ee1de6dc17 Add the operator that had been in use by Plugin and PluginManager. 2017-07-27 10:53:56 -07:00
077a34c618 Switch Lexer to use a map for patterns, to allow for removal. 2017-07-27 10:47:11 -07:00
79e85832ce Add operator map to Plugin class, and use it in PluginManager. 2017-07-27 10:38:18 -07:00
Arthur Drobot
ea5a7a9558 Increase precision of NaiveNumber to 18. 2017-07-27 10:32:09 -07:00
Arthur Drobot
3e52a9d645 Modify exp to work properly with the new changes and support all reals. 2017-07-27 10:16:38 -07:00
Arthur Drobot
7a0fa31cad Merge branch 'master' of https://github.com/DanilaFe/abacus 2017-07-27 10:07:07 -07:00
Arthur Drobot
aec37b6720 Add absolute value function to standard plugin. Modify getNTermsExp to work on negative exponents instead (and correctly). 2017-07-27 10:03:26 -07:00
189f8c6e15 Move OperatorAssociativity into the function class. 2017-07-27 09:33:01 -07:00
e8595510b8 Remove the caret operator as it is not implemented. 2017-07-27 09:23:07 -07:00
b09c9c3cb2 Remove unnecessary getType() calls. 2017-07-27 09:22:24 -07:00
b0a7c90aa1 Fix strangely incomplete comment. 2017-07-26 19:28:57 -07:00
cf95ed7dc0 Add comments to NumberReducer and FunctionNode. 2017-07-26 19:16:10 -07:00
bc72b4da8a Comment and clean up the Window class. 2017-07-26 19:10:55 -07:00
15d7dbd30e Comment and clean up HistoryTableModel code. 2017-07-26 19:04:39 -07:00
c8146954c3 Implement reducing functions. 2017-07-26 18:44:30 -07:00
d18e27bdb4 Implement parsing functions. 2017-07-26 18:44:17 -07:00
c4eb70999b Add correct handling of failed reduces to both OpNode and Window. 2017-07-26 18:41:21 -07:00
4a8164631f Merge branch 'master' into ui-touchup 2017-07-26 17:27:05 -07:00
d7caf1cdc7 Implement toString in child nodes of TreeNode. 2017-07-26 17:26:55 -07:00
8754871556 Make some operator-related fields protected in TreeNode.
This should allow for the implementation of toString in child nodes.
2017-07-26 17:26:42 -07:00
b31c1f9624 Change default calculator width. 2017-07-26 17:19:43 -07:00
2b7a68e179 Rename some variables to more appropriate names. 2017-07-26 17:18:40 -07:00
e06feaa581 Separate UI into tabbed panes, and change layout of side panel. 2017-07-26 17:17:21 -07:00
626a2cb514 Temporarily move components into a tabbed pane. 2017-07-26 15:35:59 -07:00
Arthur Drobot
0002f14e61 Merge branch 'master' of https://github.com/DanilaFe/abacus 2017-07-26 15:27:22 -07:00
Arthur Drobot
f35f83a92f Merge branch 'master' of https://github.com/DanilaFe/abacus 2017-07-26 15:26:35 -07:00
Arthur Drobot
8d9dac1a75 Add exp and helper functions for Taylor Series etc. 2017-07-26 15:26:06 -07:00
Arthur Drobot
aae7e678dd Change precision of NaiveNumber to 15. 2017-07-26 15:24:24 -07:00
a446034a92 Add exit on close. 2017-07-26 15:23:22 -07:00
78033e93b0 Make enter key call evaluate entered expression. 2017-07-26 15:22:29 -07:00
2074c11095 Merge branch 'master' of github.com:DanilaFe/abacus 2017-07-26 14:49:34 -07:00
95bae3befb Add copy pasting to history. 2017-07-26 14:48:43 -07:00
e41c25847b Implement a table as a history tracker. 2017-07-26 14:34:19 -07:00
50baf80433 Add a new constructor to the UI, and move strings into constants. 2017-07-26 13:33:24 -07:00
f7d4d01bc8 Correctly handle invalid strings. 2017-07-26 13:25:12 -07:00
ec030607bf Remove unnecessary pattern. 2017-07-26 13:25:01 -07:00
e816b86a3e Correctly handle un-matched tokens and end-of-string situations. 2017-07-26 13:24:46 -07:00
Arthur Drobot
356084ef61 Modify precision of NaiveNumber. Fix factorial to work with 0./a.exe Add function to get nth term of the exp Maclaurin series. 2017-07-26 11:05:12 -07:00
798ee6f7c3 Implement the ability to reduce a tree to a single variable of a type. 2017-07-26 10:58:27 -07:00
ac153521d4 Comment the PluginManager and change pluginFor to functionFor 2017-07-26 10:15:22 -07:00
08999350f4 Add more comments. 2017-07-26 10:10:37 -07:00
Arthur Drobot
1b9dc5514e Merge branch 'master' of https://github.com/DanilaFe/abacus 2017-07-26 09:19:42 -07:00
c19ae3b071 Add a lot of comments. More to come. 2017-07-25 22:47:48 -07:00
ade4eb1035 Make some adjustments to the UI. 2017-07-25 22:08:12 -07:00
31b6adecd9 Move function into its own package. 2017-07-25 21:57:14 -07:00
08a462b8f3 Add the plugin manager to the main. Abacus class. 2017-07-25 21:52:23 -07:00
989ac80bf4 Move the standard functions into a standard plugin. 2017-07-25 21:50:41 -07:00
3cf4f958b0 Rename ExternalFunction --> Plugin, and implement plugin loading. 2017-07-25 21:50:30 -07:00
7e7525cf37 Tidy Window class with more explicit variable names and private vars. 2017-07-25 21:13:18 -07:00
b93346ec37 Make the program actually create the UI. 2017-07-25 21:11:36 -07:00
cc5d487386 Delete unused main method. 2017-07-25 21:11:11 -07:00
rileyJones
27cf6ce64b Add GUI 2017-07-25 14:52:57 -07:00
Arthur Drobot
5f60110385 Add support for non-positive ints in intPow for NaiveNumber. 2017-07-25 14:36:46 -07:00
38255b1219 Merge tree construction feature into master. 2017-07-25 14:28:12 -07:00
e4e9e2ce21 Implement parsing a postfix expression into a tree. 2017-07-25 14:21:00 -07:00
Arthur Drobot
1112dafadf Fix intPow loop. 2017-07-25 14:18:00 -07:00
Arthur Drobot
54340ada63 Fix initial array index in the product function. 2017-07-25 14:08:46 -07:00
Arthur Drobot
21cd9fd052 Rename Number to NumberInterface. Fix factorial function. Add toString override to NaiveNumber. 2017-07-25 13:58:09 -07:00
3684673362 Implement Shunting Yard. 2017-07-25 13:53:38 -07:00
043d02ead2 Fix a bug in the pattern class. 2017-07-25 13:53:19 -07:00
Arthur Drobot
afcddafd81 Merge branch 'master' of https://github.com/DanilaFe/abacus 2017-07-25 11:46:36 -07:00
Arthur Drobot
dbf7d587ed Add intPow to Number intefrace and NaiveNumber. 2017-07-25 11:46:15 -07:00
Riley Jones
07acfefd0b Merge branch 'master' of https://github.com/DanilaFe/abacus 2017-07-25 11:15:09 -07:00
Riley Jones
e99afa0507 Add an abstact class for external functions 2017-07-25 11:14:59 -07:00
Arthur Drobot
67f8c648db Add factorial (external). 2017-07-25 11:12:25 -07:00
Arthur Drobot
254276b2af In Number interface: remove one and zero (they can't be static), add compareTo and signum. Modify NaiveNumber accordingly. 2017-07-25 11:09:23 -07:00
1dcd6beb1c Implement two enums for conversion between strings and tokens. 2017-07-25 11:08:03 -07:00
42db6b3c2f Fix bug causing the last character not to be matched. 2017-07-24 21:00:35 -07:00
c86e192d2e Implement a lexer. 2017-07-24 20:47:25 -07:00
43c3d5f754 Fix a few bug in the pattern compilation code. 2017-07-24 20:47:13 -07:00
ac3087fc3f Add a new function to add children into collection. 2017-07-24 20:45:56 -07:00
02141d8df0 Switch underlying implementation to Set from List. 2017-07-24 19:46:22 -07:00
6200381016 Implement a tentative pattern class that can be compiled from a string. 2017-07-24 19:45:32 -07:00
2374c167a4 Implement a few nodes for the pattern matching. 2017-07-24 17:42:25 -07:00
Arthur Drobot
3b91304175 Add the four external essential functions. 2017-07-24 14:48:16 -07:00
6919fac18f Add promotion implementation. 2017-07-24 14:37:56 -07:00
7bab3773dc Add a map to promoting priorities. 2017-07-24 14:26:09 -07:00
d0421d93ca Remove functions that obviously don't work. 2017-07-24 14:25:59 -07:00
8a3e5cc5c7 Change function to return null on error, and change arity checks. 2017-07-24 14:03:55 -07:00
dff4c99126 Add a way to get a value of a primitive number to the Number interface. 2017-07-24 13:57:14 -07:00
8ed2c77fec Add a Function abstract class and a Function database. 2017-07-24 13:44:38 -07:00
7fdae4285b Fix copy pasting in NaiveNumber. 2017-07-24 13:44:09 -07:00
aec9953af2 Add precision getter to NaiveNumber. 2017-07-24 13:44:02 -07:00
9345faf7d3 Add a naive number implementation that uses doubles. 2017-07-24 11:13:18 -07:00
Arthur Drobot
239ab7b73f Add Number interface. 2017-07-24 10:56:50 -07:00
Artur Drobot
8fcf8c747d Create Number interface. 2017-07-24 10:53:23 -07:00
cb14239b95 Create a test main file. 2017-07-24 10:04:00 -07:00