|
JTemporal Home Tutorial |
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectnet.sf.jtemporal.Period
public class Period
Represents a "half-open" immutable time range (which includes the start
instant, but not the end instant).
It does not implement Cloneable, because there is no reason to clone an
immutable object.
Note: if the period is [negativeInfinity, positiveInfinity[ , then all the instants are contained, including positive infinity.
| Constructor Summary | |
|---|---|
Period(Instant start,
Instant end)
Constructs an immutable Instant instance. |
|
| Method Summary | |
|---|---|
int |
compareTo(Period p)
Orders first by start and if start instants are equals, by end. |
boolean |
contains(Instant i)
Returns true if this period contains the instant i. |
boolean |
contains(Period p)
Returns true if this period contains of is equal to p. |
boolean |
equals(java.lang.Object o)
Compares this object against the specified object. |
Period |
except(Period p)
Returns the part of this period which is not part of p. |
Instant |
getEnd()
The instant delimiting the end of this period. |
Instant |
getStart()
The instant delimiting the beginning of this period. |
int |
hashCode()
Computes a hash code for this Period. |
Period |
intersect(Period p)
Returns a period representing the common part in the two periods. |
boolean |
meets(Period p)
Returns true if this period meets p. |
boolean |
meetsAfter(Period p)
Returns true if this period meets and succeeds p. |
boolean |
meetsBefore(Period p)
Returns true if this period meets and precedes p. |
boolean |
overlaps(Period p)
Returns true if there exists an intersection between the two periods. |
boolean |
precedes(Instant i)
Return true is this period precedes i. |
boolean |
precedes(Period p)
Return true is this period precedes p. |
Period |
precedingPeriod(Period p)
Returns the part of this period that precedes p, or null if p.start < this.start |
Period |
succedingPeriod(Period p)
Returns the part of this period that succeeds p, or null if p.end > this.end |
boolean |
succeeds(Instant i)
Returns true if this period succeeds i. |
boolean |
succeeds(Period p)
Returns true if this period succeeds p. |
java.lang.String |
toString()
Textual representation of this object. |
Period |
union(Period p)
Returns the result of the merge of two periods. |
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public Period(Instant start,
Instant end)
java.lang.IllegalArgumentException - when start >= end| Method Detail |
|---|
public int compareTo(Period p)
compareTo in interface java.lang.Comparable<Period>public boolean equals(java.lang.Object o)
true if and only if the argument is
not null and is a Period object that
contains the same start and end values as this object.
equals in class java.lang.Objectobj - the object to compare with.
true if the objects are the same;
false otherwise.public int hashCode()
hashCode in class java.lang.Objectpublic Instant getStart()
public Instant getEnd()
public boolean precedes(Period p)
p - the period checked to be succeeding.
public boolean precedes(Instant i)
i - the instant checked to be succeeding.
public boolean succeeds(Period p)
p - the period checked to be preceding.
public boolean succeeds(Instant i)
p - the period checked to be preceding.
public boolean meets(Period p)
p - the period checked to be immediately succeeding or preceding.
public boolean meetsBefore(Period p)
p - the period checked to be immediately succeeding.
public boolean meetsAfter(Period p)
p - the period checked to be immediately succeeding.
public boolean contains(Period p)
p - the period checked to be contained.
public boolean contains(Instant i)
i - the instant checked to be contained.
public boolean overlaps(Period p)
p - the period to be checked for intersection against this period
true when this.start < p.end and this.end > p.startpublic Period union(Period p)
p - the period to be merged to this period
java.lang.IllegalArgumentException - when the periods does not matchpublic Period except(Period p)
p - the period to be subtracted from this period
java.lang.IllegalArgumentException - when operation should
return two distinct periodspublic Period precedingPeriod(Period p)
p - the period that meetsAfter the result
public Period succedingPeriod(Period p)
p - the period that meetsBefore the result
public Period intersect(Period p)
p - the period to be intersected with this period
public java.lang.String toString()
toString in class java.lang.Object
|
JTemporal Home Tutorial |
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||