Class CalendarQuarter
- All Implemented Interfaces:
Serializable,Comparable<CalendarQuarter>,Iterable<PlainDate>,ChronoDisplay,LocalizedPatternSupport,ChronoInterval<PlainDate>
Represents the quarter of a gregorian calendar year as interval (like from 1st of January until end of March).
The elements registered by this class are:
Note: The current quarter of calendar year can be determined by an expression like:
nowInSystemTime() or in a more general way
CalendarQuarter current = SystemClock.inLocalView().now(CalendarQuarter.chronology()).
- Since:
- 3.21/4.17
- Author:
- Meno Hochschild
- See Also:
- Serialized Form
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic ChronoElement<Quarter>Element with the quarter of year in the value rangeQ1-Q4.static ChronoElement<Integer>Element with the proleptic iso-year without any era reference and the value range-999999999until999999999. -
Method Summary
Modifier and TypeMethodDescriptionatDayOfQuarter(int dayOfQuarter)Combines this calendar quarter with given day of quarter year to a calendar date.Yields the date of the end of this quarter year.static Chronology<CalendarQuarter>Yields the associated chronology.intcompareTo(CalendarQuarter other)booleanQueries if given time point belongs to this interval.booleanstatic CalendarQuarterfrom(GregorianDate date)Converts given gregorian date to a quarter year.getEnd()Yields the upper bound of this interval.Yields the quarter year.getStart()Yields the lower bound of this interval.intgetYear()Yields the year number.inthashCode()booleanIs this interval after the given time point?booleanIs this interval before the given time point?iterator()Iterates over all days of this calendar quarter year.intlength()Determines the count of days belonging to this quarter year.Subtracts given quarter years from this quarter year.minus(Years<CalendarUnit> years)Subtracts given years from this quarter year.static CalendarQuarterObtains the current calendar quarter year in system time.static CalendarQuarterCreates a new instance based on given gregorian calendar year and quarter year.Adds given quarter years to this quarter year.plus(Years<CalendarUnit> years)Adds given years to this quarter year.static TimeLine<CalendarQuarter>timeline()Obtains a timeline for this type.toString()Outputs this instance as a String in CLDR-format "uuuu-'Q'Q" (like "2016-Q1").Methods inherited from class net.time4j.range.FixedCalendarInterval
abuts, contains, isBefore, isEmpty, isFinite, isSimultaneous, streamDaily, toFlexInterval, withValueMethods inherited from class net.time4j.engine.ChronoEntity
contains, get, get, getInt, getMaximum, getMinimum, getRegisteredElements, getTimezone, hasTimezone, isValid, isValid, isValid, matches, with, with, with, withMethods inherited from interface net.time4j.range.ChronoInterval
intersects, isAfterMethods inherited from interface java.lang.Iterable
forEach, spliteratorMethods inherited from interface net.time4j.format.LocalizedPatternSupport
getFormatPattern, getFormatPattern, useDynamicFormatPattern
-
Field Details
-
YEAR
Element with the proleptic iso-year without any era reference and the value range
-999999999until999999999.The term "proleptic" means that the rules of the gregorian calendar and the associated way of year counting is applied backward even before the introduction of gregorian calendar. The year
0is permitted - and negative years, too. For historic year numbers, this mathematical extrapolation is not recommended and usually wrong. -
QUARTER_OF_YEAR
Element with the quarter of year in the value range
Q1-Q4.
-
-
Method Details
-
of
Creates a new instance based on given gregorian calendar year and quarter year.
- Parameters:
year- gregorian year within range-999,999,999 / +999,999,999quarter- quarter year- Returns:
- new instance
- Throws:
IllegalArgumentException- if given year is out of range
-
nowInSystemTime
Obtains the current calendar quarter year in system time.
Convenient short-cut for:
SystemClock.inLocalView().now(CalendarQuarter.chronology()).- Returns:
- current calendar quarter year in system time zone using the system clock
- Since:
- 3.24/4.20
- See Also:
SystemClock.inLocalView(),ZonalClock.now(net.time4j.engine.Chronology)
-
atDayOfQuarter
Combines this calendar quarter with given day of quarter year to a calendar date.
- Parameters:
dayOfQuarter- day of quarter in range 1-90/91/92- Returns:
- calendar date
- Throws:
IllegalArgumentException- if the day-of-quarter is out of range
-
atEndOfQuarter
Yields the date of the end of this quarter year.
- Returns:
- PlainDate
-
getYear
public int getYear()Yields the year number.
- Returns:
- int
-
getQuarter
Yields the quarter year.
- Returns:
- Quarter
-
getStart
Description copied from interface:ChronoIntervalYields the lower bound of this interval.
- Specified by:
getStartin interfaceChronoInterval<PlainDate>- Returns:
- start interval boundary
-
getEnd
Description copied from interface:ChronoIntervalYields the upper bound of this interval.
- Specified by:
getEndin interfaceChronoInterval<PlainDate>- Returns:
- end interval boundary
-
contains
Description copied from interface:ChronoIntervalQueries if given time point belongs to this interval.
- Specified by:
containsin interfaceChronoInterval<PlainDate>- Parameters:
temporal- time point to be queried- Returns:
trueif given time point belongs to this interval elsefalse
-
isAfter
Description copied from interface:ChronoIntervalIs this interval after the given time point?
- Specified by:
isAfterin interfaceChronoInterval<PlainDate>- Parameters:
temporal- reference time point- Returns:
trueif this interval is after given time point elsefalse
-
isBefore
Description copied from interface:ChronoIntervalIs this interval before the given time point?
- Specified by:
isBeforein interfaceChronoInterval<PlainDate>- Parameters:
temporal- reference time point- Returns:
trueif this interval is before given time point elsefalse
-
length
public int length()Determines the count of days belonging to this quarter year.
- Returns:
- int
-
from
Converts given gregorian date to a quarter year.
- Parameters:
date- gregorian calendar date (for examplePlainDate- Returns:
- CalendarQuarter
- Throws:
IllegalArgumentException- if given date is invalid- Since:
- 3.28/4.24
-
plus
Adds given years to this quarter year.
- Parameters:
years- the count of years to be added- Returns:
- result of addition
-
plus
Adds given quarter years to this quarter year.
- Parameters:
quarters- the count of quarter years to be added- Returns:
- result of addition
-
minus
Subtracts given years from this quarter year.
- Parameters:
years- the count of years to be subtracted- Returns:
- result of subtraction
-
minus
Subtracts given quarter years from this quarter year.
- Parameters:
quarters- the count of quarter years to be subtracted- Returns:
- result of subtraction
-
compareTo
- Specified by:
compareToin interfaceComparable<CalendarQuarter>
-
iterator
Iterates over all days of this calendar quarter year.
-
equals
-
hashCode
public int hashCode() -
toString
Outputs this instance as a String in CLDR-format "uuuu-'Q'Q" (like "2016-Q1").
-
chronology
Yields the associated chronology.
- Returns:
- the underlying rule engine
-
timeline
Obtains a timeline for this type.
- Returns:
- singleton timeline
- Since:
- 5.0
-