Class Employee.EmployeeData

java.lang.Object
Employee.EmployeeData
Direct Known Subclasses:
Tables.TableData

public class Employee.EmployeeData extends Object
The Employee.EmployeeData class represents a collection of employees' data, including their first and last names, positions, section assignments, and schedules.
  • Constructor Summary

    Constructors
    Constructor
    Description
    The default constructor for the Employee.EmployeeData class that initializes the employeeData HashMap, scheduleOptions ArrayList, and sections ArrayList with default data.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    addEmployee(String name, String position, int schedule, int section)
    Adds an employee's data to the employeeData HashMap.
    void
    Adds a schedule to the scheduleOptions ArrayList.
    void
    editEmployee(String name, String newName, String newPosition, int newSchedule, int newSection)
    Edits an employee's data in the employeeData HashMap.
    void
    employeeRestore(String backupName, String oldName, String newName)
    Restores an employee's name from a backup and updates the employeeData map accordingly.
    Returns a formatted String of all schedule options stored in the scheduleOptions ArrayList.
    boolean
    Checks whether an employee with the specified name exists in the employeeData map.
    listEmployee(int criteria)
    This method returns a formatted String containing the employee information based on the given criteria.
    This method returns a formatted String containing the section information.
    void
    Removes an employee from the employeeData HashMap.
    void
    remScheduleOptions(int schedule)
    Removes a schedule from the scheduleOptions ArrayList.
    Searches for an employee's data in the employeeData HashMap.

    Methods inherited from class java.lang.Object

    equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • Employee.EmployeeData

      public Employee.EmployeeData()
      The default constructor for the Employee.EmployeeData class that initializes the employeeData HashMap, scheduleOptions ArrayList, and sections ArrayList with default data.
  • Method Details

    • addScheduleOptions

      public void addScheduleOptions(String newSchedule)
      Adds a schedule to the scheduleOptions ArrayList.
      Parameters:
      newSchedule - The String text of the schedule to be added.
    • remScheduleOptions

      public void remScheduleOptions(int schedule)
      Removes a schedule from the scheduleOptions ArrayList.
      Parameters:
      schedule - The numerical representation of the schedule to be removed.
    • getScheduleOptions

      public String getScheduleOptions()
      Returns a formatted String of all schedule options stored in the scheduleOptions ArrayList.
      Returns:
      A formatted String of all schedule options stored in the scheduleOptions ArrayList.
    • addEmployee

      public void addEmployee(String name, String position, int schedule, int section)
      Adds an employee's data to the employeeData HashMap.
      Parameters:
      name - The employee's first and last name.
      position - The employee's position.
      schedule - The numerical representation of the employee's schedule.
      section - The section of tables the employee is responsible for.
    • remEmployee

      public void remEmployee(String name)
      Removes an employee from the employeeData HashMap.
      Parameters:
      name - The employee's first and last name
    • editEmployee

      public void editEmployee(String name, String newName, String newPosition, int newSchedule, int newSection)
      Edits an employee's data in the employeeData HashMap.
      Parameters:
      name - the employee's first and last name to be edited
      newName - the new first and last name for the employee
      newPosition - the new position for the employee
      newSchedule - the new numerical representation of the schedule for the employee
      newSection - the new section of tables the employee is responsible for
    • searchEmployee

      public String searchEmployee(String name)
      Searches for an employee's data in the employeeData HashMap.
      Parameters:
      name - the employee's first and last name to search for
      Returns:
      the employee's data if found, otherwise a message that the employee was not found
    • employeeRestore

      public void employeeRestore(String backupName, String oldName, String newName)
      Restores an employee's name from a backup and updates the employeeData map accordingly.
      Parameters:
      backupName - the name of the backup for the employee to be restored
      oldName - the old name of the employee before the backup was made
      newName - the new name of the employee after the backup was made
    • isEmployee

      public boolean isEmployee(String name)
      Checks whether an employee with the specified name exists in the employeeData map.
      Parameters:
      name - the name of the employee to check
      Returns:
      true if the employeeData map contains an entry with the specified name, false otherwise
    • listEmployee

      public String listEmployee(int criteria)
      This method returns a formatted String containing the employee information based on the given criteria.
      Parameters:
      criteria - An integer indicating the format of the employee information to be returned. 1 - Returns only the name of each employee. 2 - Returns the name, position, and section of each employee. 3 - Returns the name, position, section, and schedule of each employee.
      Returns:
      A String containing the formatted employee information based on the given criteria.
      Throws:
      IllegalStateException - if the given criteria is not 1, 2, or 3.
    • listSection

      public String listSection()
      This method returns a formatted String containing the section information.
      Returns:
      A String containing the formatted section information.