/** * Creates a Department instance * * @param employees number of employees which are not freelances in the department * @param freelances the number of freelances in the department * @param maxJuniors the value for the maxJunior attribute * @param budget the value for the budget attribute */ private DepartmentImpl createDepartment( int employees, int freelances, int maxNumJuniors, int budget) { DepartmentImpl dep = (DepartmentImpl) CompanyFactory.eINSTANCE.createDepartment(); dep.setName("Dep" + this.curDepartmentID); dep.setMaxJuniors(maxNumJuniors); dep.setBudget(budget); this.curDepartmentID++; EmployeeImpl e = null; FreelanceImpl f = null; for (int i = 0; i < employees; i++) { e = createEmployee(); dep.getEmployee().add(e); e.setEmployer(dep); } for (int i = 0; i < freelances; i++) { f = createFreelance(); dep.getEmployee().add(f); f.setEmployer(dep); } this.allDepartments.add(dep); if (this.comp.eResource() != null) { this.comp.eResource().getContents().add(dep); } return dep; }
/** @return a instances of {@link Freelance} */ private FreelanceImpl createFreelance() { FreelanceImpl f = (FreelanceImpl) CompanyFactory.eINSTANCE.createFreelance(); f.setName("empl" + this.curImployeeID); f.setAge(42); f.setAssignment(7); f.setSalary(2345); this.curImployeeID++; this.allFreelances.add(f); if (this.comp.eResource() != null) { this.comp.eResource().getContents().add(f); } return f; }