Library untuk mengkonversi format DMS ke Desimal (Double) & format Desimal (Double) ke derajat menit detik (DMS) /jam menit detik (HMS), untuk keperluan komputasi terutama perhitungan Astronomi/Falak.
- mengubah format DMS/HMS ke Double
- mengubah format Double ke j m d
- mengubah format Double ke DMS, ada beberapa varian
- mengubah format Double ke HMS, ada beberapa varian
- Extension function Double.round(), untuk mengcustom pembulatan dibelakang koma
- masukkan kode ini ke settings.gradle.kts (root kotlin dsl) di blok
repositories
dependencyResolutionManagement {
repositories {
// contoh
maven {
url = uri("https://jitpack.io")
}
}
}
jika menggunakan groovy dsl
repositories {
...
maven { url 'https://jitpack.io' }
}
- masukkan dependensi ke build.gradle.kts (app/build.gradle.kts kotlin dsl)
di blok
dependencies
implementation("com.github.hasanelfalakiy:lib-konversi:4.0.1")
jika menggunakan groovy dsl
implementation 'com.github.hasanelfalakiy:lib-konversi:4.0.1'
Praktik implementasi library hisab irsyadul murid
- Part 1 Membuat layout
- Part 2 Implementasi library
- Part 3 Implementasi library
/*
* fungsi mengubah DMS ke Double, jika bernilai negatif,
* wajib memasukkan tanda negatif (-) disetiap input DMS.
* parameter second bisa menerima integer/double
*/
fun toDecimal(degree: Int, minute: Int, second: Number): Double
/*
* fungsi ini mengubah DMS ke Double dengan input data nilai positif semua,
* sedangkan untuk positif/negatif nya tambahkan parameter true untuk positif
* false untuk negatif
*
* tipe Number berarti menerima tipe Integer/Double
*/
fun toDecimalCheck(degree: Int, minute: Int, second: Number, check: Boolean): Double
/*
* HH:MM detik dibulatkan ke menit, menit ke jam jika menit == 60,
* positif/negatif : sama-sama dibulatkan keatas/kebawah (menjauhi nol)
*/
fun toTime(decimal: Double): String
// HH:MM:SS angka dibelakang koma orde detik tidak dibulatkan ke detik integer
fun toTimeFull(decimal: Double): String
// HH:MM:SS angka dibulatkan ke detik
fun toTimeFullRound(decimal: Double): String
// HH:MM:SS,ss dibulatkan ke 2 angka di belakang koma
fun toTimeFullRound2(decimal: Double): String
// DD° MM' SS" angka dibelakang koma orde detik tidak dibulatkan ke detik integer
fun toDegreeFull(decimal: Double): String
// DD° MM' SS" angka dibulatkan ke detik
fun toDegreeFullRound(decimal: Double): String
// DD° MM' SS,ss" dibulatkan ke 2 angka di belakang koma
fun toDegreeFullRound2(decimal: Double): String
// HH j MM m SS,ss d dibulatkan ke 2 angka di belakang koma
fun toCounterTimeRound2(decimal: Double): String
// Extension Function Round, custom round membulatkan angka di belakang koma
fun Double.round( decimals : Int ) : Double
Jika Anda ingin berkontribusi, silahkan menggarpu (Fork) repositori ini, buat perubahan, kirim Pull request ke repositori ini
Library Konversi
Copyright (C) 2023-2024 Andi Hasan Ashari
Library Konversi is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Library Konversi is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Library Konversi. If not, see <https://www.gnu.org/licenses/>.
Report to us if anyone violates the terms of the License, either by creating issues or writing to us directly.