public enum Quarter extends Enum<Quarter>
| Modifier and Type | Method and Description |
|---|---|
static Quarter |
getByIndex(int index) |
static Quarter |
getByName(String name) |
int |
getIndex() |
static int |
getPositionInQuarter(int firstMonthOfYear,
int targetMonth)
Given a month (from 1 to 12) it calculates the ordinal within the quarter it belongs.
|
static int |
getQuarterFirstMonth(int firstMonthOfYear,
int targetMonth)
Given a month (from 1 to 12) it calculates the first month of its quarter.
|
static Quarter |
valueOf(String name)
Returns the enum constant of this type with the specified name.
|
static Quarter[] |
values()
Returns an array containing the constants of this enum type, in
the order they are declared.
|
public static final Quarter Q1
public static final Quarter Q2
public static final Quarter Q3
public static final Quarter Q4
public static Quarter[] values()
for (Quarter c : Quarter.values()) System.out.println(c);
public static Quarter valueOf(String name)
name - the name of the enum constant to be returned.IllegalArgumentException - if this enum type has no constant with the specified nameNullPointerException - if the argument is nullpublic int getIndex()
public static Quarter getByIndex(int index)
public static int getQuarterFirstMonth(int firstMonthOfYear,
int targetMonth)
firstMonthOfYear - The first month of the year considered the first month of the first quarter.targetMonth - The month we want to evaluate to which quarter belongs.public static int getPositionInQuarter(int firstMonthOfYear,
int targetMonth)
firstMonthOfYear - The first month of the year considered the first month of the first quarter.targetMonth - The month we want to evaluate.Copyright © 2017–2021 JBoss by Red Hat. All rights reserved.