Class Weeks

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

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

Contains the seven sets of times that make up a week


Field Summary
private  DayTimeRanges[] timeRanges
          An array of seven times (each element in the array corresponds to a differnt day of the week and therefore makes up the entire week)
 
Constructor Summary
Weeks()
          Constructs an empty week
Weeks(DayTimeRanges[] initData)
          Constructs a week based on pre-determined days
 
Method Summary
 void Clear()
          Clears the week
 java.lang.Object clone()
          Makes a copy of the current object
 DayTimeRanges[] Get()
          Gets the week as an array of seven times
 DayTimeRanges GetDay(int day)
          Gets the times from a specific day (1=Monday...)
 void Set(DayTimeRanges[] newData)
          Set new times for the whole week
 void SetDay(int day, DayTimeRanges newData)
          Set times to a specific day
 
Methods inherited from class java.lang.Object
, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait
 

Field Detail

timeRanges

private DayTimeRanges[] timeRanges
An array of seven times (each element in the array corresponds to a differnt day of the week and therefore makes up the entire week)
Constructor Detail

Weeks

public Weeks()
Constructs an empty week

Preconditions: (none)
Postconditions: A new week with seven empty time ranges will be constructed


Weeks

public Weeks(DayTimeRanges[] initData)
Constructs a week based on pre-determined days

Preconditions: initData is an array of size 7
Postconditions: initData will be used to create the new Weeks object.
initData[0] will be copied into Monday ... initData[6] will be copied into Sunday
(this contradicts our usual standard where 1=Monday)

Parameters:
initData - an array of seven times to be assigned to the week
Method Detail

Get

public DayTimeRanges[] Get()
Gets the week as an array of seven times

Preconditions: (none)
Postconditions: The method will return the array of seven times that make up the week

Returns:
an array of the seven times that make up the week

GetDay

public DayTimeRanges GetDay(int day)
Gets the times from a specific day (1=Monday...)

Preconditions: day is within the valid range 1-7 where 1=Monday
Postconditions: The time range for that given day will be returned

Parameters:
day - day to get times from
Returns:
the times from the specified day

SetDay

public void SetDay(int day,
                   DayTimeRanges newData)
Set times to a specific day

Preconditions: day is within the valid range 1-7 where 1=Monday
Postconditions: The time range information for the given day will be set to the given newData

Parameters:
day - day to set times to
newData - new times to assign to the specified day

Clear

public void Clear()
Clears the week

Preconditions: (none)
Postconditions: Every time range (for every day of the week) will be cleared


Set

public void Set(DayTimeRanges[] newData)
Set new times for the whole week

Preconditions: newData is an array of size 7
Postconditions: The week will be set to the information specified in the newData

Parameters:
newData - new times for the whole week, an array of seven 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 the copy

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