/** * It changes the class of @job, the new class will be @newClass. It also updates the performance * indexes. * * @param job the job you want to switch * @param newClass the new class of @job */ public void performJobClassSwitch(Job job, JobClass newClass) { // Get the identifiers of old and new classes int oldClassId = job.getJobClass().getId(); int newClassId = newClass.getId(); // Updates old class measure (if not null) if (jobNumPerClass != null && jobNumPerClass[oldClassId] != null) { jobNumPerClass[oldClassId].update( jobsPerClass[oldClassId], NetSystem.getTime() - lastModifyNumberPerClass[oldClassId]); } lastModifyNumberPerClass[oldClassId] = NetSystem.getTime(); // Updates new class measure (if not null) if (jobNumPerClass != null && jobNumPerClass[newClassId] != null) { jobNumPerClass[newClassId].update( jobsPerClass[newClassId], NetSystem.getTime() - lastModifyNumberPerClass[newClassId]); } lastModifyNumberPerClass[newClassId] = NetSystem.getTime(); // Switch job class job.setClass(newClass); jobsPerClass[oldClassId]--; jobsPerClass[newClassId]++; }