at.ac.tuwien.cs.ztimeview.time
Class TimeInterval

java.lang.Object
  extended byat.ac.tuwien.cs.ztimeview.time.TimeInterval
All Implemented Interfaces:
Interval, Timed

public class TimeInterval
extends java.lang.Object
implements Interval

Class representing a time interval and implementing the Allen's relations

Version:
0.6 created: 2003-02-25 last change: 2003-04-01
Author:
Wolfgang Aigner

Field Summary
static java.lang.String MILLISECONDS
           
 
Constructor Summary
TimeInterval()
          Default constructor
TimeInterval(java.util.Date start, java.util.Date end)
          Constructor
TimeInterval(Interval interval)
          Constructor
 
Method Summary
 boolean after(java.util.Date t)
          Determine if given instant is before interval
 boolean after(TimeInterval i)
          Determine if this interval is after the given one
static boolean areEqual(Interval i1, Interval i2)
          Determine if the provided intervals are equal
 boolean before(java.util.Date t)
          Determine if given instant is after interval
 boolean before(TimeInterval i)
          Determine if this interval is before the given one
 boolean contains(java.util.Date t)
          Determine if given instant is within interval
 boolean contains(TimeInterval i)
          Determine if this interval contains the given one
 boolean during(TimeInterval i)
          Determine if this interval is during the given one
 boolean equals(TimeInterval i)
          Determine if this interval equals the given one
 boolean finishedBy(TimeInterval i)
          Determine if this interval is finished by the given one
 boolean finishes(TimeInterval i)
          Determine if this interval finishes the given one
 long getDuration()
          Get the duration of the interval
static long getDuration(Interval interval)
          Get the duration of the interval
 java.util.Date getEnd()
          Get end of plan
 java.util.Date getStart()
          Get start time
 boolean meets(TimeInterval i)
          Determine if this interval meets the given one
 boolean metBy(TimeInterval i)
          Determine if this interval is met by the given one
 boolean overlappedBy(TimeInterval i)
          Determine if this interval is overlapped by the given one
 boolean overlaps(TimeInterval i)
          Determine if this interval overlaps the given one
 void setEnd(java.util.Date end)
          Set end of plan
 void setStart(java.util.Date start)
          Set start time
 boolean startedBy(TimeInterval i)
          Determine if this interval is started by the given one
 boolean starts(TimeInterval i)
          Determine if this interval starts the given one
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

MILLISECONDS

public static final java.lang.String MILLISECONDS
See Also:
Constant Field Values
Constructor Detail

TimeInterval

public TimeInterval()
             throws java.lang.IllegalArgumentException
Default constructor


TimeInterval

public TimeInterval(Interval interval)
             throws java.lang.IllegalArgumentException
Constructor

Parameters:
interval - time interval

TimeInterval

public TimeInterval(java.util.Date start,
                    java.util.Date end)
             throws java.lang.IllegalArgumentException
Constructor

Parameters:
start - start time of interval
end - end time of interval
Method Detail

areEqual

public static boolean areEqual(Interval i1,
                               Interval i2)
Determine if the provided intervals are equal


equals

public boolean equals(TimeInterval i)
Determine if this interval equals the given one

Parameters:
i - interval to compare

before

public boolean before(TimeInterval i)
Determine if this interval is before the given one

Parameters:
i - interval to compare

after

public boolean after(TimeInterval i)
Determine if this interval is after the given one

Parameters:
i - interval to compare

meets

public boolean meets(TimeInterval i)
Determine if this interval meets the given one

Parameters:
i - interval to compare

metBy

public boolean metBy(TimeInterval i)
Determine if this interval is met by the given one

Parameters:
i - interval to compare

overlaps

public boolean overlaps(TimeInterval i)
Determine if this interval overlaps the given one

Parameters:
i - interval to compare

overlappedBy

public boolean overlappedBy(TimeInterval i)
Determine if this interval is overlapped by the given one

Parameters:
i - interval to compare

starts

public boolean starts(TimeInterval i)
Determine if this interval starts the given one

Parameters:
i - interval to compare

startedBy

public boolean startedBy(TimeInterval i)
Determine if this interval is started by the given one

Parameters:
i - interval to compare

during

public boolean during(TimeInterval i)
Determine if this interval is during the given one

Parameters:
i - interval to compare

contains

public boolean contains(TimeInterval i)
Determine if this interval contains the given one

Parameters:
i - interval to compare

finishes

public boolean finishes(TimeInterval i)
Determine if this interval finishes the given one

Parameters:
i - interval to compare

finishedBy

public boolean finishedBy(TimeInterval i)
Determine if this interval is finished by the given one

Parameters:
i - interval to compare

contains

public boolean contains(java.util.Date t)
Determine if given instant is within interval

Parameters:
t - instant to test

after

public boolean after(java.util.Date t)
Determine if given instant is before interval

Parameters:
t - instant to test

before

public boolean before(java.util.Date t)
Determine if given instant is after interval

Parameters:
t - instant to test

getDuration

public long getDuration()
Get the duration of the interval

Returns:
duration in milliseconds

getDuration

public static long getDuration(Interval interval)
Get the duration of the interval

Parameters:
interval - Interval to calculate duration for
Returns:
duration in milliseconds

setStart

public void setStart(java.util.Date start)
              throws java.lang.IllegalArgumentException
Set start time

Specified by:
setStart in interface Interval
Parameters:
start - start time of plan
Throws:
java.lang.IllegalArgumentException

getStart

public java.util.Date getStart()
Get start time

Specified by:
getStart in interface Interval
Returns:
start time of plan

setEnd

public void setEnd(java.util.Date end)
Set end of plan

Specified by:
setEnd in interface Interval
Parameters:
end - end of plan

getEnd

public java.util.Date getEnd()
Get end of plan

Specified by:
getEnd in interface Interval
Returns:
end of plan


Copyright © 2004 by Vienna University of Technology.