Top Description Fields Constructors Methods
org.threeten.extra.chrono

public final Enum AccountingYearDivision

extends Enum<AccountingYearDivision>
Class Inheritance
Imports
java.time.DateTimeException, java.time.temporal.ChronoField, .ValueRange, java.util.Arrays

How an Accounting year is divided.

An Accounting calendar system generally divides a year into smaller periods, similar in length to regular calendar months. The most common divisions either use 12 such 'months' (requiring one every quarter to be 5 weeks instead of 4), or use 13 of 4 weeks each (making one quarter have an extra month, or each quarter have partial months).

Implementation Requirements:

This is an immutable and thread-safe enum.

Field Summary

Modifier and TypeField and Description
private final int[]
elapsedWeeks

The elapsed number of weeks at the start of each month.

private final ValueRange
monthsInYearRange

The range of months in each year.

public static final AccountingYearDivision
QUARTERS_OF_PATTERN_4_4_5_WEEKS

The singleton instance for a year divided into 4 quarters, each having 3 months with lengths of 4, 4, and 5 weeks, respectively.

public static final AccountingYearDivision
QUARTERS_OF_PATTERN_4_5_4_WEEKS

The singleton instance for a year divided into 4 quarters, each having 3 months with lengths of 4, 5, and 4 weeks, respectively.

public static final AccountingYearDivision
QUARTERS_OF_PATTERN_5_4_4_WEEKS

The singleton instance for a year divided into 4 quarters, each having 3 months with lengths of 5, 4, and 4 weeks, respectively.

public static final AccountingYearDivision
THIRTEEN_EVEN_MONTHS_OF_4_WEEKS

The singleton instance for a year divided into 13 even months, each having 4 weeks.

private final int[]
weeksInMonths

The number of weeks in each month.

Constructor Summary

AccessConstructor and Description
private
AccountingYearDivision(int[]
The number of weeks in each month (period).
weeksInMonths
)

Private constructor for enum, for creating cached info.

Method Summary

Modifier and TypeMethod and Description
pack-priv int

Returns:

the month
getMonthFromElapsedWeeks
(int
The weeks elapsed since the start of the year.
weeksElapsed
)

Get the month from a count of elapsed weeks.

pack-priv int

Returns:

the month
getMonthFromElapsedWeeks
(int
The weeks elapsed since the start of the year.
weeksElapsed
,
int
The month in which the leap-week resides
leapWeekInMonth
)

Get the month from a count of elapsed weeks.

pack-priv ValueRange

Returns:

the range of months (periods) in a year.
getMonthsInYearRange
()

Gets the range of months in a year.

pack-priv int

Returns:

The number of weeks elapsed before the start of the month.
getWeeksAtStartOfMonth
(int
The month
month
)

Get the number of weeks elapsed before the start of the month.

pack-priv int

Returns:

The number of weeks elapsed before the start of the month, including any leap week.
getWeeksAtStartOfMonth
(int
The month
month
,
int
The month in which the leap-week resides
leapWeekInMonth
)

Get the number of weeks elapsed before the start of the month.

pack-priv int

Returns:

The count of weeks in the given month.
getWeeksInMonth
(int
The month for which to get the count of weeks.
month
)

Get the number of weeks in the given month (period).

pack-priv int

Returns:

The count of weeks in the given month, including any leap week.
getWeeksInMonth
(int
The month for which to get the count of weeks.
month
,
int
The month in which the leap-week resides
leapWeekInMonth
)

Get the number of weeks in the given month (period), with the leap year in the indicated month.

pack-priv int

Returns:

The length of the year in months.
lengthOfYearInMonths
()

Gets the length of the year in months.

public static AccountingYearDivision
public static AccountingYearDivision[]
Inherited from java.lang.Enum:
clonecompareTodescribeConstableequalsfinalizegetDeclaringClasshashCodenameordinaltoStringvalueOf

Field Detail

elapsedWeeksback to summary
private final int[] elapsedWeeks

The elapsed number of weeks at the start of each month.

monthsInYearRangeback to summary
private final ValueRange monthsInYearRange

The range of months in each year.

QUARTERS_OF_PATTERN_4_4_5_WEEKSback to summary
public static final AccountingYearDivision QUARTERS_OF_PATTERN_4_4_5_WEEKS

The singleton instance for a year divided into 4 quarters, each having 3 months with lengths of 4, 4, and 5 weeks, respectively.

QUARTERS_OF_PATTERN_4_5_4_WEEKSback to summary
public static final AccountingYearDivision QUARTERS_OF_PATTERN_4_5_4_WEEKS

The singleton instance for a year divided into 4 quarters, each having 3 months with lengths of 4, 5, and 4 weeks, respectively.

QUARTERS_OF_PATTERN_5_4_4_WEEKSback to summary
public static final AccountingYearDivision QUARTERS_OF_PATTERN_5_4_4_WEEKS

The singleton instance for a year divided into 4 quarters, each having 3 months with lengths of 5, 4, and 4 weeks, respectively.

THIRTEEN_EVEN_MONTHS_OF_4_WEEKSback to summary
public static final AccountingYearDivision THIRTEEN_EVEN_MONTHS_OF_4_WEEKS

The singleton instance for a year divided into 13 even months, each having 4 weeks.

weeksInMonthsback to summary
private final int[] weeksInMonths

The number of weeks in each month.

Constructor Detail

AccountingYearDivisionback to summary
private AccountingYearDivision(int[] weeksInMonths)

Private constructor for enum, for creating cached info.

Parameters
weeksInMonths:int[]

The number of weeks in each month (period).

Method Detail

getMonthFromElapsedWeeksback to summary
pack-priv int getMonthFromElapsedWeeks(int weeksElapsed)

Get the month from a count of elapsed weeks.

Parameters
weeksElapsed:int

The weeks elapsed since the start of the year.

Returns:int

the month

Exceptions
DateTimeException:
if the month isn't in the valid range of months, or the week isn't in the valid range.
getMonthFromElapsedWeeksback to summary
pack-priv int getMonthFromElapsedWeeks(int weeksElapsed, int leapWeekInMonth)

Get the month from a count of elapsed weeks.

Parameters
weeksElapsed:int

The weeks elapsed since the start of the year.

leapWeekInMonth:int

The month in which the leap-week resides

Returns:int

the month

Exceptions
DateTimeException:
if the month isn't in the valid range of months, or the week isn't in the valid range.
getMonthsInYearRangeback to summary
pack-priv ValueRange getMonthsInYearRange()

Gets the range of months in a year.

  • The AccountingYearDivision QUARTERS_OF_PATTERN_4_4_5_WEEKS range is [1, 12].
  • The AccountingYearDivision QUARTERS_OF_PATTERN_4_5_4_WEEKS range is [1, 12].
  • The AccountingYearDivision QUARTERS_OF_PATTERN_5_4_4_WEEKS range is [1, 12].
  • The AccountingYearDivision THIRTEEN_EVEN_MONTHS_OF_4_WEEKS range is [1, 13].
Returns:ValueRange

the range of months (periods) in a year.

getWeeksAtStartOfMonthback to summary
pack-priv int getWeeksAtStartOfMonth(int month)

Get the number of weeks elapsed before the start of the month.

Parameters
month:int

The month

Returns:int

The number of weeks elapsed before the start of the month.

Exceptions
DateTimeException:
if the month isn't in the valid range of months.
getWeeksAtStartOfMonthback to summary
pack-priv int getWeeksAtStartOfMonth(int month, int leapWeekInMonth)

Get the number of weeks elapsed before the start of the month.

Parameters
month:int

The month

leapWeekInMonth:int

The month in which the leap-week resides

Returns:int

The number of weeks elapsed before the start of the month, including any leap week.

Exceptions
DateTimeException:
if the month isn't in the valid range of months.
getWeeksInMonthback to summary
pack-priv int getWeeksInMonth(int month)

Get the number of weeks in the given month (period).

Parameters
month:int

The month for which to get the count of weeks.

Returns:int

The count of weeks in the given month.

Exceptions
DateTimeException:
if the month isn't in the valid range of months.
getWeeksInMonthback to summary
pack-priv int getWeeksInMonth(int month, int leapWeekInMonth)

Get the number of weeks in the given month (period), with the leap year in the indicated month.

Parameters
month:int

The month for which to get the count of weeks.

leapWeekInMonth:int

The month in which the leap-week resides

Returns:int

The count of weeks in the given month, including any leap week.

Exceptions
DateTimeException:
if the month isn't in the valid range of months.
lengthOfYearInMonthsback to summary
pack-priv int lengthOfYearInMonths()

Gets the length of the year in months.

Returns:int

The length of the year in months.

valueOfback to summary
public static AccountingYearDivision valueOf(String name)
valuesback to summary
public static AccountingYearDivision[] values()