Class DayTimeRanges

java.lang.Object
  |
  +--DayTimeRanges
All Implemented Interfaces:
java.lang.Cloneable

public class DayTimeRanges
extends java.lang.Object
implements java.lang.Cloneable

Represents a range or ranges of time(s) in a day


Field Summary
private  boolean[] dayTimeRanges
          Contains time range information (Consult data dictionary for more information on how our time ranges are being represented)
 
Constructor Summary
DayTimeRanges()
          Constructs a day with no time ranges designated
DayTimeRanges(Times startTime, Times stopTime)
          Constructs a day with one time range designated
 
Method Summary
 void Clear()
          Clears the entire time range
 java.lang.Object clone()
          Makes a copy of the current object
 boolean[] Compare(boolean[] toCompare)
          Compares two times to see where they overlap
 boolean[] Get()
          Gets the day's time ranges as a boolean array
 java.util.Vector GetStartStopTimes()
          Gets the day's time ranges as a vector of start and stop Times This function goes through the private boolean array.
 void Insert(Times startTime, Times endTime)
          Inserts a time range or ranges into the current object
 void Remove(Times startTime, Times endTime)
          Removes a time range or ranges from the current object
 
Methods inherited from class java.lang.Object
, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait
 

Field Detail

dayTimeRanges

private boolean[] dayTimeRanges
Contains time range information (Consult data dictionary for more information on how our time ranges are being represented)
Constructor Detail

DayTimeRanges

public DayTimeRanges()
Constructs a day with no time ranges designated

Preconditions: (none)
Postconditions: A new time range with no "highlighted" times will be constructed


DayTimeRanges

public DayTimeRanges(Times startTime,
                     Times stopTime)
Constructs a day with one time range designated

Preconditions: start and stop are within the valid range (0.0-23.5 to nearest .5)
start < stop
Postconditions: A new time range will be constructed with given initial time range information

Parameters:
start - start time
stop - end time
Method Detail

Insert

public void Insert(Times startTime,
                   Times endTime)
Inserts a time range or ranges into the current object

Preconditions: none
Postconditions: All time ranges that are on within "in" will be set on for the current time range

Parameters:
in - boolean array of size 48 to be inserted

Remove

public void Remove(Times startTime,
                   Times endTime)
Removes a time range or ranges from the current object

Preconditions: none
Postconditions: All time ranges that are on within "clear" will be set off within the current time range

Parameters:
clear - boolean array of size 48 to be removed

Clear

public void Clear()
Clears the entire time range

Preconditions: (none)
Postconditions: The entire time range will be cleared


Compare

public boolean[] Compare(boolean[] toCompare)
Compares two times to see where they overlap

Preconditions: toCompare is an array of size 48
Postconditions: The method will return a time range that represents the overlapping of the current time range and the given time range toCompare

Parameters:
toCompare - time ranges to compare, must be a boolean array of size 48
Returns:
a time range that represents the overlapping of 2 time ranges

Get

public boolean[] Get()
Gets the day's time ranges as a boolean array

Preconditions: (none)
Postconditions: The current time range will be returned as a boolean array (for information on this representation, consult the data dictionary)

Returns:
time ranges as a boolean array

GetStartStopTimes

public java.util.Vector GetStartStopTimes()
Gets the day's time ranges as a vector of start and stop Times This function goes through the private boolean array. It finds the start and stop times, inserting them into a vector. Therefore, the vector while be a list of start/stop times, switching every other one from start and stop times.

Preconditions: (none)
Postconditions: The current time range will be returned as a vector of time ranges of start and stop Times

Returns:
time ranges as a vector of start and stop Times

clone

public java.lang.Object clone()
Makes a copy of the current object

Preconditions: (none)
Postconditions: The method will make a copy of the current object and return that copy

Overrides:
clone in class java.lang.Object
Returns:
the copy