public TaskHistory(TaskHistory t) { taskIndex = t.getTaskIndex(); submitTime = t.getSubmitTime(); scheduleTime = t.getScheduleTime(); finishTime = t.getFinishTime(); status = t.getStatus(); machineId = t.getMachineId(); requestedCPU = t.getRequestedCPU(); requestedMemory = t.getRequestedMemory(); requestedDisk = t.getRequestedDisk(); TaskUsage taskUsage = null; }
public static TaskHistory combineTasks(TaskHistory t1, TaskHistory t2) { if (t1.getMachineId() == 0 && t2.getMachineId() != 0) // System.out.print("Tasks are combined " + t1.getMachineId() + ", " + t2.getMachineId() + // "="); t1.setMachineId(t2.getMachineId()); TaskHistory result = new TaskHistory(); result.setFinishTime( t1.getFinishTime() > t2.getFinishTime() ? t1.getFinishTime() : t2.getFinishTime()); result.setSubmitTime( t1.getSubmitTime() > t2.getSubmitTime() ? t1.getSubmitTime() : t2.getSubmitTime()); result.setScheduleTime( t1.getScheduleTime() > t2.getScheduleTime() ? t1.getScheduleTime() : t2.getScheduleTime()); result.setMachineId( t1.getMachineId() > t2.getMachineId() ? t1.getMachineId() : t2.getMachineId()); result.setRequestedCPU( t1.getRequestedCPU() > t2.getRequestedCPU() ? t1.getRequestedCPU() : t2.getRequestedCPU()); result.setRequestedMemory( t1.getRequestedMemory() > t2.getRequestedMemory() ? t1.getRequestedMemory() : t2.getRequestedMemory()); result.setRequestedDisk( t1.getRequestedDisk() > t2.getRequestedDisk() ? t1.getRequestedDisk() : t2.getRequestedDisk()); result.setStatus( t1.getStatus().length() > t2.getStatus().length() ? t1.getStatus() : t2.getStatus()); result.setTaskIndex(t1.getTaskIndex()); return result; }