public interface ReadWritablePeriod extends ReadablePeriod
The implementation of this interface will be mutable. It may provide more advanced methods than those in the interface.
| Modifier and Type | Method and Description |
|---|---|
void |
add(DurationFieldType field,
int value)
Adds to the value of one of the fields.
|
void |
add(int years,
int months,
int weeks,
int days,
int hours,
int minutes,
int seconds,
int millis)
Adds to each field of this period.
|
void |
add(ReadableInterval interval)
Adds an interval to this one by dividing the interval into
fields and then adding each field in turn.
|
void |
add(ReadablePeriod period)
Adds a period to this one by adding each field in turn.
|
void |
addDays(int days)
Adds the specified days to the number of days in the period.
|
void |
addHours(int hours)
Adds the specified hours to the number of hours in the period.
|
void |
addMillis(int millis)
Adds the specified millis to the number of millis in the period.
|
void |
addMinutes(int minutes)
Adds the specified minutes to the number of minutes in the period.
|
void |
addMonths(int months)
Adds the specified months to the number of months in the period.
|
void |
addSeconds(int seconds)
Adds the specified seconds to the number of seconds in the period.
|
void |
addWeeks(int weeks)
Adds the specified weeks to the number of weeks in the period.
|
void |
addYears(int years)
Adds the specified years to the number of years in the period.
|
void |
clear()
Clears the period, setting all values back to zero.
|
void |
set(DurationFieldType field,
int value)
Sets the value of one of the fields.
|
void |
setDays(int days)
Sets the number of days of the period.
|
void |
setHours(int hours)
Sets the number of hours of the period.
|
void |
setMillis(int millis)
Sets the number of millis of the period.
|
void |
setMinutes(int minutes)
Sets the number of minutes of the period.
|
void |
setMonths(int months)
Sets the number of months of the period.
|
void |
setPeriod(int years,
int months,
int weeks,
int days,
int hours,
int minutes,
int seconds,
int millis)
Sets all the fields in one go.
|
void |
setPeriod(ReadableInterval interval)
Sets all the fields in one go from an interval dividing the
fields using the period type.
|
void |
setPeriod(ReadablePeriod period)
Sets all the fields in one go from another ReadablePeriod.
|
void |
setSeconds(int seconds)
Sets the number of seconds of the period.
|
void |
setValue(int index,
int value)
Sets the value of one of the fields by index.
|
void |
setWeeks(int weeks)
Sets the number of weeks of the period.
|
void |
setYears(int years)
Sets the number of years of the period.
|
equals, get, getFieldType, getPeriodType, getValue, hashCode, isSupported, size, toMutablePeriod, toPeriod, toStringvoid clear()
void setValue(int index,
int value)
index - the field indexvalue - the new value for the fieldjava.lang.IndexOutOfBoundsException - if the index is invalidvoid set(DurationFieldType field, int value)
The field type specified must be one of those that is supported by the period.
field - a DurationFieldType instance that is supported by this periodvalue - the new value for the fieldjava.lang.IllegalArgumentException - if the field is null or not supportedvoid setPeriod(ReadablePeriod period)
period - the period to set, null means zero length periodjava.lang.IllegalArgumentException - if an unsupported field's value is non-zerovoid setPeriod(int years,
int months,
int weeks,
int days,
int hours,
int minutes,
int seconds,
int millis)
years - amount of years in this period, which must be zero if unsupportedmonths - amount of months in this period, which must be zero if unsupportedweeks - amount of weeks in this period, which must be zero if unsupporteddays - amount of days in this period, which must be zero if unsupportedhours - amount of hours in this period, which must be zero if unsupportedminutes - amount of minutes in this period, which must be zero if unsupportedseconds - amount of seconds in this period, which must be zero if unsupportedmillis - amount of milliseconds in this period, which must be zero if unsupportedjava.lang.IllegalArgumentException - if an unsupported field's value is non-zerovoid setPeriod(ReadableInterval interval)
interval - the interval to set, null means zero lengthvoid add(DurationFieldType field, int value)
The field type specified must be one of those that is supported by the period.
field - a DurationFieldType instance that is supported by this periodvalue - the value to add to the fieldjava.lang.IllegalArgumentException - if the field is null or not supportedvoid add(ReadablePeriod period)
period - the period to add, null means add nothingjava.lang.IllegalArgumentException - if the period being added contains a field
not supported by this periodjava.lang.ArithmeticException - if the addition exceeds the capacity of the periodvoid add(int years,
int months,
int weeks,
int days,
int hours,
int minutes,
int seconds,
int millis)
years - amount of years to add to this period, which must be zero if unsupportedmonths - amount of months to add to this period, which must be zero if unsupportedweeks - amount of weeks to add to this period, which must be zero if unsupporteddays - amount of days to add to this period, which must be zero if unsupportedhours - amount of hours to add to this period, which must be zero if unsupportedminutes - amount of minutes to add to this period, which must be zero if unsupportedseconds - amount of seconds to add to this period, which must be zero if unsupportedmillis - amount of milliseconds to add to this period, which must be zero if unsupportedjava.lang.IllegalArgumentException - if the period being added contains a field
not supported by this periodjava.lang.ArithmeticException - if the addition exceeds the capacity of the periodvoid add(ReadableInterval interval)
interval - the interval to add, null means add nothingjava.lang.ArithmeticException - if the addition exceeds the capacity of the periodvoid setYears(int years)
years - the number of yearsjava.lang.IllegalArgumentException - if field is not supported and the value is non-zerovoid addYears(int years)
years - the number of yearsjava.lang.IllegalArgumentException - if field is not supported and the value is non-zerojava.lang.ArithmeticException - if the addition exceeds the capacity of the periodvoid setMonths(int months)
months - the number of monthsjava.lang.IllegalArgumentException - if field is not supported and the value is non-zerovoid addMonths(int months)
months - the number of monthsjava.lang.IllegalArgumentException - if field is not supported and the value is non-zerojava.lang.ArithmeticException - if the addition exceeds the capacity of the periodvoid setWeeks(int weeks)
weeks - the number of weeksjava.lang.IllegalArgumentException - if field is not supported and the value is non-zerovoid addWeeks(int weeks)
weeks - the number of weeksjava.lang.IllegalArgumentException - if field is not supported and the value is non-zerojava.lang.ArithmeticException - if the addition exceeds the capacity of the periodvoid setDays(int days)
days - the number of daysjava.lang.IllegalArgumentException - if field is not supported and the value is non-zerovoid addDays(int days)
days - the number of daysjava.lang.IllegalArgumentException - if field is not supported and the value is non-zerojava.lang.ArithmeticException - if the addition exceeds the capacity of the periodvoid setHours(int hours)
hours - the number of hoursjava.lang.IllegalArgumentException - if field is not supported and the value is non-zerovoid addHours(int hours)
hours - the number of hoursjava.lang.IllegalArgumentException - if field is not supported and the value is non-zerojava.lang.ArithmeticException - if the addition exceeds the capacity of the periodvoid setMinutes(int minutes)
minutes - the number of minutesjava.lang.IllegalArgumentException - if field is not supported and the value is non-zerovoid addMinutes(int minutes)
minutes - the number of minutesjava.lang.IllegalArgumentException - if field is not supported and the value is non-zerojava.lang.ArithmeticException - if the addition exceeds the capacity of the periodvoid setSeconds(int seconds)
seconds - the number of secondsjava.lang.IllegalArgumentException - if field is not supported and the value is non-zerovoid addSeconds(int seconds)
seconds - the number of secondsjava.lang.IllegalArgumentException - if field is not supported and the value is non-zerojava.lang.ArithmeticException - if the addition exceeds the capacity of the periodvoid setMillis(int millis)
millis - the number of millisjava.lang.IllegalArgumentException - if field is not supported and the value is non-zerovoid addMillis(int millis)
millis - the number of millisjava.lang.IllegalArgumentException - if field is not supported and the value is non-zerojava.lang.ArithmeticException - if the addition exceeds the capacity of the periodCopyright © 2010 - 2023 Adobe. All Rights Reserved