Package org.lukashian.store
Class MillisecondStore
java.lang.Object
org.lukashian.store.MillisecondStore
For each
Day and Year, this class stores the number of milliseconds between the start of the calendar (the Lukashian epoch)
and the end of that day or year. It also stores the offset between the Lukashian epoch and the UNIX epoch. An implementation of
MillisecondStoreDataProvider is used to obtain this data. By default, an instance of StandardEarthMillisecondStoreDataProvider is used.
Alternative implementations of the MillisecondStoreDataProvider can be provided using the Java Server Provider Interface mechanism. Simply
put a file named "org.lukashian.store.MillisecondStoreDataProvider" in META-INF/services/ on the classpath and put the fully qualified
name of the desired MillisecondStoreDataProvider implementation as text in that file.
Alternatively, you could use the setMillisecondStoreDataProvider(org.lukashian.store.MillisecondStoreDataProvider) of the INSTANCE singleton.
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionlongGets the number of milliseconds from the start of the Lukashian Calendar until now.intgetEpochDayForEpochMilliseconds(long epochMilliseconds) Gets the epoch day that overlaps with the point where the given number of milliseconds have passed since the start of the Lukashian Calendar.longgetEpochMillisecondsForEpochDay(int epochDay) Gets the number of milliseconds from the start of the Lukashian Calendar until the final point of the given day.longgetEpochMillisecondsForYear(int year) Gets the number of milliseconds from the start of the Lukashian Calendar until the final point of the given year.longgetLukashianEpochMilliseconds(long unixEpochMilliseconds) Gets the number of milliseconds from the start of the Lukashian Calendar until the given number of milliseconds from the UNIX Epoch.longgetUnixEpochMilliseconds(long lukashianEpochMilliseconds) Gets the number of milliseconds from the UNIX Epoch until the given number of milliseconds from the Lukashian Epoch.intgetYearForEpochMilliseconds(long epochMilliseconds) Gets the year that overlaps with the point where the given number of milliseconds have passed since the start of the Lukashian Calendar.voidreload()Reloads the durations of theYears,Days and the offset with the UNIX epoch from theMillisecondStoreDataProvider.voidSets theMillisecondStoreDataProviderto the given instance and reloads thisMillisecondStore.static MillisecondStorestore()Gets the singleton instance of theMillisecondStore.
-
Method Details
-
store
Gets the singleton instance of theMillisecondStore. -
setMillisecondStoreDataProvider
Sets theMillisecondStoreDataProviderto the given instance and reloads thisMillisecondStore. -
reload
public void reload()Reloads the durations of theYears,Days and the offset with the UNIX epoch from theMillisecondStoreDataProvider. -
getUnixEpochMilliseconds
public long getUnixEpochMilliseconds(long lukashianEpochMilliseconds) Gets the number of milliseconds from the UNIX Epoch until the given number of milliseconds from the Lukashian Epoch. -
getLukashianEpochMilliseconds
public long getLukashianEpochMilliseconds(long unixEpochMilliseconds) Gets the number of milliseconds from the start of the Lukashian Calendar until the given number of milliseconds from the UNIX Epoch. -
getCurrentEpochMilliseconds
public long getCurrentEpochMilliseconds()Gets the number of milliseconds from the start of the Lukashian Calendar until now. -
getEpochMillisecondsForYear
public long getEpochMillisecondsForYear(int year) Gets the number of milliseconds from the start of the Lukashian Calendar until the final point of the given year. -
getEpochMillisecondsForEpochDay
public long getEpochMillisecondsForEpochDay(int epochDay) Gets the number of milliseconds from the start of the Lukashian Calendar until the final point of the given day. The day is specified in epoch form, i.e. the how manieth day it is since the start of the Lukashian Calendar, irrespective of the year of the day. -
getYearForEpochMilliseconds
public int getYearForEpochMilliseconds(long epochMilliseconds) Gets the year that overlaps with the point where the given number of milliseconds have passed since the start of the Lukashian Calendar. -
getEpochDayForEpochMilliseconds
public int getEpochDayForEpochMilliseconds(long epochMilliseconds) Gets the epoch day that overlaps with the point where the given number of milliseconds have passed since the start of the Lukashian Calendar.
-