2007-H2.
YearHalf is an immutable date-time object that represents the combination
of a year and a half-year. Any field that can be derived from a year and a half-year can be obtained.
A half is defined by Half - H1 and H2.
H1 is January to June, H2 is July to December.
This class does not store or represent a day, time or time-zone.
For example, the value "2nd half 2007" can be stored in a YearHalf.
The ISO-8601 calendar system is the modern civil calendar system used today in most of the world. It is equivalent to the proleptic Gregorian calendar system, in which today's rules for leap years are applied for all time. For most applications written today, the ISO-8601 rules are entirely suitable. However, any application that makes use of historical dates, and requires them to be accurate will find the ISO-8601 approach unsuitable. Note that the ISO-8601 standard does not define or refer to halves.
This class must be treated as a value type. Do not synchronize, rely on the identity hash code or use the distinction between equals() and ==.
| Modifier and Type | Field and Description |
|---|---|
| private final Half | half
The half-of-year, not null. |
| private static final DateTimeFormatter | PARSER
Parser. |
| private static final long | serialVersionUID
Serialization version. |
| private final int | year
The year. |
| Access | Constructor and Description |
|---|---|
| private |
| Modifier and Type | Method and Description |
|---|---|
| public Temporal | Returns: the adjusted object, not nullthe target object to be adjusted, not null temporal)Implements java. Adjusts the specified temporal object to have this year-half. |
| public LocalDate | Returns: the date formed from this year-half and the specified day, not nullthe day-of-half to use, from 1 to 184 dayOfHalf)Combines this year-half with a day-of-half to create a |
| public LocalDate | Returns: the last valid date of this year-half, not nullReturns a |
| public int | Returns: the comparator value, negative if less, positive if greaterthe other year-half to compare to, not null other)Implements java. Compares this year-half to another The comparison is based first on the value of the year, then on the value of the half. |
| public boolean | Returns: true if this is equal to the other year-halfthe object to check, null returns false obj)Overrides java. Checks if this year-half is equal to another year-half. |
| public String | Returns: the formatted year-half string, not nullthe formatter to use, not null formatter)Formats this year-half using the specified formatter. |
| public static YearHalf | Returns: the year-half, not nullthe temporal object to convert, not null temporal)Obtains an instance of |
| public int | Returns: the value for the fieldthe field to get, not null field)Overrides default java. Gets the value of the specified field from this year-half as an |
| public Half | |
| public int | |
| public long | Returns: the value for the fieldthe field to get, not null field)Implements java. Gets the value of the specified field from this year-half as a |
| private long | |
| public int | |
| public Stream | Returns: a sequentialStream for the range of YearHalf valuesthe end year-half, exclusive, not null endExclusive)Returns a sequential ordered stream of year-half. |
| public int | Returns: a suitable hash codeOverrides java. A hash code for this year-half. |
| public boolean | |
| public boolean | |
| public boolean | Returns: true if the year is leap, false otherwiseChecks if the year is a leap year, according to the ISO proleptic calendar system rules. |
| public boolean | Returns: true if the field is supported on this year-half, false if notthe field to check, null returns false field)Implements java. Checks if the specified field is supported. |
| public boolean | Returns: true if the unit can be added/subtracted, false if notthe unit to check, null returns false unit)Implements java. Checks if the specified unit is supported. |
| public boolean | Returns: true if the day is valid for this year-halfthe day-of-half to validate, from 1 to 181, 182 or 184, invalid value returns false dayOfHalf)Checks if the day-of-half is valid for this year-half. |
| public int | Returns: the length of the half in days, 181, 182 or 184Returns the length of the half, taking account of the year. |
| public int | |
| public YearHalf | Returns: aYearHalf based on this year-half with the subtraction made, not nullthe amount to subtract, not null amountToSubtract)Overrides default java. Returns a copy of this year-half with the specified amount subtracted. |
| public YearHalf | Returns: aYearHalf based on this year-half with the specified amount subtracted, not nullthe amount of the unit to subtract from the result, may be negative amountToSubtract, TemporalUnit the unit of the amount to subtract, not null unit)Overrides default java. Returns a copy of this year-half with the specified amount subtracted. |
| public YearHalf | Returns: aYearHalf based on this year-half with the halves subtracted, not nullthe halves to subtract, may be negative halvesToSubtract)Returns a copy of this year-half with the specified period in halves subtracted. |
| public YearHalf | Returns: aYearHalf based on this year-half with the years subtracted, not nullthe years to subtract, may be negative yearsToSubtract)Returns a copy of this year-half with the specified period in years subtracted. |
| public static YearHalf | Returns: the current year-half using the system clock and default time-zone, not nullObtains the current year-half from the system clock in the default time-zone. |
| public static YearHalf | |
| public static YearHalf | |
| public static YearHalf | |
| public static YearHalf | |
| public static YearHalf | |
| public static YearHalf | Returns: the year-half, not nullthe year to represent, from MIN_YEAR to MAX_YEAR year, int the half-of-year to represent, from 1 to 2 half)Obtains an instance of |
| public static YearHalf | Returns: the parsed year-half, not nullthe text to parse such as "2007-H2", not null text)Obtains an instance of |
| public static YearHalf | Returns: the parsed year-half, not nullthe text to parse, not null text, DateTimeFormatter the formatter to use, not null formatter)Obtains an instance of |
| public YearHalf | Returns: aYearHalf based on this year-half with the addition made, not nullthe amount to add, not null amountToAdd)Overrides default java. Returns a copy of this year-half with the specified amount added. |
| public YearHalf | Returns: aYearHalf based on this year-half with the specified amount added, not nullthe amount of the unit to add to the result, may be negative amountToAdd, TemporalUnit the unit of the amount to add, not null unit)Implements java. Returns a copy of this year-half with the specified amount added. |
| public YearHalf | Returns: aYearHalf based on this year-half with the halves added, not nullthe halves to add, may be negative halvesToAdd)Returns a copy of this year-half with the specified period in halves added. |
| public YearHalf | Returns: aYearHalf based on this year-half with the years added, not nullthe years to add, may be negative yearsToAdd)Returns a copy of this year-half with the specified period in years added. |
| public < the type of the result R> R | Returns: the query result, null may be returned (defined by the query)the query to invoke, not null query)Overrides default java. Queries this year-half using the specified query. |
| public ValueRange | Returns: the range of valid values for the field, not nullthe field to query the range for, not null field)Overrides default java. Gets the range of valid values for the specified field. |
| private Object | |
| public String | Returns: a string representation of this year-half, not nullOverrides java. Outputs this year-half as a |
| public long | Returns: the amount of time between this year-half and the end year-halfthe end date, exclusive, which is converted to a endExclusive, TemporalUnit YearHalf, not nullthe unit to measure the amount in, not null unit)Implements java. Calculates the amount of time until another year-half in terms of the specified unit. |
| private YearHalf | |
| public YearHalf | Returns: aYearHalf based on this with the adjustment made, not nullthe adjuster to use, not null adjuster)Overrides default java. Returns an adjusted copy of this year-half. |
| public YearHalf | Returns: aYearHalf based on this with the specified field set, not nullthe field to set in the result, not null field, long the new value of the field in the result newValue)Implements java. Returns a copy of this year-half with the specified field set to a new value. |
| public YearHalf | Returns: aYearHalf based on this year-half with the requested half, not nullthe half-of-year to set in the returned year-half, from 1 to 2 half)Returns a copy of this |
| public YearHalf | Returns: aYearHalf based on this year-half with the requested year, not nullthe year to set in the returned year-half, from MIN_YEAR to MAX_YEAR year)Returns a copy of this |