summaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2025-06-15Merge branch 'release-1.0.0' into developdevelopAdrien Hopkins
2025-06-15Bump version number to 1.0.0v1.0.0Adrien Hopkins
2025-06-15Format & clean up source codeAdrien Hopkins
2025-06-15Update changelog for release 1.0.0Adrien Hopkins
2025-06-15Fix potential resource leaks in PresenterAdrien Hopkins
2025-06-15Revert expressionToRPN to package-privateAdrien Hopkins
This resolves the last remaining TODO/FIXME comment
2025-06-10Correct sample expressions in about textAdrien Hopkins
The expressions were valid, but used 'hr' instead of 'h' for the hour, which is not the abbreviation used by 7Units.
2025-06-07Fix e-notation & consolidate expression parsingAdrien Hopkins
This commit moves all of the expression formatting code to one method, and changes it so that it works with things like '1e+2'. This does mean that I had to require spaces for addition and subtraction, but without that, the rules would be complicated.
2025-06-04Add more tests for internationalizationAdrien Hopkins
It seems the I18nTest class was incomplete - I just had one test, checking that English exists. I guess my coverage-based approach didn't catch it.
2025-06-04Add version numbers to all @since tagsAdrien Hopkins
Specifically, for every @since tag with a date, I added another that contains the correspending version. I did not add date @since tags to comments that do not have them, as that would be too tedious for what it's worth. These dates could still be found by using git bisect though.
2025-06-04Update copyright notices' yearsAdrien Hopkins
I used the Git history for years after 2019, and only included 2019 or 2018 if they were already there. I also added copyright notices to all code files that don't already have them.
2025-06-04Remove most comment warningsAdrien Hopkins
In some cases I've used @SuppressWarnings, which Gradle doesn't seem to respect, but I've solved all the other ones.
2025-06-01Update documentation to version 1.0.0Adrien Hopkins
2025-06-01Save & load default datafile use settingAdrien Hopkins
2025-06-01Update READMEAdrien Hopkins
2025-05-30Bump version to 1.0.0b2v1.0.0b2Adrien Hopkins
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.
2025-05-30Update roadmapAdrien Hopkins
2025-05-30Ensure LinearUnit&Prefix ==/hash obey contractsAdrien Hopkins
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.
2025-05-30Allow prefix search toString to be in any orderAdrien Hopkins
The order will be determined by hashes, but it doesn't matter which one goes where.
2025-05-30Remove Unitlike/MultiUnitAdrien Hopkins
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.
2025-05-30Throw error on expressions with too many operatorsAdrien Hopkins
2025-05-30ExpressionParser: use correct operand orderAdrien Hopkins
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).
2025-05-21Add tests for submethods of ExpressionParserAdrien Hopkins
These tests fail right now, because ExpressionParser has a bug. They should help me fix it.
2025-05-17Setup automated javadocAdrien Hopkins
./gradlew javadoc
2025-05-09Add tests for PresenterAdrien Hopkins
2025-04-30Add more UnitDatabase testsAdrien Hopkins
2025-04-20Improve Metric base units SuppressWarnings messageAdrien Hopkins
2025-03-21Add tests for NameSymbolAdrien Hopkins
2025-03-07Add javadoc option to gradleAdrien Hopkins
I am not adding it to build yet since my javadoc has problems, but I will once those are fixed.
2025-03-07convertToMulti: Compare unit bases to this.baseAdrien Hopkins
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.
2025-03-07Add tests for LinearUnitValueAdrien Hopkins
I specifically added tests for the methods that Jacoco says haven't been tested: - convertToMultiple - equals - equivalent - hashCode - operation methods
2025-02-23Bump version number to 1.0.0b1v1.0.0b1Adrien Hopkins
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.
2025-02-23Gracefully handle unidentified locales in configAdrien Hopkins
2025-02-23Merge branch 'i18n' into developAdrien Hopkins
This merge adds the internationalization features, the final required feature for 7Units version 1.0.0.
2025-02-23Allow internationalization of about.txtAdrien Hopkins
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.
2025-02-23Allow default datafile to be disabledAdrien Hopkins
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.
2025-02-23Complete French locale translationAdrien Hopkins
2025-02-23Localize all user-facing stringsAdrien Hopkins
2025-02-23Add ability for user to change localeAdrien Hopkins
2025-02-23Load locales from text filesAdrien Hopkins
2025-02-23Add internationalization API to GUIAdrien Hopkins
This commit intentionally fails one test, since that is for functionality I intend to add later.
2024-08-28Bump version number to 1.0.0a1v1.0.0a1Adrien Hopkins
2024-08-22Add loading counts to About tabAdrien Hopkins
2024-08-22Update changelogAdrien Hopkins
2024-08-22Show unit/dim file errors as popupAdrien Hopkins
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.
2024-08-22Add 1e-12 to unit sum parts before flooringAdrien Hopkins
This ensures that small errors from floor arithmetic will not, for example, cause 2 feet to be converted to 1 foot + 12 in.
2024-08-22Allow fractional exponentsAdrien Hopkins
2024-08-22Add more information to load-success messageAdrien Hopkins
2024-08-22Print nonfinal unit set coefficients as integersAdrien Hopkins
These values are guaranteed to be integers, so printing them without a decimal point looks nicer and saves space.
2024-08-22Validate unit set non-emptiness & dimensionAdrien Hopkins