Class Employees

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

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

Is a representation of any employee used throughout the employee scheduler. Each employee contains their own attributes including name, phone, availability, etc.


Field Summary
private  Weeks availability
          Availability of the employee
private  float desiredHours
          Desired number of hours of work per week
private  java.lang.String email
          E-Mail address of the employee
private  java.lang.String name
          Name of the employee
private  java.lang.String phone
          Phone number of the employee
private  Weeks scheduled
          Hours that the employee has been scheduled for already
private  ListOfSkills skills
          Skills of the employee
 
Constructor Summary
Employees(java.lang.String initName, java.lang.String initPhone, java.lang.String initEmail, float initDesiredHours, Weeks initAvailability, ListOfSkills initSkills)
          Constructs a new employee with given data
 
Method Summary
 void AddAvailability(int day, DayTimeRanges toAdd)
          Adds to the employee's availability
 void AddScheduled(int day, DayTimeRanges toAdd)
          Adds already scheduled hours to the employee
 void AddSkill(Skills toAdd)
          Adds a skill to the employee
 java.lang.Object clone()
          Creates a copy of the current object
 Weeks GetAvailability()
          Gets a copy of the availability of the employee
 float GetDesiredHours()
          Gets the number of hours that the employee would like to work per week
 java.lang.String GetEmail()
          Gets the employee's e-mail address
 java.lang.String GetName()
          Gets the employee's name
 java.lang.String GetPhone()
          Gets the employee's phone number
 Weeks GetScheduled()
          Gets a copy of the scheduled hours of the employee in a week
 ListOfSkills GetSkills()
          Gets a copy of the list of skills that the employee has learned
 void RemoveAvailability(Weeks toRemove)
          Removes a whole week's worth of time ranges from an employee's availability
 void RemoveScheduled(Weeks toRemove)
          Removes a scheduled time from the employee
 void RemoveSkill(Skills toRemove)
          Removes a skill from the employee
 void SetDesiredHours(float newDesiredHours)
          Changes the employee's desired number of hours to work per week
 void SetEmail(java.lang.String newEmail)
          Changes the employee's e-mail address
 void SetName(java.lang.String newName)
          Changes the employee's name
 void SetPhone(java.lang.String newPhone)
          Changes the employee's phone number
 
Methods inherited from class java.lang.Object
, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait
 

Field Detail

name

private java.lang.String name
Name of the employee

phone

private java.lang.String phone
Phone number of the employee

email

private java.lang.String email
E-Mail address of the employee

availability

private Weeks availability
Availability of the employee

scheduled

private Weeks scheduled
Hours that the employee has been scheduled for already

desiredHours

private float desiredHours
Desired number of hours of work per week

skills

private ListOfSkills skills
Skills of the employee
Constructor Detail

Employees

public Employees(java.lang.String initName,
                 java.lang.String initPhone,
                 java.lang.String initEmail,
                 float initDesiredHours,
                 Weeks initAvailability,
                 ListOfSkills initSkills)
Constructs a new employee with given data

Pre-conditions: none
Post-conditions: All private variables will be set to their corresponding passed-variable.

Parameters:
initName - the employee's name
initPhone - the employee's phone number
initEmail - the employee's email address
initDesiredHours - the employee's desired work hours a week
initAvailability - availability of the employee
initSkills - skills that the new employee has
Method Detail

GetName

public java.lang.String GetName()
Gets the employee's name

Pre-conditions: none
Post-conditions: Returns the name of the employee.

Returns:
the name of the employee

GetPhone

public java.lang.String GetPhone()
Gets the employee's phone number

Pre-conditions: none
Post-conditions: Returns the phone number of the employee.

Returns:
the phone number of the employee

GetEmail

public java.lang.String GetEmail()
Gets the employee's e-mail address

Pre-conditions: none
Post-conditions: Returns the e-mail address of the employee.

Returns:
the e-mail address of the employee

GetDesiredHours

public float GetDesiredHours()
Gets the number of hours that the employee would like to work per week

Pre-conditions: none
Post-conditions: Returns the employee's desired hours.

Returns:
the number of hours that the employee requested to work per week

GetSkills

public ListOfSkills GetSkills()
Gets a copy of the list of skills that the employee has learned

Pre-conditions: none
Post-conditions: Returns a copy of the employee's list of skills.

Returns:
a copy of the employee's list of skills

GetAvailability

public Weeks GetAvailability()
Gets a copy of the availability of the employee

Pre-conditions: none
Post-conditions: Returns the availability of the employee.

Returns:
a copy of the availability of the employee

GetScheduled

public Weeks GetScheduled()
Gets a copy of the scheduled hours of the employee in a week

Pre-conditions: none
Post-conditions: Returns a copy of the employee's schedule hours.

Returns:
a copy of the hours that the employee has been scheduled for that week

AddSkill

public void AddSkill(Skills toAdd)
Adds a skill to the employee

Pre-conditions: A variable of type Skills containing data must be passed.
Post-conditions: The passed variable is added to the private variable containing the list of skills.

Parameters:
toAdd - the skill that the employee has either learned or for some other reason needs added to his/her database

AddAvailability

public void AddAvailability(int day,
                            DayTimeRanges toAdd)
Adds to the employee's availability

Pre-conditions: A valid day of the week in integer representation must be passed.
A variable of type DayTimeRanges must be passed and valid. Post-conditions: The passed variable of type DayTimeRanges is added to the employee's availability for the indicated day.

Parameters:
day - day to add availability to (1=Monday,...)
toAdd - the time range to add to the employee's availability; if the employee is already available in any of the times in the range, then no change will be made for those particular overlapping times

AddScheduled

public void AddScheduled(int day,
                         DayTimeRanges toAdd)
Adds already scheduled hours to the employee

Pre-conditions: A valid day of the week in integer representation must be passed.
A variable of type DayTimeRanges must be passed and valid.
Post-conditions: The passed variable of type DayTimeRanges is added to the employee's scheduled times for the indicated day.

Parameters:
day - day to add already scheduled hours to (1=Monday,...)
toAdd - the time range to add to the employee's already scheduled hours, it should never happen that these overlap since the employee should never be scheduled twice in the same time period

RemoveSkill

public void RemoveSkill(Skills toRemove)
Removes a skill from the employee

Pre-conditions: A valid variable of type Skills is passed.
Post-conditions: The passed skill is removed from the employees list of skills.

Parameters:
toRemove - skill that should no longer be listed under the employee's learned skills

RemoveAvailability

public void RemoveAvailability(Weeks toRemove)
Removes a whole week's worth of time ranges from an employee's availability

Pre-conditions: A valid variable of type Weeks is passed.
Post-conditions: A week's worth of time ranges is removed from the private availability variable.

Parameters:
toRemove - week that contains the time ranges to remove from an employee's availability; any times overlaping between toRemove and the employee's availability will be set to "unavailable"

RemoveScheduled

public void RemoveScheduled(Weeks toRemove)
Removes a scheduled time from the employee

Pre-conditions: A valid variable of type Weeks is passed.
Post-conditions: A week's worth of time ranges is removed from the private scheduled variable.

Parameters:
toRemove - week that contains the time ranges to remove from an employee's scheduled times; any times overlaping between toRemove and the employee's scheduled times will be set to "unscheduled"

SetName

public void SetName(java.lang.String newName)
Changes the employee's name

Pre-conditions: A valid variable of type String is passed.
Post-conditions: The private name variable is set to the passed variable.

Parameters:
newName - new value for the empolyee's name

SetPhone

public void SetPhone(java.lang.String newPhone)
Changes the employee's phone number

Pre-conditions: A valid variable of type String is passed.
Post-conditions: The private phone variable is set to the passed variable.

Parameters:
newPhone - new value for the employee's phone number

SetEmail

public void SetEmail(java.lang.String newEmail)
Changes the employee's e-mail address

Pre-conditions: A valid variable of type String is passed.
Post-conditions: The private email variable is set to the passed variable.

Parameters:
newEmail - new value for the employee's e-mail address

SetDesiredHours

public void SetDesiredHours(float newDesiredHours)
Changes the employee's desired number of hours to work per week

Pre-conditions: A valid variable of type float is passed.
Post-conditions: The private desiredHours variable is set to the passed variable.

Parameters:
newDesiredHours - new value for the employee's desired number of hours to work per week

clone

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

Pre-conditions:
Post-conditions: A copy of the current employee object is returned.

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