/
nikolay470
/
algorithm_implementation
Обзор
Документация
Войти
/
nikolay470
/
algorithm_implementation
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
src/main/java/ru/gitflic/classes/Employee.java
92 строки
2 KB
nikolay94
Коммит перед сменой ОС
21 июн 2026, 19:09
21 июн 2026, 19:09
24ae6bf
Код
Авторство
О чём код?
package ru.gitflic.classes; import ru.gitflic.enums.Positions; public class Employee { private static Employee employeeNull = new Employee(); public String name = ""; public String surname = ""; public String patronymic = ""; public String login = ""; public String password = ""; private int numberShift = 0; public Positions position = Positions.NULL; public Pallet pallet = Pallet.NULL(); public static Employee NULL() { return employeeNull; } public Employee( String name, String surname, String patronymic, String login, String password, int numberShift, Positions position) { this.name = name; this.surname = surname; this.patronymic = patronymic; this.login = login; this.password = password; this.numberShift = numberShift; this.position = position; } public Employee() {} @Override public String toString() { return new StringBuilder() .append(this.name).append(" ") .append(this.surname).append(" ") .append(this.position) .toString(); } @Override public boolean equals(Object other) { if (other != null && other.getClass() == this.getClass()) { Employee otherEmployee = (Employee) other; return (this.name.equals(otherEmployee.name) && this.surname.equals(otherEmployee.surname) && this.patronymic.equals(otherEmployee.patronymic) && this.login.equals(otherEmployee.login) && this.password.equals(otherEmployee.password)); } return false; } public int getNumberShift() { return this.numberShift; } public void setNumberShift(int value) { if (value >= 1 && value <= 4) { this.numberShift = value; } else { throw new RuntimeException("Некорректное значение номера смены."); } } public void giveAwayPallet() throws RuntimeException { if (this.pallet == null) { throw new RuntimeException( "У сотрудника нет паллета" ); } else { this.pallet = null; } } public void takeThePallet(Pallet pallet) throws Exception { if (this.pallet == null) { this.pallet = pallet; } else { throw new Exception("Предъидущий паллет не размещен!"); } } }