public interface

ReadWritablePeriod

implements ReadablePeriod
org.joda.time.ReadWritablePeriod
Known Indirect Subclasses

Class Overview

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.

Summary

Public Methods
abstract 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.
abstract void add(ReadablePeriod period)
Adds a period to this one by adding each field in turn.
abstract void add(ReadableInterval interval)
Adds an interval to this one by dividing the interval into fields and then adding each field in turn.
abstract void add(DurationFieldType field, int value)
Adds to the value of one of the fields.
abstract void addDays(int days)
Adds the specified days to the number of days in the period.
abstract void addHours(int hours)
Adds the specified hours to the number of hours in the period.
abstract void addMillis(int millis)
Adds the specified millis to the number of millis in the period.
abstract void addMinutes(int minutes)
Adds the specified minutes to the number of minutes in the period.
abstract void addMonths(int months)
Adds the specified months to the number of months in the period.
abstract void addSeconds(int seconds)
Adds the specified seconds to the number of seconds in the period.
abstract void addWeeks(int weeks)
Adds the specified weeks to the number of weeks in the period.
abstract void addYears(int years)
Adds the specified years to the number of years in the period.
abstract void clear()
Clears the period, setting all values back to zero.
abstract void set(DurationFieldType field, int value)
Sets the value of one of the fields.
abstract void setDays(int days)
Sets the number of days of the period.
abstract void setHours(int hours)
Sets the number of hours of the period.
abstract void setMillis(int millis)
Sets the number of millis of the period.
abstract void setMinutes(int minutes)
Sets the number of minutes of the period.
abstract void setMonths(int months)
Sets the number of months of the period.
abstract void setPeriod(ReadablePeriod period)
Sets all the fields in one go from another ReadablePeriod.
abstract void setPeriod(ReadableInterval interval)
Sets all the fields in one go from an interval dividing the fields using the period type.
abstract 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.
abstract void setSeconds(int seconds)
Sets the number of seconds of the period.
abstract void setValue(int index, int value)
Sets the value of one of the fields by index.
abstract void setWeeks(int weeks)
Sets the number of weeks of the period.
abstract void setYears(int years)
Sets the number of years of the period.
[Expand]
Inherited Methods
From interface org.joda.time.ReadablePeriod

Public Methods

public abstract 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.

Parameters
years amount of years to add to this period, which must be zero if unsupported
months amount of months to add to this period, which must be zero if unsupported
weeks amount of weeks to add to this period, which must be zero if unsupported
days amount of days to add to this period, which must be zero if unsupported
hours amount of hours to add to this period, which must be zero if unsupported
minutes amount of minutes to add to this period, which must be zero if unsupported
seconds amount of seconds to add to this period, which must be zero if unsupported
millis amount of milliseconds to add to this period, which must be zero if unsupported
Throws
IllegalArgumentException if the period being added contains a field not supported by this period
ArithmeticException if the addition exceeds the capacity of the period

public abstract void add (ReadablePeriod period)

Adds a period to this one by adding each field in turn.

Parameters
period the period to add, null means add nothing
Throws
IllegalArgumentException if the period being added contains a field not supported by this period
ArithmeticException if the addition exceeds the capacity of the period

public abstract void add (ReadableInterval interval)

Adds an interval to this one by dividing the interval into fields and then adding each field in turn.

Parameters
interval the interval to add, null means add nothing
Throws
ArithmeticException if the addition exceeds the capacity of the period

public abstract void add (DurationFieldType field, int value)

Adds to the value of one of the fields.

The field type specified must be one of those that is supported by the period.

Parameters
field a DurationFieldType instance that is supported by this period
value the value to add to the field
Throws
IllegalArgumentException if the field is null or not supported

public abstract void addDays (int days)

Adds the specified days to the number of days in the period.

Parameters
days the number of days
Throws
IllegalArgumentException if field is not supported and the value is non-zero
ArithmeticException if the addition exceeds the capacity of the period

public abstract void addHours (int hours)

Adds the specified hours to the number of hours in the period.

Parameters
hours the number of hours
Throws
IllegalArgumentException if field is not supported and the value is non-zero
ArithmeticException if the addition exceeds the capacity of the period

public abstract void addMillis (int millis)

Adds the specified millis to the number of millis in the period.

Parameters
millis the number of millis
Throws
IllegalArgumentException if field is not supported and the value is non-zero
ArithmeticException if the addition exceeds the capacity of the period

public abstract void addMinutes (int minutes)

Adds the specified minutes to the number of minutes in the period.

Parameters
minutes the number of minutes
Throws
IllegalArgumentException if field is not supported and the value is non-zero
ArithmeticException if the addition exceeds the capacity of the period

public abstract void addMonths (int months)

Adds the specified months to the number of months in the period.

Parameters
months the number of months
Throws
IllegalArgumentException if field is not supported and the value is non-zero
ArithmeticException if the addition exceeds the capacity of the period

public abstract void addSeconds (int seconds)

Adds the specified seconds to the number of seconds in the period.

Parameters
seconds the number of seconds
Throws
IllegalArgumentException if field is not supported and the value is non-zero
ArithmeticException if the addition exceeds the capacity of the period

public abstract void addWeeks (int weeks)

Adds the specified weeks to the number of weeks in the period.

Parameters
weeks the number of weeks
Throws
IllegalArgumentException if field is not supported and the value is non-zero
ArithmeticException if the addition exceeds the capacity of the period

public abstract void addYears (int years)

Adds the specified years to the number of years in the period.

Parameters
years the number of years
Throws
IllegalArgumentException if field is not supported and the value is non-zero
ArithmeticException if the addition exceeds the capacity of the period

public abstract void clear ()

Clears the period, setting all values back to zero.

public abstract void set (DurationFieldType field, int value)

Sets the value of one of the fields.

The field type specified must be one of those that is supported by the period.

Parameters
field a DurationFieldType instance that is supported by this period
value the new value for the field
Throws
IllegalArgumentException if the field is null or not supported

public abstract void setDays (int days)

Sets the number of days of the period.

Parameters
days the number of days
Throws
IllegalArgumentException if field is not supported and the value is non-zero

public abstract void setHours (int hours)

Sets the number of hours of the period.

Parameters
hours the number of hours
Throws
IllegalArgumentException if field is not supported and the value is non-zero

public abstract void setMillis (int millis)

Sets the number of millis of the period.

Parameters
millis the number of millis
Throws
IllegalArgumentException if field is not supported and the value is non-zero

public abstract void setMinutes (int minutes)

Sets the number of minutes of the period.

Parameters
minutes the number of minutes
Throws
IllegalArgumentException if field is not supported and the value is non-zero

public abstract void setMonths (int months)

Sets the number of months of the period.

Parameters
months the number of months
Throws
IllegalArgumentException if field is not supported and the value is non-zero

public abstract void setPeriod (ReadablePeriod period)

Sets all the fields in one go from another ReadablePeriod.

Parameters
period the period to set, null means zero length period
Throws
IllegalArgumentException if an unsupported field's value is non-zero

public abstract void setPeriod (ReadableInterval interval)

Sets all the fields in one go from an interval dividing the fields using the period type.

Parameters
interval the interval to set, null means zero length

public abstract 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.

Parameters
years amount of years in this period, which must be zero if unsupported
months amount of months in this period, which must be zero if unsupported
weeks amount of weeks in this period, which must be zero if unsupported
days amount of days in this period, which must be zero if unsupported
hours amount of hours in this period, which must be zero if unsupported
minutes amount of minutes in this period, which must be zero if unsupported
seconds amount of seconds in this period, which must be zero if unsupported
millis amount of milliseconds in this period, which must be zero if unsupported
Throws
IllegalArgumentException if an unsupported field's value is non-zero

public abstract void setSeconds (int seconds)

Sets the number of seconds of the period.

Parameters
seconds the number of seconds
Throws
IllegalArgumentException if field is not supported and the value is non-zero

public abstract void setValue (int index, int value)

Sets the value of one of the fields by index.

Parameters
index the field index
value the new value for the field
Throws
IndexOutOfBoundsException if the index is invalid

public abstract void setWeeks (int weeks)

Sets the number of weeks of the period.

Parameters
weeks the number of weeks
Throws
IllegalArgumentException if field is not supported and the value is non-zero

public abstract void setYears (int years)

Sets the number of years of the period.

Parameters
years the number of years
Throws
IllegalArgumentException if field is not supported and the value is non-zero