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

## net.fortuna.ical4j.model
Class Period

    java.lang.Object
      net.fortuna.ical4j.model.Period

All Implemented Interfaces:
  Serializable, Comparable

    public class Period

extends Object
implements Serializable, Comparable

Defines a period of time. A period may be specified as either a start date and end date, or a start date and duration. NOTE: End dates and durations are implicitly derived when not explicitly specified. This means that you cannot rely on the returned values from the getters to deduce whether a period has an explicit end date or duration.

Author:
  Ben Fortuna
See Also:
  Serialized Form

Field Summary
`static int` | `INCLUSIVE_END`
`static int` | `INCLUSIVE_START`

Constructor Summary
`Period(DateTime start, DateTime end)` Constructs a new period with the specied start and end date.
`Period(DateTime start, Dur duration)` Constructs a new period with the specified start date and duration.
`Period(String aValue)` Constructor.

Method Summary
`Period` | `add(Period period)` Creates a period that encompasses both this period and another one.
`boolean` | `adjacent(Period period)` Decides whether these periods are serial without a gap.
`boolean` | `after(Period period)` Decides whether this period starts after the given period ends.
`boolean` | `before(Period period)` Decides whether this period is completed before the given period starts.
`int` | `compareTo(Object arg0)`
`int` | `compareTo(Period arg0)` Compares the specified period with this period.
`boolean` | `contains(Period period)` Decides whether the given period is completely contained within this one.
`boolean` | `equals(Object o)` Uses `ObjectUtils` to test equality.
`Dur` | `getDuration()` Returns the duration of this period.
`DateTime` | `getEnd()` Returns the end date of this period.
`DateTime` | `getStart()`
`int` | `hashCode()` Uses `HashCodeBuilder` to build hashcode.
`boolean` | `includes(Date date)` Determines if the specified date occurs within this period (inclusive of period start and end).
`boolean` | `includes(Date date, boolean inclusive)` Deprecated. use `includes(Date, int)` instead.
`boolean` | `includes(Date date, int inclusiveMask)` Decides whether a date falls within this period.
`boolean` | `intersects(Period period)` Decides whether this period intersects with another one.
`void` | `setTimeZone(TimeZone timezone)` Updates the start and (possible) end times of this period to reflect the specified timezone status.
`void` | `setUtc(boolean utc)` Updates the start and (possible) end times of this period to reflect the specified UTC timezone status.
`String` | `toString()`

Methods inherited from class java.lang.Object
`clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

Field Detail

### INCLUSIVE_START

    public static final int INCLUSIVE_START

See Also:
  Constant Field Values

### INCLUSIVE_END

    public static final int INCLUSIVE_END

See Also:
  Constant Field Values

Constructor Detail

### Period

    public Period(String aValue)
           throws ParseException

  Constructor.

  Parameters:
    `aValue` - a string representation of a period
  Throws:
    `ParseException` - where the specified string is not a valid representation

### Period

    public Period(DateTime start,
                  DateTime end)

  Constructs a new period with the specied start and end date.

  Parameters:
    `start` - the start date of the period
    `end` - the end date of the period

### Period

    public Period(DateTime start,
                  Dur duration)

  Constructs a new period with the specified start date and duration.

  Parameters:
    `start` - the start date of the period
    `duration` - the duration of the period

Method Detail

### getDuration

    public final Dur getDuration()

  Returns the duration of this period. If an explicit duration is not specified, the duration is derived from the end date.

  Returns:
    the duration of this period in milliseconds.

### getEnd

    public final DateTime getEnd()

  Returns the end date of this period. If an explicit end date is not specified, the end date is derived from the duration.

  Returns:
    the end date of this period.

### getStart

    public final DateTime getStart()

  Returns:
    Returns the start.

### includes

    public final boolean includes(Date date)

  Determines if the specified date occurs within this period (inclusive of period start and end).

  Parameters:
    `date` -
  Returns:
    true if the specified date occurs within the current period

### includes

    public final boolean includes(Date date,
                                  boolean inclusive)

  Deprecated. use `includes(Date, int)` instead.

  Parameters:
    `date` -
    `inclusive` -
  Returns:

### includes

    public final boolean includes(Date date,
                                  int inclusiveMask)

  Decides whether a date falls within this period.

  Parameters:
    `date` - the date to be tested
    `inclusive` - specifies whether period start and end are included in the calculation
  Returns:
    true if the date is in the perod, false otherwise

### before

    public final boolean before(Period period)

  Decides whether this period is completed before the given period starts.

  Parameters:
    `period` - a period that may or may not start after this period ends
  Returns:
    true if the specified period starts after this periods ends, otherwise false

### after

    public final boolean after(Period period)

  Decides whether this period starts after the given period ends.

  Parameters:
    `period` - a period that may or may not end before this period starts
  Returns:
    true if the specified period end before this periods starts, otherwise false

### intersects

    public final boolean intersects(Period period)

  Decides whether this period intersects with another one.

  Parameters:
    `period` - a possible intersecting period
  Returns:
    true if the specified period intersects this one, false otherwise.

### adjacent

    public final boolean adjacent(Period period)

  Decides whether these periods are serial without a gap.

  Returns:
    true if one period immediately follows the other, false otherwise

### contains

    public final boolean contains(Period period)

  Decides whether the given period is completely contained within this one.

  Parameters:
    `period` - the period that may be contained by this one
  Returns:
    true if this period covers all the dates of the specified period, otherwise false

### add

    public final Period add(Period period)

  Creates a period that encompasses both this period and another one. If the other period is null, return a copy of this period. NOTE: Resulting periods are specified by explicitly setting a start date and end date (i.e. durations are implied).

  Parameters:
    `period` - the period to add to this one
  Returns:
    a period

### setUtc

    public void setUtc(boolean utc)

  Updates the start and (possible) end times of this period to reflect the specified UTC timezone status.

  Parameters:
    `utc` -

### setTimeZone

    public final void setTimeZone(TimeZone timezone)

  Updates the start and (possible) end times of this period to reflect the specified timezone status.

  Parameters:
    `timezone` -

### toString

    public final String toString()

  Overrides:
    `toString` in class `Object`
  See Also:
    `Object.toString()`

### compareTo

    public final int compareTo(Object arg0)

  Specified by:
    `compareTo` in interface `Comparable`

### compareTo

    public final int compareTo(Period arg0)

  Compares the specified period with this period.

  Parameters:
    `arg0` -
  Returns:

### equals

    public final boolean equals(Object o)

  Uses `ObjectUtils` to test equality.

  Overrides:
    `equals` in class `Object`
  Parameters:
    `o` - object being compared for equality
  Returns:
    true if the objects are equal, false otherwise

### hashCode

    public final int hashCode()

  Uses `HashCodeBuilder` to build hashcode.

  Overrides:
    `hashCode` in class `Object`

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

Copyright © 2004-2007 Modularity. All Rights Reserved.