Class MillisecondStore

java.lang.Object
org.lukashian.store.MillisecondStore

public final class MillisecondStore extends Object
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 Details

    • store

      public static MillisecondStore store()
      Gets the singleton instance of the MillisecondStore.
    • setMillisecondStoreDataProvider

      public void setMillisecondStoreDataProvider(MillisecondStoreDataProvider provider)
      Sets the MillisecondStoreDataProvider to the given instance and reloads this MillisecondStore.
    • reload

      public void reload()
      Reloads the durations of the Years, Days and the offset with the UNIX epoch from the MillisecondStoreDataProvider.
    • 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.