public class IlvTimeInterval extends Object implements Cloneable, Serializable
IlvTimeInterval
represents a specific time span, with
millisecond precision. The time interval is defined by a start time and an
end time.
IlvTimeInterval
maintains the invariant that its start time is
always before or equal to its end time. This invariant is maintained quietly,
swapping its start and end time values as needed.Constructor and Description |
---|
IlvTimeInterval(Date startTime,
Date endTime)
Creates a new
IlvTimeInterval with the specified start
and end times. |
IlvTimeInterval(Date startTime,
IlvDuration duration)
Creates a new
IlvTimeInterval with the specified start
time and duration. |
Modifier and Type | Method and Description |
---|---|
Object |
clone()
Creates a copy of this time interval.
|
boolean |
contains(Date time)
Returns
true if the time interval contains the given time. |
boolean |
equals(Object obj)
Returns whether an object is logically equal to this interval.
|
IlvDuration |
getDuration()
Returns the duration between the interval start and end times.
|
Date |
getEnd()
Returns the interval end time.
|
Date |
getStart()
Returns the interval start time.
|
int |
hashCode()
Returns a hash code value for this interval.
|
IlvTimeInterval |
intersection(IlvTimeInterval interval)
Returns the intersection of the specified time interval with this one.
|
boolean |
overlaps(IlvTimeInterval interval)
Returns
true if the specified time interval overlaps this one. |
void |
setDuration(IlvDuration duration)
Sets the duration between the interval start and end times.
|
void |
setEnd(Date t)
Sets the interval end time.
|
void |
setInterval(Date start,
Date end)
Sets the interval start and end times.
|
void |
setInterval(Date start,
IlvDuration duration)
Sets the interval start time and duration.
|
void |
setStart(Date t)
Sets the interval start time.
|
String |
toString()
Returns a string representation of this time interval.
|
IlvTimeInterval |
union(IlvTimeInterval interval)
Returns the union of the specified time interval with this one.
|
public IlvTimeInterval(Date startTime, Date endTime)
IlvTimeInterval
with the specified start
and end times.startTime
- The interval start time.endTime
- The interval end time.public IlvTimeInterval(Date startTime, IlvDuration duration)
IlvTimeInterval
with the specified start
time and duration.startTime
- The interval start time.duration
- The interval duration.public Object clone()
public Date getStart()
public void setStart(Date t)
t > getEnd()
then t
will actually become the
interval's new end time and its previous end time will become its new start
time.t
- The start time of the interval.public Date getEnd()
public void setEnd(Date t)
t < getStart()
then t
will actually become the
interval's new start time and its previous start time will become its new
end time.t
- The end time of the interval.public void setInterval(Date start, Date end)
end < start
then the values will be silently
swapped and start
will actually become the interval's new end
time and end
will become the interval's new start time.start
- The start time of the interval.end
- The end time of the interval.public void setInterval(Date start, IlvDuration duration)
duration < 0
then start
will
silently become the interval's new end time.start
- The start time of the interval.duration
- The duration of the interval.public IlvDuration getDuration()
public void setDuration(IlvDuration duration)
duration < 0
then the
interval's current start time will silently become its end time.duration
- The duration of the interval.public boolean equals(Object obj)
true
if and only if the argument is
an IlvTimeInterval
object that represents the same
period of time as this interval.public int hashCode()
public boolean overlaps(IlvTimeInterval interval)
true
if the specified time interval overlaps this one.interval
- The interval to test.intersection(ilog.views.gantt.IlvTimeInterval)
public IlvTimeInterval intersection(IlvTimeInterval interval)
null
is returned.interval
- The interval to compute the intersection.null
.overlaps(ilog.views.gantt.IlvTimeInterval)
,
union(ilog.views.gantt.IlvTimeInterval)
public IlvTimeInterval union(IlvTimeInterval interval)
interval
- The interval to compute union.intersection(ilog.views.gantt.IlvTimeInterval)
public boolean contains(Date time)
true
if the time interval contains the given time.time
- The time to test.© Copyright 2024 Rogue Wave Software, Inc., a Perforce company.. All Rights Reserved.