Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.bea.wli.calendar.api
Interface Interval

All Superinterfaces:
  Serializable

    public interface Interval

extends Serializable

Represents a time interval in years, months, days, hours, minutes, seconds. An interval can be converted to a string value by using the toString() method. The format of this string is described in the description of the toString() method.

See Also:
  `toString()`

Method Summary
`void` | `clear()` Set all components of this interval to zero (in other words, 0 years, 0 months, 0 days, 0 hours, 0 minutes, 0 seconds
`Date` | `computeDate(Date startdate)` Compute the date at the end of the interval assuming the given date marks the start of the interval.
`long` | `computeTotalSeconds()` Get the computed number of seconds represented in this interval.
`long` | `getDays()` Get the number of days represented in this interval.
`String` | `getDescription()` Returns a string representation of an interval.
`long` | `getHours()` Get the number of hours represented in this interval.
`long` | `getMinutes()` Get the number of minutes represented in this interval.
`long` | `getMonths()` Get the number of months represented in this interval.
`long` | `getSeconds()` Get the number of seconds represented in this interval.
`long` | `getYears()` Get the number of years represented in this interval.
`boolean` | `isZero()` Is this duration of zero length?
`void` | `setDays(long days)` Set the number of days represented in this interval.
`void` | `setFromDescription(String interval)` Parse a string representation of an interval in `<years>y<months>m<days>dt<hours>h<minutes>m<seconds>s` format and initialize this Interval instance with the parsed values.
`void` | `setHours(long hours)` Set the number of hours represented in this interval.
`void` | `setMinutes(long minutes)` Set the number of minutes represented in this interval.
`void` | `setMonths(long months)` Set the number of months represented in this interval.
`void` | `setSeconds(long seconds)` Set the number of seconds represented in this interval.
`void` | `setYears(long years)` Set the number of years represented in this interval.
`String` | `toString()` Get a string representation of this interval in `<years>y<months>m<days>dt<hours>h<minutes>m<seconds>s` format.

Method Detail

### clear

    void clear()

  Set all components of this interval to zero (in other words, 0 years, 0 months, 0 days, 0 hours, 0 minutes, 0 seconds

### isZero

    boolean isZero()

  Is this duration of zero length?

### getYears

    long getYears()

  Get the number of years represented in this interval. This is the value directly set on this instance, and it not calculated in any way.

### setYears

    void setYears(long years)

  Set the number of years represented in this interval. This value is simply stored in this instance, and is not combined with the other interval fields in any way.

### getMonths

    long getMonths()

  Get the number of months represented in this interval. This is the value directly set on this instance, and it not calculated in any way.

### setMonths

    void setMonths(long months)

  Set the number of months represented in this interval. This value is simply stored in this instance, and is not combined with the other interval fields in any way.

### getDays

    long getDays()

  Get the number of days represented in this interval. This is the value directly set on this instance, and it not calculated in any way.

### setDays

    void setDays(long days)

  Set the number of days represented in this interval. This value is simply stored in this instance, and is not combined with the other interval fields in any way.

### getHours

    long getHours()

  Get the number of hours represented in this interval. This is the value directly set on this instance, and it not calculated in any way.

### setHours

    void setHours(long hours)

  Set the number of hours represented in this interval. This value is simply stored in this instance, and is not combined with the other interval fields in any way.

### getMinutes

    long getMinutes()

  Get the number of minutes represented in this interval. This is the value directly set on this instance, and it not calculated in any way.

### setMinutes

    void setMinutes(long minutes)

  Set the number of minutes represented in this interval. This value is simply stored in this instance, and is not combined with the other interval fields in any way.

### getSeconds

    long getSeconds()

  Get the number of seconds represented in this interval. This is the value directly set on this instance, and it not calculated in any way.

### setSeconds

    void setSeconds(long seconds)

  Set the number of seconds represented in this interval. This value is simply stored in this instance, and is not combined with the other interval fields in any way.

### computeTotalSeconds

    long computeTotalSeconds()

  Get the computed number of seconds represented in this interval. The computation is performed with the assumption that
  - 1 year = 365 days
  - 1 month = 30 days
  - 1 day = 24 hours
  - 1 hour = 60 minutes
  - 1 minute = 60 seconds
  So it can easily be seen that the computed number of seconds is only approximately the true value of the interval.

### computeDate

    Date computeDate(Date startdate)

  Compute the date at the end of the interval assuming the given date marks the start of the interval. This calculation is exact in that it takes into account the actual number of years, months, days, etc. the interval spans.

### setFromDescription

    void setFromDescription(String interval)

  Parse a string representation of an interval in `<years>y<months>m<days>dt<hours>h<minutes>m<seconds>s` format and initialize this Interval instance with the parsed values. For example, the interval with 1 years, 2 months, 3 days, 4 hours, 5 minutes, and 6 seconds would be represented as the string `1y2m3dt4h5m6s`

  Parameters:
    `interval` - The string version of the interval to set into this Interval instance.

### getDescription

    String getDescription()

  Returns a string representation of an interval. Example: interval with 1y2m3dt4h5m6s would be returned as the string `1 years, 2 months, 3 days, 4 hours, 5 minutes, and 6 seconds`

### toString

    String toString()

  Get a string representation of this interval in `<years>y<months>m<days>dt<hours>h<minutes>m<seconds>s` format. For example, the interval with 1 years, 2 months, 3 days, 4 hours, 5 minutes, and 6 seconds would be represented as the string `1y2m3dt4h5m6s`

  Overrides:
    `toString` in class `Object`

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD