Class Shifts

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

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

Represents an employee's shift (either filled already or to be filled in later)


Field Summary
private  Employees assignedEmployee
          Assigned employee
private  boolean isFilled
          True if shift has been filled, false otherwise
private  Skills shiftSkill
          Required skill
private  DayTimeRanges shiftTime
          Shift durration
 
Constructor Summary
Shifts(Times startTime, Times endTime, Skills skill)
          Constructs a shift that hasn't been filled yet
Shifts(Times startTime, Times endTime, Skills skill, Employees employee)
          Constructs a shift that has been filled already
 
Method Summary
 java.lang.Object clone()
          Makes a copy of the current object
 Employees GetEmployee()
          Gets the employee that is assigned to this shift, null if no employee is assigned.
 Skills GetSkill()
          Gets the skill required for the shift
 DayTimeRanges GetTime()
          Gets the time of the shift
 void SetEmployee(Employees newEmployee)
          Modifies or sets the employee assigned to a shift
 void SetSkill(Skills newSkill)
          Changes the skill assigned to a shift
 void SetTime(DayTimeRanges newTime)
          Changes the time of the shift
 boolean ShiftIsFilled()
          Checks to see if the shift has been filled already
 
Methods inherited from class java.lang.Object
, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait
 

Field Detail

shiftTime

private DayTimeRanges shiftTime
Shift durration

shiftSkill

private Skills shiftSkill
Required skill

assignedEmployee

private Employees assignedEmployee
Assigned employee

isFilled

private boolean isFilled
True if shift has been filled, false otherwise
Constructor Detail

Shifts

public Shifts(Times startTime,
              Times endTime,
              Skills skill)
Constructs a shift that hasn't been filled yet

Preconditions: startTime and endTime are within the valid range (0.0-23.5 to nearest .5)
startTime < endTime
Postconditions: a new shift will be constructed with given startTime, endTime, and skill

Parameters:
startTime - starting time for the shift
endTime - ending time for the shift
skill - skill required for the shift

Shifts

public Shifts(Times startTime,
              Times endTime,
              Skills skill,
              Employees employee)
Constructs a shift that has been filled already

Preconditions: startTime and endTime are within the valid range (0.0-23.5 to nearest .5)
startTime < endTime
Postconditions: a new shift will be constructed with given startTime, endTime, skill, and employee

Parameters:
startTime - starting time for the shift
endTime - ending time for the shift
skill - skill required for the shift
employee - the employee already assigned to the shift
Method Detail

SetTime

public void SetTime(DayTimeRanges newTime)
Changes the time of the shift

Preconditions: (none)
Postconditions: The time durration for the shift will be set to the given newTime

Parameters:
newTime - new time for the shift

SetSkill

public void SetSkill(Skills newSkill)
Changes the skill assigned to a shift

Preconditions: (none)
Postconditions: The skill associated with the shift will be reassigned to the value of the given newSkill

Parameters:
newSkill - new skill for the shift

SetEmployee

public void SetEmployee(Employees newEmployee)
Modifies or sets the employee assigned to a shift

Preconditions: (none)
Postconditions: The employee associated with the shift will be assigned the value of the given newEmployee and the shift will now be considered "filled"

Parameters:
newEmployee - employee to assign to shift

GetEmployee

public Employees GetEmployee()
Gets the employee that is assigned to this shift, null if no employee is assigned.

Preconditions: (Shift should be filled before calling this method, otherwise the return value is null)
Postconditions: The method will return the employee currently assigned to work the shift in question

Returns:
employee assigned to the shift

GetTime

public DayTimeRanges GetTime()
Gets the time of the shift

Preconditions: (none)
Postconditions: The method will return the time range that the shift is spanning

Returns:
time of the shift

GetSkill

public Skills GetSkill()
Gets the skill required for the shift

Preconditions: (none)
Postconditions: The method will return the skill that is currently associated with this shift

Returns:
skill required for the shift

ShiftIsFilled

public boolean ShiftIsFilled()
Checks to see if the shift has been filled already

Preconditions: (none)
Postconditions: The method will return whether or not the shift has already been filled

Returns:
true if the shift has been filled, false otherwise

clone

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

Preconditions: (none)
Postconditions: A copy of the object will be made and returned

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