public enum Quarter extends Enum<Quarter> implements ChronoCondition<GregorianDate>
Represents a quarter (in most cases of a year).
| Enum Constant and Description |
|---|
Q1
First quarter with the numerical value
1. |
Q2
Second quarter with the numerical value
2. |
Q3
Third quarter with the numerical value
3. |
Q4
Last quarter with the numerical value
4. |
| Modifier and Type | Method and Description |
|---|---|
String |
getDisplayName(Locale locale)
Equivalent to the expression
getDisplayName(locale, TextWidth.WIDE, OutputContext.FORMAT). |
String |
getDisplayName(Locale locale,
TextWidth width,
OutputContext context)
Gets the description text dependent on the locale and style
parameters.
|
int |
getValue()
Gets the corresponding numerical value.
|
Quarter |
next()
Rolls to the next quarter.
|
Quarter |
previous()
Rolls to the previous quarter.
|
Quarter |
roll(int quarters)
Rolls by given amount of quarters.
|
boolean |
test(GregorianDate context)
Decides if given context matches this condition.
|
static Quarter |
valueOf(int quarter)
Gets the enum-constant which corresponds to the given numerical
value.
|
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
First quarter with the numerical value 1.
public static final Quarter Q2
Second quarter with the numerical value 2.
public static final Quarter Q3
Third quarter with the numerical value 3.
public static final Quarter Q4
Last quarter with the numerical value 4.
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 static Quarter valueOf(int quarter)
Gets the enum-constant which corresponds to the given numerical value.
quarter - value in the range [1-4]IllegalArgumentException - if given argument is out of rangepublic int getValue()
Gets the corresponding numerical value.
public Quarter next()
Rolls to the next quarter.
The result is Q1 if this method is applied on Q4.
public Quarter previous()
Rolls to the previous quarter.
The result is Q4 if this method is applied on Q1.
public Quarter roll(int quarters)
Rolls by given amount of quarters.
quarters - count of quarters (maybe negative)public String getDisplayName(Locale locale)
Equivalent to the expression
getDisplayName(locale, TextWidth.WIDE, OutputContext.FORMAT).
locale - language settingnull)getDisplayName(Locale, TextWidth, OutputContext)public String getDisplayName(Locale locale, TextWidth width, OutputContext context)
Gets the description text dependent on the locale and style parameters.
The second argument controls the width of description while the third argument is only relevant for languages which make a difference between stand-alone forms and embedded text forms (does not matter in English).
locale - language settingwidth - text widthcontext - output contextnull)public boolean test(GregorianDate context)
ChronoConditionDecides if given context matches this condition.
Due to better readability it is recommended to use following equivalent approach instead of this method::
import static net.time4j.Weekday.SATURDAY; import static net.time4j.Month.JANUARY; PlainDate date = PlainDate.of(2014, JANUARY, 25); System.out.println(SATURDAY.test(date)); // direct use System.out.println(date.matches(SATURDAY)); // recommended callback
test in interface Predicate<GregorianDate>test in interface ChronoCondition<GregorianDate>context - context as base of testing this conditiontrue if given time context matches this condition
else falseCopyright © 2014–2015. All rights reserved.