Age | Commit message (Collapse) | Author |
|
I ended up never using this code - it was simpler to just use lists of
units and values. Making a whole new object for lists of units, and an
abstract class for things that convert things other than doubles, is
needlessly complicated, and doesn't solve any major issues. For
example, I still need to store each Unitlike type in a different
collection, because it will have a different type.
|
|
Most of the internal problems with the expression parser happened
because I was accepting the arguments for binary operators in the wrong
order. For example, '2 - 1' became '1 2 -', not '2 1 -'.
The likely cause of this error is the following sequence of events:
- In commit 6dbd32cd, I created the code for interpreting RPN. I
accepted two arguments from the stack (o1 and o2), then performed o1
<op> o2. However, because stacks are in LIFO order, I should have
actually done o2 <op> o1.
- Later, in commit 94349688, I created the code for converting an infix
expression to RPN. Creating the expressions in the correct order did
not work, because my interpreter used the incorrect order. To 'fix'
this problem, I created the expressions in the incorrect order. I did
not notice any discrepancy, probably because I was not testing the
individual methods, only the two-step whole (which found no errors).
|
|
These tests fail right now, because ExpressionParser has a bug. They
should help me fix it.
|
|
|
|
|
|
I specifically added tests for the methods that Jacoco says haven't been
tested:
- convertToMultiple
- equals
- equivalent
- hashCode
- operation methods
|
|
Previously, any error in the unit or dimension file(s) crashes the
program. Instead, 7Units now ignores any invalid lines, still parsing
the correct ones, and shows a popup in case any errors happen.
|
|
|
|
|
|
|
|
|
|
|
|
TabbedView now displays its units, but with their toString method which shows
their definition in addition to their name
|
|
|
|
|
|
|
|
|
|
|
|
Also fixed a bug where a prefixed unit map with units but no prefixes would
appear empty
|
|
|
|
|
|
|
|
The bug: non-exact LinearUnitValue instances have their value printed as "(",
i.e. "(5.0 ± 0.1) m" will be printed as "( m"
|
|
|
|
|
|
|
|
|
|
|