BalineseDate Java Library

Introduction
BalineseDate is an open source library to build Balinese Saka Calendar in Java based application.
Note: This library is in Beta Phase, the API may change without notice.
Features
BalineseDate is designed to be immutable and thread-safe. BalineseDate have several features like:
- Pawukon
- Pawewaran
- Paringkelan
- Eka Jala Rsi (v0.3.0)
- Pratithi Samut Pada (v0.3.0)
- Dewasa (v0.5.0)
- Sasih
- Pawukon/Penanggal and Nguna Ratri.
- Pengalantaka Eka Sungsang Pon (before 2000) & Paing (2000 and after)
- Malamasa (< 1993), Sasih Kesinambungan (1993 - 2002), Nampih Sasih (>= 2003)
- Saka Year
BalineseDate also have several utilities that can be use by developer like:
- Filter BalineseDate(s) from selected Date (v0.2.0)
- Filter BalineseDate(s) from selected BalineseDate List (v0.4.0)
Import BalineseDate into Your Project
BalineseDate Java Library use Jitpack to publish the binary. Choose one of these following method:
Direct Download
Gradle
Please add the repository of Jitpack in the build.gradle of your project
repositories {
...
jcenter()
maven { url 'https://jitpack.io' }
}
and then, add dependency to BalineseDate Library in the build.gradle
dependencies {
implementation 'com.gitlab.peradnya:balinese-date-java-lib:0.4.0'
}
Maven
Please add the repository of Jitpack in the pom.xml of your project
<repositories>
<repository>
<id>jitpack.io</id>
<url>https://jitpack.io</url>
</repository>
</repositories>
and then, add dependency to BalineseDate Library in the pom.xml
<dependency>
<groupId>com.gitlab.peradnya</groupId>
<artifactId>balinese-date-java-lib</artifactId>
<version>0.4.0</version>
</dependency>
Documentation
How to Build
Requirement
The recomended requirement to build this project are:
- Latest Oracle Java JDK (Recomended >= 7.x)
- Latest Gradle (Recomended >= 4.9.0)
- Latest Git Client
for Gradle installation, you can follow the Gradle installation instuction.
Building JAR File
JAR file of BalineseDate Library can be built by run the following command:
[project root]$ gradle build
You can find the compiled JAR at:
[project root]/build/libs/balinese-date-java-lib-[version].jar
Building Documentation (Javadoc)
Documentation of BalineseDate Library can be built by run the following command:
[project root]$ gradle javadoc
You can find the documentation at:
[project root]/build/docs/javadoc/index.html
Testing & Checking
Testing and checking of BalineseDate Library can be done by run the following command:
[project root]$ gradle check
You can find the test results at:
# JUnit (Unit Test) Result
[project root]/build/reports/tests/test/index.html
# Jacoco (Coverage) Result
[project root]/build/reports/jacoco/test/html/index.html
Using in Code
Creating BalineseDate Object
import peradnya.libs.balinesedate.*;
import java.util.GregorianCalendar;
// get current balinese date
BalineseDate now = new BalineseDate();
// get balinese date at 1 January 1969 using GregorianCalendar
GregorianCalendar date = new GregorianCalendar(1969,0,1);
BalineseDate bDate1 = new BalineseDate(date);
Using BalineseDate Method
// get the sasih day (1 - 15)
// if number of element inside date = 1, then bDate1 is normal day
// if number of element inside date = 2, then bDate1 is ngunaratri day
List<Integer> date = bDate1.sasihDay();
// get sasih day info (penanggal, pangelong, tilem, or purnama)
SasihDayInfo sasihDayInfo = bDate1.sasihDayInfo();
// get BalineseDate(s) Between 2017-01-01 and 2017-12-31 with Wuku Watugunung and Pancawara Kliwon
GregorianCalendar start = new GregorianCalendar(2017,0,1);
GregorianCalendar finish = new GregorianCalendar(2017,11,31);
BalineseDateUtil.Filter q = new BalineseDateUtil.Filter();
q.wuku = Wuku.WATUGUNUNG;
q.pancaWara = PancaWara.KLIWON;
List<BalineseDate> result = BalineseDateUtil.filterByDateRange(q, start, finish);
There is another related project about Balinese Saka Calendar:
References
评论