Commit Graph

2245 Commits

Author SHA1 Message Date
Don Cross
af63d1520f JavaScript: Jupiter's moons returned by name
It makes more sense to report Jupiter's moons with
individually named structure fields rather than an array.
It reduces the overall code and documentation size,
and outside of unit testing, there are few cases
where iterating over an array of moons is more
lucid than using the names of the moons.

This is a breaking change, but hopefully very few
developers are using this function yet.
Fixing the breakage is very simple.
2022-05-05 12:10:33 -04:00
Don Cross
50c4099184 C#: Jupiter's moons returned by name
It makes more sense to report Jupiter's moons with
individually named structure fields rather than an array.
It reduces the overall code and documentation size,
and outside of unit testing, there are few cases
where iterating over an array of moons is more
lucid than using the names of the moons.

This is a breaking change, but hopefully very few
developers are using this function yet.
Fixing the breakage is very simple.
2022-05-05 11:38:55 -04:00
Don Cross
2247084943 C/C++: Jupiter's moons returned by name
It makes more sense to report Jupiter's moons with
individually named structure fields rather than an array.
It reduces the overall code and documentation size,
and outside of unit testing, there are few cases
where iterating over an array of moons is more
lucid than using the names of the moons.

This is a breaking change, but hopefully very few
developers are using this function yet.
Fixing the breakage is very simple.
2022-05-05 10:26:25 -04:00
Don Cross
87665fe5d5 Added missing Windows batch files: rundemo.bat
The help pages for the Java and Kotlin demos mention
a Windows batch file `rundemo.bat`, but they did not exist.
I created them, so now the documentation is correct.
2022-05-04 21:44:04 -04:00
Don Cross
b0fea77337 Minor wording change about identifier consistency. 2022-05-04 21:39:02 -04:00
Don Cross
f6cb94d53c Deleted obsolete files. 2022-05-04 21:35:02 -04:00
Don Cross
0151df1b83 Update Kotlin main README, insert version.
Automatically copy the version number from the gradle
settings file into the README. Cleaned up the README.
2022-05-04 21:14:49 -04:00
Don Cross
a84bc57fb8 Merge branch 'ebraminio' 2022-05-04 20:41:26 -04:00
Don Cross
945bb3eebc Fix same exception ebraminio did in moonradar.html 2022-05-04 20:40:45 -04:00
Don Cross
99fec87a47 Merge branch 'master' of https://github.com/ebraminio/astronomy into ebraminio 2022-05-04 20:37:15 -04:00
Don Cross
62ead77685 Merge branch 'ebraminio' into kotlin 2022-05-04 17:42:30 -04:00
Ebrahim Byagowi
adeb4de8ab jvm demos: Use let in RiseSetCulm.maybe 2022-05-05 01:47:04 +04:30
Ebrahim Byagowi
79aee817cf jvm demos: Use Jupiter moon names instead direct access
Makes the Kotlin demo similar to Java one.
2022-05-05 01:39:12 +04:30
Ebrahim Byagowi
37ca6c4fe3 jvm demos: Use stream/sequence
Uses of newer language structures to recreate the needed logic.
2022-05-05 01:38:14 +04:30
Don Cross
cc4bc88fbe Improved efficiency of 3 lunar eclipse demos.
Three of the lunar eclipse demos (Python, Java, Kotlin)
provided a less than ideal example of efficient computation.
They were wasting a lunar eclipse search by calculating it
but not printing it. Now after printing exactly 10 lunar
eclipses, stop running immediately.
2022-05-04 14:00:35 -04:00
Don Cross
29e2bd31b8 Java demo: lunar eclipse prediction 2022-05-04 13:04:39 -04:00
Don Cross
25adb13997 Kotlin demo: lunar eclipse prediction 2022-05-04 12:49:46 -04:00
Don Cross
7a916d4f8c Java demo: rise/set/culmination
Added Java demo to search for rise/set/culmination
of the Sun and Moon.

Also added the missing entry for the Kotlin
rise/set/culmination demo that I had forgotten.
2022-05-04 11:12:49 -04:00
Don Cross
bdb28eee2e Kotlin demo: rise/set/culmination
Added Kotlin demo to search for rise/set/culmination
of the Sun and Moon.

Enhanced the Time class to allow it to be
directly compared and sorted.
2022-05-03 21:09:56 -04:00
Don Cross
f32a922ddb Demo for Kotlin, Java: constellation 2022-05-03 16:50:11 -04:00
Don Cross
984ebf6a07 Merge pull request #214 from ebraminio/kotlin
jvm: Upgrade Java language version to 11
2022-05-03 13:37:36 -04:00
Ebrahim Byagowi
c24d49f742 jvm: Upgrade Java language version to 11 2022-05-03 21:57:57 +04:30
Don Cross
c9f2228827 Cannot use Optional<T>.isEmpty() in Java 1.8.
Our GitHub Actions tests were using a Java 11
function `Optional<T>.isEmpty()`, but it runs using
Java 1.8. Replaced `isEmpty` with `!isPresent`.
2022-05-02 20:34:29 -04:00
Don Cross
a66fa24def Merge branch 'ebraminio-kotlin' into kotlin 2022-05-02 19:14:38 -04:00
Ebrahim Byagowi
6c55d15778 jvm demos: Simplify main function
Also makes the two more similar.
2022-05-03 01:41:06 +04:30
Ebrahim Byagowi
612f2ef3f4 jvm demos: Apply IDE provided suggestions 2022-05-03 01:27:05 +04:30
Don Cross
1e84f4940f Demo jupiter_moons for Kotlin, Java.
Added Kotlin and Java demos for calculating Jupiter's moons.
Illustrates correcting for light travel time.
I added named getters for the 4 moons in `JupiterMoonsInfo`,
because in Java it was really ugly to write
`jm.getMoon()[0]`, etc.
2022-05-02 15:45:10 -04:00
Don Cross
f670ae2127 Added Kotlin demo: jupiter_moons.
I had to add a new method `Vector.withTime` to work around
the error checking that throws an exception if vectors
from different times are added.

Also made Kotlin constants public:

    MINUTES_PER_DAY
    SECONDS_PER_DAY
    MILLISECONDS_PER_DAY
2022-05-02 14:57:16 -04:00
Don Cross
5df9b03e7c Added comments to Java demos. 2022-05-02 13:38:31 -04:00
Don Cross
90aa6ed369 Cleaned up GitHub Actions configuration.
Deleted the do-nothing placeholders for installing
the Kotlin Native compiler. We are not going to support
Kotlin Native for now.

Removed redundant installation of pylint from the
Windows commit_hook.bat.

Other batch file cleanup, now that I know "||" works in Windows.
2022-05-02 12:30:23 -04:00
Don Cross
e11cb1721b Simplified demotest scripts for C, C#, JS, PY.
I made the scripts for testing the demos for
C, C#, JavaScript, and Python follow the improved
pattern used for Java and Kotlin: much smaller
and easier to maintain thanks to bash functions.
2022-05-02 12:27:19 -04:00
Don Cross
cd5f254b86 Merge branch 'matrix_workflow' into kotlin 2022-05-02 11:28:49 -04:00
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
60c6286422 Merge branch 'kotlin' of https://github.com/HrBDev/astronomy into matrix_workflow 2022-05-01 21:46:46 -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
b03171ac3a Added code comments for the Kotlin demos. 2022-05-01 16:45:57 -04:00
Don Cross
5cb273ceed Starting to add Kotlin demos.
Just like we have Java demos that use the Kotlin
version of Astronomy Engine, I want equivalent
demos in Kotlin.
2022-05-01 16:39:14 -04:00
Hamidreza Bayat
0a2fdbfd8d Use conditions & matrix for workflow 2022-05-01 20:12:42 +04:30
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
f98f64b9ef Removed the stub Android demo. 2022-04-30 21:38:03 -04:00
Don Cross
303bebdff5 Added Java demo for calculating seasons. 2022-04-30 21:20:33 -04:00
Don Cross
efc59ae6fc Refactored demo tests.
I refactored the unit tests for all the demo programs
to follow a different pattern that makes it simpler
to add more demo tests in the future.

The main thing is that correct output and generated
output are now in separate directories `correct` and `test`.
I have moved the test scripts from `test/test` to `./demotest`
in all the langauge demo directories.

This makes it simpler to clean up any stale generated
files before each test run by `rm -f test/*.txt`.

I stumbled across this while making the Java demo tests,
and it was a better solution, so now all the other languages
are consistent with the Java demo tests.

In the C demo tests, I also decided to compile all the
binary executables into a subdirectory `bin` that can
be cleaned out before each run, to make sure there are
no stale executables from an earlier run.
2022-04-30 21:01:11 -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
3ff72cc715 Merge branch 'ebraminio-kotlin' into kotlin 2022-04-30 11:16:07 -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