com.example.model
Class TimeInterval

java.lang.Object
  extended by com.example.model.TimeInterval

public class TimeInterval
extends java.lang.Object


Constructor Summary
TimeInterval(int sTime, int eTime)
          Constructor
 
Method Summary
 int difference()
          Returns the amount of time spanned by the interval.
 int getEnd()
          Return interval's end time.
 java.lang.String getEndTimeString()
          Converts the interval's end time from an integer in universal time to a string in standard time.
 int getStart()
          Return interval's start time.
 java.lang.String getStartTimeString()
          Converts the interval's start time from an integer in universal time to a string in standard time.
 boolean isAfter(TimeInterval times)
          Checks if a particular time interval occurs completely after this interval.
 boolean isBefore(TimeInterval times)
          Checks if a particular time interval occurs completely before this interval.
 boolean isDuring(TimeInterval times)
          Checks if a particular time interval occurs completely during this interval.
 boolean isEndOut(TimeInterval times)
          Checks if a particular time interval ends after this interval but starts during it.
 boolean isStartOut(TimeInterval times)
          Checks if a particular time interval starts before this interval but ends during it.
 void setEnd(int eTime)
          Set the end time of the interval.
 void setStart(int sTime)
          Set the start time of the interval.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TimeInterval

public TimeInterval(int sTime,
                    int eTime)
Constructor

Parameters:
sTime - The start time for the interval.
eTime - The end time for the interval.
Method Detail

getStart

public int getStart()
Return interval's start time.

Returns:
The interval's start time.

getEnd

public int getEnd()
Return interval's end time.

Returns:
The interval's end time.

getStartTimeString

public java.lang.String getStartTimeString()
Converts the interval's start time from an integer in universal time to a string in standard time. 1745 would be returned as "15:45 PM".

Returns:
A string representation of the start time.

getEndTimeString

public java.lang.String getEndTimeString()
Converts the interval's end time from an integer in universal time to a string in standard time. 1745 would be returned as "15:45 PM".

Returns:
A string representation of the start time.

setStart

public void setStart(int sTime)
Set the start time of the interval.

Parameters:
sTime - The new start time.

setEnd

public void setEnd(int eTime)
Set the end time of the interval.

Parameters:
eTime - The new end time.

isBefore

public boolean isBefore(TimeInterval times)
Checks if a particular time interval occurs completely before this interval.

Parameters:
times - The time interval to be checked.
Returns:
True if times is before this interval, false if it is not.

isAfter

public boolean isAfter(TimeInterval times)
Checks if a particular time interval occurs completely after this interval.

Parameters:
times - The time interval to be checked.
Returns:
True if times is after this interval, false if it is not.

isDuring

public boolean isDuring(TimeInterval times)
Checks if a particular time interval occurs completely during this interval.

Parameters:
times - The time interval to be checked.
Returns:
True if times is during this interval, false if it is not.

isStartOut

public boolean isStartOut(TimeInterval times)
Checks if a particular time interval starts before this interval but ends during it.

Parameters:
times - The time interval to be checked.
Returns:
True if times starts before this interval and ends during it, false otherwise.

isEndOut

public boolean isEndOut(TimeInterval times)
Checks if a particular time interval ends after this interval but starts during it.

Parameters:
times - The time interval to be checked.
Returns:
True if times ends after this interval and starts during it, false otherwise.

difference

public int difference()
Returns the amount of time spanned by the interval.

Returns:
The amount of time spanned by the interval.