Age | Commit message (Collapse) | Author |
|
|
|
All that's left before 1.0.0 is released is the documentation fixes.
Unless I find any major issues, 7Units 1.0.0 releases June 8.
|
|
Previously, these classes' equals() and hashCode() methods did not obey
the contracts:
For equals(), I considered two values equal even if there was a very
small deviation, in order to avoid floating-point error. This equals
relation is not transitive (i.e. it is possible that a = b && b = c but
a ≠ c), violating the contract of equals.
This also makes it impossible to properly implement hashCode, as if two
values are equal, they must have the same hash code. The solution I had
provided is an ineffective hack, which could mess with hash maps and
sets.
I have changed the implementation to demand exact equality. I have also
provided equalsApproximately() methods to both classes that use the old
behaviour. Hash codes are only really used for hash maps, and the old
implementation doesn't even achieve its purpose, so I did not add a
method to return the old hash behaviour.
|
|
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).
|
|
./gradlew javadoc
|
|
|
|
|
|
|
|
|
|
This is a necessary precondition for the conversion methods used later
on in convertToMutliple, and it is simpler than the existing method.
I can also be sure it works, due to the tests I just wrote.
|
|
Compared to version 0.5.0, this release:
- allows conversion to sums of units (e.g. 4/3 ft → 1 ft + 4 in)
- allows non-integer exponents in expressions
- adds the ability to change the UI language
- gracefully handles datafile errors
- adds more information to the loading-success message, and adds it to
the About tab
- allows the user to not use the default datafiles
No new features will be added until the release of version 1.0.0.
|
|
|
|
This works with custom locales (by placing the text in
[config_dir]/about/[name].txt), but if such a file does not exist, it
will default to the default locale (en)'s about text.
|
|
If this option is deselected, the default unit, prefix, dimension and
metric exception data will not be loaded, and only custom data and the
few units that are not provided by files will be available.
The main rationale for this change is so that the data can be localized
by custom unit files.
|
|
|
|
|
|
|
|
|
|
This commit intentionally fails one test, since that is for
functionality I intend to add later.
|
|
|
|
|
|
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.
|
|
This ensures that small errors from floor arithmetic will not, for
example, cause 2 feet to be converted to 1 foot + 12 in.
|
|
|
|
|
|
These values are guaranteed to be integers, so printing them without a
decimal point looks nicer and saves space.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| is like /, but with higher precedence. This feature is a part of GNU
Units, and was included in 7Units for compatibility.
|
|
|
|
|
|
Previously, you could only exponentiate individual dimensions in
expressions. For example, `Length^3` was valid, but `(Length / Time)^2`
was not. This is now fixed.
|
|
This was added to be consistent with the data file spec, which was
changed for consistency with unit expressions. It may not be a common
expression, but it's a bit weird that you can use +/- in units but not
prefixes, even though they're in the same file!
|
|
|
|
|
|
These changes should reduce nesting and increase readability.
|
|
Some settings used to use long, sentence-like values in the config file.
Now, they use simpler values that are easier to remember and specify in
the manual.
|
|
Previously, if the user had no settings dir, starting the program would
create it, but nothing would be read. If the user did not change their
settings, it would just leave an empty directory!
|
|
The parameters "custom_unit_file", "custom_dimension_file" and
"custom_exception_file" can now be used to load custom unit, dimension
and exception files. Specify them more than once to load multiple
files.
I haven't yet added this to the GUI, and I probably won't, because you
already need to be able to edit text files to create this, so having a
GUI won't make it any more intuitive.
|
|
The user's config directory is taken as ~\AppData\Local\ on Windows and
is XDG-compliant elsewhere. The config file's location is <config
dir>/SevenUnits/config.txt. The SevenUnits directory is created if
nonexistent.
The previous location inside the git directory would not work for
someone actually installing and using 7Units, so this change was made.
|
|
|
|
|
|
|