public abstract class LetoBase extends java.lang.Object implements Leto
Constructor and Description |
---|
LetoBase() |
Modifier and Type | Method and Description |
---|---|
LetoPeriod[] |
calculateCalendarPeriods(long days)
Calculate the periods based on the number of days since the leto (calendar) EPOCH.
|
protected long |
calculateDaysFromPeriods(LetoPeriod[] periods)
Given the representation of the date by periods, this method calculates the number of days since the
start of the calendar.
|
long |
calculateDaysFronStartOfCalendar(long year,
long month,
long day)
This method is the reverse of the prevuos method (calculateCalendarPeriods).
|
java.lang.String |
checkCorrectness() |
abstract LetoPeriodType[] |
getCalendarPeriodTypes()
All inheriting classes should define the supported calendar period types.
|
java.lang.String |
getDescription()
Get the human readable description of this calendar in the default locale.
|
java.lang.String |
getDescription(java.util.Locale locale)
Long description of this calendar system.
|
protected abstract LocaleStringId |
getDescriptionTranslationIndex() |
java.util.Map<java.util.Locale,java.lang.String> |
getDescriptionTranslations()
Get the available translations in human spoken languages of this calendar descripton.
|
java.lang.String |
getName()
Get the
|
java.lang.String |
getName(java.util.Locale locale)
Short name of this calendar system.
|
protected abstract LocaleStringId |
getNameTranslationIndex() |
java.util.Map<java.util.Locale,java.lang.String> |
getNameTranslations()
Get the available translations of the name of this calendar in different human spoken languages.
|
LetoPeriod[] |
getToday()
Calculate the exact period values for the today's date.
|
static void |
main(java.lang.String[] args) |
abstract long |
startOfCalendarInDaysBeforeJavaEpoch()
All inheriting classes should define the beginning of their calendar in days before the java EPOCH.
|
java.lang.String |
toJson(boolean indent) |
java.util.Map<java.lang.String,java.lang.Object> |
toMap() |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getStartOfCalendarBeforeUnixEpoch
protected abstract LocaleStringId getNameTranslationIndex()
protected abstract LocaleStringId getDescriptionTranslationIndex()
public java.lang.String getName()
public java.lang.String getName(java.util.Locale locale)
Leto
public java.lang.String getDescription()
Leto
getDescription
in interface Leto
public java.lang.String getDescription(java.util.Locale locale)
Leto
getDescription
in interface Leto
locale
- The localization to be used.public java.util.Map<java.util.Locale,java.lang.String> getNameTranslations()
Leto
getNameTranslations
in interface Leto
public java.util.Map<java.util.Locale,java.lang.String> getDescriptionTranslations()
Leto
getDescriptionTranslations
in interface Leto
public abstract long startOfCalendarInDaysBeforeJavaEpoch()
public abstract LetoPeriodType[] getCalendarPeriodTypes()
getCalendarPeriodTypes
in interface Leto
public LetoPeriod[] getToday() throws LetoException
LetoException
- If there is a problem during calculation or if the calendar internal structures are not
well defined.public LetoPeriod[] calculateCalendarPeriods(long days) throws LetoException
calculateCalendarPeriods
in interface Leto
days
- Number of days since the calendar starts.LetoException
- If there is some unrecoverable error while calculating the date.public long calculateDaysFronStartOfCalendar(long year, long month, long day) throws LetoException
calculateDaysFronStartOfCalendar
in interface Leto
year
- Yearmonth
- Monthday
- DayLetoException
- If something goes wrong.public static void main(java.lang.String[] args) throws java.lang.Throwable
java.lang.Throwable
protected long calculateDaysFromPeriods(LetoPeriod[] periods) throws LetoException
periods
- An array of periods.LetoException
- If there is some unrecoverable error during calculation.public java.lang.String checkCorrectness()
public java.util.Map<java.lang.String,java.lang.Object> toMap()
public java.lang.String toJson(boolean indent)