Commit Graph

24 Commits

Author SHA1 Message Date
Don Cross
237bc42084 Added Kotlin demo: positions.
I also reworked how the Java and Kotlin demos
process errors in the command line arguments.
Using exceptions that are caught by main() rather
than directly exiting the process where the errors
are detected.
2022-05-02 11:28:16 -04:00
Don Cross
551ce7a249 Simplified Java/Kotlin demo tests.
I found that it is possible to use the "||" operator
in Windows batch files, and it works the same as the
"||" operator in bash scripts.

This inspired me to rework the bash scripts and
Windows batch files for running the Java/Kotlin demo
tests to be much more compact using functions/subroutines.

The best part is, the new approach will make it much
easier to add more demo tests in the future.

Removed the "now" test from Java demos, because it
does not follow the same pattern as the other demos,
plus it is not really demonstrating astronomy calculations.

Starting working on the Positions.kt demo; but not finished yet.
2022-05-02 10:21:23 -04:00
Don Cross
190cc5b534 Java: added positions demo. 2022-05-01 21:12:57 -04:00
Don Cross
eac8582418 Test Kotlin demos in Windows. 2022-05-01 19:48:18 -04:00
Don Cross
6064bf1d94 Updated README.md for the Java demo suite.
Added link and description of Seasons.java.
Mention `rundemo` script.
2022-05-01 09:40:50 -04:00
Don Cross
99d1aecba7 Minor cleanup to Java demos. 2022-04-30 21:38:32 -04:00
Don Cross
303bebdff5 Added Java demo for calculating seasons. 2022-04-30 21:20:33 -04:00
Don Cross
7c74730d8e Java demos: print error message for unknown verb. 2022-04-30 17:46:15 -04:00
Don Cross
b3d42fc6d5 Java demos: reworked as table-driven.
As I add more Java demos, it will make the code more
compact to factor out argument count checking, etc.
Reworked as a table-driven model instead of using `switch`,
so that I will be able to add new demos more concisely.
2022-04-30 12:20:28 -04:00
Don Cross
8f5f8940bc Java demo: eliminate use of Date. 2022-04-30 11:31:32 -04:00
Don Cross
e81a566d1e Kotlin: was not running Java demo tests.
Run the Java demo unit test as part of the automated test suite.
If the test fails, print the xml test results to the screen,
so if it happens in GitHub Actions, we can see what went wrong
and diagnose the problem.
2022-04-30 11:14:01 -04:00
Ebrahim Byagowi
13f6e98866 Kotlin: Use Instant.parse instead a custom date parser
Also fixes the demo which had the same code.
2022-04-30 12:14:46 +04:30
Don Cross
3ca64f1ab2 Kotlin: fixed Java demo test for Windows.
I forgot to update the Windows batch file
for testing Java demo programs. Now it works
and correctly verifies the output of the
Java demo `MoonPhase`.
2022-04-28 21:52:33 -04:00
Don Cross
05684bafdb Kotlin: added Java demo: moonphase.
This is the first substantial demo of using
the Kotlin version of Astronomy Engine from
a Java program.

Structured the README.md so I can keep adding more and
more demos as separate Java class files.
The `demotest` script builds the code and will run
each demo one at a time, verifying each one's output.
2022-04-28 21:04:54 -04:00
Don Cross
61e398b592 Kotlin: removed all dependencies on JVM.
The Kotlin version of Astronomy Engine was using Java
classes like `Date` and `GregorianCalendar`.

Reworked the code to use a completely self-contained
representation of calendar date/time, just like the C version does.
Now Astronomy Engine does not depend on anything outside of
the Kotlin standard library. This should allow us to use
Astronomy Engine for Kotlin Native apps, Web Assembly, etc.

Updated Java demo to use the new method Time.fromMillisecondsSince1970.
2022-04-14 10:55:22 -04:00
Ebrahim Byagowi
7ad9487c3e kotlin: Upgrade Android example to use the new namings 2022-04-12 23:29:09 +04:30
Don Cross
79ff7b2805 Kotlin: Create fatJar during initial build.
Moved the step that creates the fatJar into
the main build process for Kotlin. This is
needed to run the Java demos, and it is good
to fail early if it cannot be built.
2022-04-12 10:37:02 -04:00
Ebrahim Byagowi
6ac0dcbff4 kotlin: Directly provide the library to demo
No longer having jitpack as the middle man and just directly building
demo from the project itself.
2022-04-12 12:06:58 +04:30
Don Cross
57a736067a Kotlin: renamed AstroTime, AstroVector.
Renamed AstroTime to Time.
Renamed AstroVector to Vector.
For some reason this breaks the Java demo build.
I'm pushing the broken build anyway to see if
ebraminio can help me fix it.
2022-04-11 20:17:59 -04:00
Don Cross
57ab910abb Automate validation of Java demos in Windows. 2022-03-22 16:04:36 -04:00
Don Cross
ae5e744e1b Verify that Java demos work. Prep more demos.
Restructured the Java code so we pass in command
line arguments to select which demo we want to run.
We will also pass in date/time, latitude/longitude,
or whatever numeric data we need for future demos.

Automated test run of the Java demos from the
unit test suite.
2022-03-22 12:55:49 -04:00
Ebrahim Byagowi
c588da34c9 jvm: Make the demo project able to produce fat jars
Adopted from https://stackoverflow.com/a/63332420

So one can run the demo with `./gradlew jar && java -jar build/libs/astronomy-demo-0.0.1.jar`
instead `./gradlew run`
2022-03-22 19:25:41 +04:30
Don Cross
f031d6fc64 Added placeholder links to Android, Java demos. 2022-03-21 20:52:46 -04:00
Ebrahim Byagowi
c318b586eb kotlin: Add a Java demo project 2022-03-22 04:33:10 +04:30