public abstract class NoLeapMonthCalendarMetrics extends CalendarMetrics
Knowing that a calendar scale has no leap months also allows to return the plain month number as packed month, which makes month handling much easier.
CalendarMetrics.CalendarMetricsFactoryminDaysInFirstWeek, weekStart, weekStartInt| Constructor and Description |
|---|
NoLeapMonthCalendarMetrics(java.lang.String name,
Weekday weekStart,
int minDaysInFirstWeek)
Create calendar metrics for a calendar without leap months with the given week numbering.
|
| Modifier and Type | Method and Description |
|---|---|
abstract int |
getMonthsPerYear()
Returns the number of months in a year.
|
int |
getMonthsPerYear(int year)
Get the number of months in the given year.
|
boolean |
isLeapMonth(int packedMonth)
Returns whether a certain packed month is a leap month, i.e. a month that exists in certain years only.
|
int |
monthNum(int packedMonth)
Returns the month number of a packed month.
|
long |
nextDay(long instance)
Moves the given instance forward to the next (existing day).
|
long |
nextDay(long instance,
int n)
Moves the given instance forward by one or more days.
|
long |
nextMonth(long instance)
Moves the given instance forward by one month.
|
long |
nextMonth(long instance,
int n)
Moves the given instance forward by one or more months.
|
int |
packedMonth(int monthNum,
boolean leapMonth)
Returns a packed month, which is a combination of the month number and a leap month flag.
|
int |
packedMonth(java.lang.String month)
Returns a packed month from a string representation.
|
java.lang.String |
packedMonthToString(int packedMonth)
Convert the packed month to a numerical string representation.
|
long |
prevDay(long instance)
Moves the given instance backward to the previous (existing) day.
|
long |
prevDay(long instance,
int n)
Moves the given instance backward by one or more days.
|
long |
prevMonth(long instance)
Moves the given instance backward by one month.
|
long |
prevMonth(long instance,
int n)
Moves the given instance backward by one or more months.
|
dayOfMonth, equals, getDayOfMonthOfYearDay, getDayOfWeek, getDayOfWeek, getDayOfYear, getDaysPerPackedMonth, getDaysPerYear, getMaxMonthDayNum, getMaxWeekNoNum, getMaxYearDayNum, getMonthAndDayOfYearDay, getPackedMonthOfYearDay, getWeekDayOfFirstYearDay, getWeekOfYear, getWeekOfYear, getWeeksPerYear, getYearDayOfFirstWeekStart, getYearDayOfIsoYear, getYearDayOfWeekStart, getYearDaysForPackedMonth, hashCode, monthAndDay, packedMonth, scaleEquals, setDayOfWeek, startOfWeek, toInstance, toMillis, toMillis, toString, validatepublic NoLeapMonthCalendarMetrics(java.lang.String name,
Weekday weekStart,
int minDaysInFirstWeek)
name - The Name of the Calendar Scale.weekStart - The first day of the week.minDaysInFirstWeek - The minimal number of days in the first week.public int packedMonth(java.lang.String month)
CalendarMetrics
The string representation is the 1-based month number followed by an optional L literal to indicate a leap month.
packedMonth in class CalendarMetricsmonth - The string representation of the month.public java.lang.String packedMonthToString(int packedMonth)
CalendarMetricspackedMonthToString in class CalendarMetricspackedMonth - The packed month.public int packedMonth(int monthNum,
boolean leapMonth)
CalendarMetricsNote that not all calendar scales support leap months.
packedMonth in class CalendarMetricsmonthNum - The 0-based month number.leapMonth - true if this is a leap month, false otherwise.public boolean isLeapMonth(int packedMonth)
CalendarMetricsisLeapMonth in class CalendarMetricspackedMonth - The packed month to test.true if the month is a leap month, false otherwise.public int monthNum(int packedMonth)
CalendarMetricsmonthNum in class CalendarMetricspackedMonth - The packed month.public int getMonthsPerYear(int year)
CalendarMetricsgetMonthsPerYear in class CalendarMetricsyear - The year.public abstract int getMonthsPerYear()
public long nextMonth(long instance)
CalendarMetricsCalendarMetrics.nextMonth(long, int) with n = 1.nextMonth in class CalendarMetricsinstance - The instance to modify.public long nextMonth(long instance,
int n)
CalendarMetricsnextMonth in class CalendarMetricsinstance - The instance to modify.n - The number of months to add.public long prevMonth(long instance)
CalendarMetricsCalendarMetrics.prevMonth(long, int) with n = 1.prevMonth in class CalendarMetricsinstance - The instance to modify.public long prevMonth(long instance,
int n)
CalendarMetricsprevMonth in class CalendarMetricsinstance - The instance to modify.n - The number of months to go back.public long nextDay(long instance)
CalendarMetricsnextDay in class CalendarMetricsinstance - The instance to modify.public long nextDay(long instance,
int n)
CalendarMetricsnextDay in class CalendarMetricsinstance - The instance to modify.n - The number of days to add.public long prevDay(long instance)
CalendarMetricsprevDay in class CalendarMetricsinstance - The instance to modify.public long prevDay(long instance,
int n)
CalendarMetricsprevDay in class CalendarMetricsinstance - The instance to modify.n - The number of days to go back.