Class Templates

java.lang.Object
  |
  +--Templates

public class Templates
extends java.lang.Object

A template contains all of the information for a single day of the schedule, templates may either be loaded from a file or created new


Field Summary
private  java.util.Vector shifts
          A Vector of shifts for the entire day (templates cover the whole day)
 
Constructor Summary
Templates()
          Constructs an empty template
Templates(java.lang.String fileName)
          Constructs a template from a given file
 
Method Summary
 void AddShift(Shifts toAdd)
          Adds a shift to a template
 void ChangeEmployee(Shifts toChange, Employees newEmployee)
          Change the employee associated with a shift
 void ChangeSkill(Shifts toChange, Skills newSkill)
          Change a skill associated with a shift
 void ChangeTime(Shifts toChange, DayTimeRanges newTime)
          Change the time associated with a shift
 void Clear()
          Clears the entire template
 java.util.Vector GetEmployeeShifts(Employees toGet)
          Get the shifts assigned to a particular employee
 java.util.Vector GetShifts()
          Gets all of the shifts in a template
 void RemoveShift(Shifts toRemove)
          Removes a shift from a template
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait
 

Field Detail

shifts

private java.util.Vector shifts
A Vector of shifts for the entire day (templates cover the whole day)
Constructor Detail

Templates

public Templates()
Constructs an empty template

Preconditions: (none)
Postconditions: An empty template (with no shifts) will be created


Templates

public Templates(java.lang.String fileName)
Constructs a template from a given file

Preconditions: The given fileName exists and is in the proper format for a template file
Postconditions: All of the information in the file with given fileName will be loaded into the template as specified in the file format guidlines

Parameters:
fileName - name of the file with the template information
Method Detail

AddShift

public void AddShift(Shifts toAdd)
Adds a shift to a template

Preconditions: (none)
Postconditions: Given shift toAdd will be added to the template

Parameters:
toAdd - the shift to add to the template

RemoveShift

public void RemoveShift(Shifts toRemove)
Removes a shift from a template

Preconditions: (none)
Postconditions: if there exists a shift within the template that matches the same time and skill specified in the shift toRemove, then that shift will be removed from the template (if there are 2 matches, then only one will be removed)

Parameters:
toRemove - the shift to remove from the template

Clear

public void Clear()
Clears the entire template

Preconditions: (none)
Postconditions: Template will be empty (will contain no shifts)


ChangeSkill

public void ChangeSkill(Shifts toChange,
                        Skills newSkill)
Change a skill associated with a shift

Preconditions: (none)
Postconditions: if there exists a shift within the template that matches the same time and skill specified in the shift toChange, then that shift will be changed to accomidate the newSkill (if there are more than one match, then only one will be changed

Parameters:
toChange - the shift that is being changed
newSkill - the new skill to associate with the shift

ChangeTime

public void ChangeTime(Shifts toChange,
                       DayTimeRanges newTime)
Change the time associated with a shift

Preconditions: (none)
Postconditions: if there exists a shift within the template that matches the same time and skill specified in the shift toChange, then that shift will be changed to accomidate the newTime (if there are more than one match, then only one will be changed)

Parameters:
toChange - the shift that is being changed
newTime - the new time to associate with the shift

ChangeEmployee

public void ChangeEmployee(Shifts toChange,
                           Employees newEmployee)
Change the employee associated with a shift

Preconditions: (none)
Postconditions: if there exists a shift within the template that matches the same time and skill specified in the shift toChange, then that shift will be changed to accomidate the newEmployee (if there are more than one match, then only one will be changed)

Parameters:
toChange - the shift that is being changed
newEmployee - the new employee to associate with the shift

GetEmployeeShifts

public java.util.Vector GetEmployeeShifts(Employees toGet)
Get the shifts assigned to a particular employee

Preconditions: (none)
Posconditions: The method will return all of the shifts that have been assigned to the employee toGet
The shifts will be returned as a vector of shifts

Parameters:
toGet - the employee to get shifts for
Returns:
a vector of shifts

GetShifts

public java.util.Vector GetShifts()
Gets all of the shifts in a template

Preconditions: (none)
Postconditions: The method will return all of the shifts that have been placed inside the template
The shifts will be returned as a vector of shifts

Returns:
a vector of shifts