|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--Schedules
Contains seven templates to represent an entire week
Field Summary | |
private Templates[] |
daysOfWeek
Seven templates that make up all of the days of the week |
Constructor Summary | |
Schedules()
Constructs an empty schedule |
|
Schedules(java.lang.String fileName)
Constructs a schedule from a file |
Method Summary | |
void |
AddShift(int day,
Shifts toAdd)
Adds a shift to the schedule on a specific day |
void |
Generate(ListOfEmployees employeesList)
The Generate() function consists of two passes: During the first pass, the list of employees is traversed linearly. |
java.util.Vector |
GetShifts(int day)
Gets all of the shifts on a particular day |
void |
LoadTemplate(int day,
java.lang.String fileName)
Loads a template into a specific day |
void |
Optimize(ListOfEmployees employeesList)
The function Optimize is called in the Generate function. |
void |
RemoveShift(int day,
Shifts toRemove)
Removes a shift from the schedule on a specific day |
void |
SaveTemplate(int day,
java.lang.String fileName)
Saves a template from a specific day into a specific file |
void |
SetEmployee(int day,
Shifts toSet,
Employees newEmployee)
Sets an employee to a shift on a specified day |
Methods inherited from class java.lang.Object |
|
Field Detail |
private Templates[] daysOfWeek
Constructor Detail |
public Schedules()
Pre-conditions: none
Post-conditions: The private array of Templates is initialized for this class.
public Schedules(java.lang.String fileName)
Pre-conditions: A valid variable of type String is passed.
The passed name is for a valid file that exists.
Post-conditions: The private array of Templates is set according to the file.
fileName
- the file that contains the schedule informationMethod Detail |
public void LoadTemplate(int day, java.lang.String fileName)
Pre-conditions: Valid variables of types int and String are passed.
The passed int is a valid day of the week and
the passed name is for a valid file that exists.
Post-conditions: Load a template into the schedule
day
- day to load template into (i.e. 1=Monday,...)fileName
- name of file that contains the template informationpublic void SaveTemplate(int day, java.lang.String fileName)
Pre-conditions: Valid variables of type int and String are passed.
The passed int is a valid day of the week.
Post-conditions: The template for the indicated day is saved to a file of the passed name.
day
- day to capture template fromfileName
- file to save template topublic void Generate(ListOfEmployees employeesList)
Pre-conditions: A list of employees exists and contains employees.
The schedule contains shifts to be filled.
Post-conditions: A scheduled is generated where shifts contained matched employees.
Function Call : Optimize()
employeesList
- NOTE: both Generate() and Optimize() are not efficient for a large number of employees because they grow exponentially with respect to the number
of employees. However, this is ok for a stage one implementation. A more efficient algorithm is on the way.public void Optimize(ListOfEmployees employeesList)
employeesList
- public void AddShift(int day, Shifts toAdd)
Pre-conditions: Valid variables of type int and Shifts are passed.
The passed int is a valid day of the week.
Post-conditions: The passed shift is added to the template for the passed day.
day
- day to add shift to (i.e. 1=Monday,...)toAdd
- the shift to add to the specified daypublic void RemoveShift(int day, Shifts toRemove)
Pre-conditions: Valid variables of type int and Shifts are passed.
The passed int is a valid day of the week.
Post-conditions: If the passed shift exists on the schedule it is removed for the passed day.
day
- day to remove a shift from (i.e. 1=Monday,...)toRemove
- the shift remove from the specified daypublic void SetEmployee(int day, Shifts toSet, Employees newEmployee)
Pre-conditions: Valid variables of type int, Shifts, and Employees are passed.
The passed int is a valid day of the week.
Post-conditions: The passed employee is set for the passed shift on the passed day.
day
- day that contains the shift to set the employee totoSet
- the shift to set the employee tonewEmployee
- the employee to assign to the shiftpublic java.util.Vector GetShifts(int day)
Pre-conditions: A valid variable of type int is passed
and contains a valid day of the week.
Post-conditions: Returns a vector of shifts for the passed day.
day
- day to get shifts from
|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |