Skip to content

Commit

Permalink
ICU-22679 Refactor Islamic Calendar and Optmize starting condition of…
Browse files Browse the repository at this point in the history
… loop.

Refactor different rules into implementation of private interface Algorithm.
Since IslamicCalendar is public in Java (not in C++), we cannot put them into different subclass of Calendar and have to let them use the same class and object since the caller UNFORTUNALLY can call setCalculationType and setCivil to change the object to different rule. With this refactoring, we group the formula for the same rule into the same Algorithm
implementaiton and now we only do the if/switch check in the constructor or during the call of setCalculationType and setCivil only. The calculation operation is then just delegate the work to the assigned concrete Algorithm.

Improve the efficency while the month is very large. Apply the same optimization in PR 2853 which estimate starting point of year iteration based on an inverse calculation.

ICU-22679 change parameter name

ICU-22679 Use Consumer
  • Loading branch information
FrankYFTang committed Mar 15, 2024
1 parent 5401c12 commit f709987
Showing 1 changed file with 342 additions and 192 deletions.
Loading

0 comments on commit f709987

Please sign in to comment.