设为首页 加入收藏

TOP

开发人员调度软件(五)
2019-09-02 23:33:20 】 浏览:89
Tags:开发 人员 调度 软件
import pers.jsc.dispatch.domain.domainexte.Programmer; import pers.jsc.dispatch.domain.domainimpl.NoteBook; import pers.jsc.dispatch.domain.domainimpl.PC; import pers.jsc.dispatch.domain.domainimpl.Printer; import pers.jsc.dispatch.exception.TeamException; /** * @author 金聖聰 * @title: NameListService * @projectName TeamDispatchApp * @description: 负责将Data中的数据封装到Employee[]数组中,同时提供相关操作Employee[]的方法。 * @date 2019/5/9 0:17 */ public class NameListService { private Employee[] employees; public Employee[] getEmployees() { return employees; } public void setEmployees(Employee[] employees) { this.employees = employees; } public NameListService() { // 根据项目提供的Data类构建相应大小的employees数组 employees = new Employee[Data.EMPLOYEES.length]; for (int i = 0; i < employees.length; i++) { //获取通用数据 int type = Integer.parseInt(Data.EMPLOYEES[i][0]); int id = Integer.parseInt(Data.EMPLOYEES[i][1]); String name = Data.EMPLOYEES[i][2]; int age = Integer.parseInt(Data.EMPLOYEES[i][3]); double salary = Double.parseDouble(Data.EMPLOYEES[i][4]); Equipment equipment; double bonus; int stock; // 再根据Data类中的数据,构建不同的对象,包括Employee、Programmer、Designer和Architect对象,以及相关联的Equipment子类的对象 // 将对象存于数组中 switch (type) { case Data.EMPLOYEE: employees[i] = new Employee(id, name, age, salary); break; case Data.PROGRAMMER: equipment = getCreatEquipment(i); employees[i] = new Programmer(id, name, age, salary, equipment); break; case Data.DESIGNER: equipment = getCreatEquipment(i); bonus = Double.parseDouble(Data.EMPLOYEES[i][5]); employees[i] = new Designer(id, name, age, salary, equipment, bonus); break; case Data.ARCHITECT: equipment = getCreatEquipment(i); bonus = Double.parseDouble(Data.EMPLOYEES[i][5]); stock = Integer.parseInt(Data.EMPLOYEES[i][6]); employees[i] = new Architect(id, name, age, salary, equipment, bonus, stock); break; default: System.out.println("无职位"); } } } private Equipment getCreatEquipment(int index) { int type = Integer.parseInt(Data.EQUIPMENTS[index][0]); switch (type) { case Data.PC: return new PC(Data.EQUIPMENTS[index][1], Data.EQUIPMENTS[index][2]); case Data.NOTEBOOK: return new NoteBook(Data.EQUIPMENTS[index][1], Double.parseDouble(Data.EQUIPMENTS[index][2])); case Data.PRINTER: return new Printer(Data.EQUIPMENTS[index][1], Data.EQUIPMENTS[index][2]); default: System.out.println("没有此设备"); } return null; } /** * 返回所有员工 * @return 所有员工 */ public Employee[] getAllEmployees() { return employees; } /** * * @param id 员工的id * @return 对应员工 * @throws TeamException 找不到指定员工 */ public Employee getEmployee(int id) { for (Employee employee : employees ) { if (employee.getId() == id){ return employee; } } throw new TeamException("Can Not Found ID="+id+"'s Employee!"); } }

Status.java

package pers.jsc.dispatch.service;

/**
 * @author 金聖聰
 * @title: Status
 * @projectName TeamDispatchApp
 * @description: 成员状态
 * @date 2019/5/8 23:53
 */
public class Status {
    private final String NAME;

    private Status(String name) {
        this.NAME = name;
    }

    public static final Status FREE = new Status("FREE");
    public static final Status VOCATION = new Status("VOCATION");
    public static final Status BUSY = new Status("BUSY");
首页 上一页 2 3 4 5 6 7 8 下一页 尾页 5/8/8
】【打印繁体】【投稿】【收藏】 【推荐】【举报】【评论】 【关闭】 【返回顶部
上一篇Java断点续传(基于socket与Rando.. 下一篇一起来学Spring Cloud | 第三章:..

最新文章

热门文章

Hot 文章

Python

C 语言

C++基础

大数据基础

linux编程基础

C/C++面试题目