diff --git a/.gitignore b/.gitignore index bade31f..d64610c 100644 --- a/.gitignore +++ b/.gitignore @@ -17,3 +17,4 @@ /d4rt_formulas.iml .aider* .build-container-cache +/coverage/ diff --git a/CLAUDE.md b/CLAUDE.md index e2d61c3..00d0338 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -8,6 +8,6 @@ - Examples: - `flutter pub get` --> `./flutterw pub get` - `flutter run -d linux` --> `./flutterw run -d linux` -- See `./Makefile` for more use examples. +- See `./Makefile` for more examples. diff --git a/TODO.md b/TODO.md new file mode 100644 index 0000000..f359411 --- /dev/null +++ b/TODO.md @@ -0,0 +1,22 @@ +[ ] Means not done +[x] Means done + +- [ ] Unify error reporting. Create class ErrorHandler that get notified of every catched exception. This class prints the exception in stdout. +- Refactor formula and unit loading: + - [ ] Create method `List parseD4rtLiteral(String arrayStringLiteral). It parses a d4rt array literal (containing maps and arrays) to a List using d4rt + - [ ] Remove `fromArrayStringLiteral` from UnitSpec and Formula. + - [ ] Create function `List parseCorpusElements(String arrayStringLiteral)`. It uses parseD4rtLiteral and determines if each element of the array is a formula or a unit. Then converts the objects with Formula.fromSet or UnitSpec.fromSet. + - [ ] Create method loadFormulaElements( List elements). Tipically receives the list from parseCorpusElements(). It loads the units first, then the formulas, to avoid missing dependencies. +- [ ] Use a single table in database `FORMULAELEMENT` to store formulas and units. The table contains only two columns: autonumeric id and text. +- [ ] Create Formula.toStringLiteral. It is the reverse of Formula.fromSet( Formula.fromArrayStringLiteral(string)[0] ) +- [ ] Create UnitSpec.toStringLiteral, like Formula.toStringLiteral +- Database file location: + - [ ] In linux, the sqlite database file will be located following rules at https://specifications.freedesktop.org/basedir/latest/ + - [ ] In Windows, the sqlite database file will be in %appdata%/Roaming + - [ ] In Macos, the sqlite database file will be in ~/Library/Application Support +- [ ] Initialize database at startup + - [ ] If the database is empty, sugest to use a default corpus + - [ ] If the user choose to use the default corpus, populate de database with the default corpus (load defaultcorpus, and the use toStringLiteral) + - [ ] From now on, the corpus will be loaded from database instead of assets +- [ ] Create method List Corpus.withDependencies(Formula formula). It will return the list of units of the formula, and related units from the corpus. +- [ ] Add a Share button to the formula list. It will export the array string literal of the formula with the units from Corpus.withDependencies().