|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Defines a duration of time that can be queried and modified using datetime fields.
The implementation of this interface will be mutable. It may provide more advanced methods than those in the interface.
Method Summary | |
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. |
Methods inherited from interface org.joda.time.ReadablePeriod |
equals, get, getFieldType, getPeriodType, getValue, hashCode, isSupported, size, toMutablePeriod, toPeriod, toString |
Method Detail |
public void clear()
public void setValue(int index, int value)
index
- the field indexvalue
- the new value for the field
IndexOutOfBoundsException
- if the index is invalidpublic void 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 field
IllegalArgumentException
- if the field is null or not supportedpublic void setPeriod(ReadablePeriod period)
period
- the period to set, null means zero length period
IllegalArgumentException
- if an unsupported field's value is non-zeropublic void 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 unsupported
IllegalArgumentException
- if an unsupported field's value is non-zeropublic void setPeriod(ReadableInterval interval)
interval
- the interval to set, null means zero lengthpublic void 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 field
IllegalArgumentException
- if the field is null or not supportedpublic void add(ReadablePeriod period)
period
- the period to add, null means add nothing
IllegalArgumentException
- if the period being added contains a field
not supported by this period
ArithmeticException
- if the addition exceeds the capacity of the periodpublic void 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 unsupported
IllegalArgumentException
- if the period being added contains a field
not supported by this period
ArithmeticException
- if the addition exceeds the capacity of the periodpublic void add(ReadableInterval interval)
interval
- the interval to add, null means add nothing
ArithmeticException
- if the addition exceeds the capacity of the periodpublic void setYears(int years)
years
- the number of years
IllegalArgumentException
- if field is not supported and the value is non-zeropublic void addYears(int years)
years
- the number of years
IllegalArgumentException
- if field is not supported and the value is non-zero
ArithmeticException
- if the addition exceeds the capacity of the periodpublic void setMonths(int months)
months
- the number of months
IllegalArgumentException
- if field is not supported and the value is non-zeropublic void addMonths(int months)
months
- the number of months
IllegalArgumentException
- if field is not supported and the value is non-zero
ArithmeticException
- if the addition exceeds the capacity of the periodpublic void setWeeks(int weeks)
weeks
- the number of weeks
IllegalArgumentException
- if field is not supported and the value is non-zeropublic void addWeeks(int weeks)
weeks
- the number of weeks
IllegalArgumentException
- if field is not supported and the value is non-zero
ArithmeticException
- if the addition exceeds the capacity of the periodpublic void setDays(int days)
days
- the number of days
IllegalArgumentException
- if field is not supported and the value is non-zeropublic void addDays(int days)
days
- the number of days
IllegalArgumentException
- if field is not supported and the value is non-zero
ArithmeticException
- if the addition exceeds the capacity of the periodpublic void setHours(int hours)
hours
- the number of hours
IllegalArgumentException
- if field is not supported and the value is non-zeropublic void addHours(int hours)
hours
- the number of hours
IllegalArgumentException
- if field is not supported and the value is non-zero
ArithmeticException
- if the addition exceeds the capacity of the periodpublic void setMinutes(int minutes)
minutes
- the number of minutes
IllegalArgumentException
- if field is not supported and the value is non-zeropublic void addMinutes(int minutes)
minutes
- the number of minutes
IllegalArgumentException
- if field is not supported and the value is non-zero
ArithmeticException
- if the addition exceeds the capacity of the periodpublic void setSeconds(int seconds)
seconds
- the number of seconds
IllegalArgumentException
- if field is not supported and the value is non-zeropublic void addSeconds(int seconds)
seconds
- the number of seconds
IllegalArgumentException
- if field is not supported and the value is non-zero
ArithmeticException
- if the addition exceeds the capacity of the periodpublic void setMillis(int millis)
millis
- the number of millis
IllegalArgumentException
- if field is not supported and the value is non-zeropublic void addMillis(int millis)
millis
- the number of millis
IllegalArgumentException
- if field is not supported and the value is non-zero
ArithmeticException
- if the addition exceeds the capacity of the period
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |