|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnet.fortuna.ical4j.model.Period
public class Period
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.
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(java.lang.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(java.lang.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(java.lang.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(java.util.Date date)
Determines if the specified date occurs within this period (inclusive of period start and end). |
boolean |
includes(java.util.Date date,
boolean inclusive)
Deprecated. use includes(Date, int) instead. |
boolean |
includes(java.util.Date date,
int inclusiveMask)
Decides whether a date falls within this period. |
boolean |
intersects(Period period)
Decides whether this period intersects with another one. |
boolean |
isEmpty()
An empty period is one that consumes no time. |
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. |
PeriodList |
subtract(Period period)
Creates a set of periods resulting from the subtraction of the specified period from this one. |
java.lang.String |
toString()
|
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final int INCLUSIVE_START
public static final int INCLUSIVE_END
Constructor Detail |
---|
public Period(java.lang.String aValue) throws java.text.ParseException
aValue
- a string representation of a period
java.text.ParseException
- where the specified string is not a valid representationpublic Period(DateTime start, DateTime end)
start
- the start date of the periodend
- the end date of the periodpublic Period(DateTime start, Dur duration)
start
- the start date of the periodduration
- the duration of the periodMethod Detail |
---|
public final Dur getDuration()
public final DateTime getEnd()
public final DateTime getStart()
public final boolean includes(java.util.Date date)
date
-
public final boolean includes(java.util.Date date, boolean inclusive)
includes(Date, int)
instead.
date
- inclusive
-
public final boolean includes(java.util.Date date, int inclusiveMask)
date
- the date to be testedinclusive
- specifies whether period start and end are included
in the calculation
public final boolean before(Period period)
period
- a period that may or may not start after this period ends
public final boolean after(Period period)
period
- a period that may or may not end before this period starts
public final boolean intersects(Period period)
period
- a possible intersecting period
public final boolean adjacent(Period period)
public final boolean contains(Period period)
period
- the period that may be contained by this one
public final Period add(Period period)
period
- the period to add to this one
public final PeriodList subtract(Period period)
period
-
public final boolean isEmpty()
public void setUtc(boolean utc)
utc
- public final void setTimeZone(TimeZone timezone)
timezone
- public final java.lang.String toString()
toString
in class java.lang.Object
Object.toString()
public final int compareTo(java.lang.Object arg0)
compareTo
in interface java.lang.Comparable
public final int compareTo(Period arg0)
arg0
-
public final boolean equals(java.lang.Object o)
ObjectUtils
to test equality.
equals
in class java.lang.Object
o
- object being compared for equality
public final int hashCode()
HashCodeBuilder
to build hashcode.
hashCode
in class java.lang.Object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |