@Override public synchronized float computeCompletePortion() { if (isComplete()) { return 1; } if (totalStepCount == 0) { if (currentStepCount == 0) { return 0; } else { return 1; } } return ((float) currentStepCount) / ((float) totalStepCount); }
/** Ignores allocated steps. It's mirroring implementation. */ @Override public synchronized ProgressStatus createChild(String name, int allocatedSteps, int totalStepCount) { ProgressStatusBase result = doCreateChild(name, totalStepCount); children.add(new ChildProgressStatus(allocatedSteps, result)); fireEvent(new ProgressStatusEventCreateChild(id, name, result.getId(), 0, totalStepCount)); return result; }
@Override public synchronized ProgressStatusMirroringImpl createMirroringChild(int allocatedSteps) { allocateStapsForChildProcess(allocatedSteps); String childId = (id == null ? "" : id) + "." + (children.size() + 1); ProgressStatusMirroringImpl result = new ProgressStatusMirroringImpl(null, this, childId); children.add(new ChildProgressStatus(allocatedSteps, result)); fireEvent(new ProgressStatusEventCreateChild(id, null, result.getId(), allocatedSteps, -1)); return result; }
@Override protected synchronized void fireEvent(ProgressStatusEvent event) { recount(); super.fireEvent(event); }
public void addProgressStatusToSupplementalCommand(SupplementalCommand supplemental) { if (commandProgress == null || supplemental == null) { return; } if (progressForMainCommand != null && progressMirroring == null) { throw new IllegalStateException("Suplmenetal commands must be filled with ProgressStatus before main command!"); } if (replicationCount < 0) { throw new IllegalStateException("Replication count must be provided first"); } if (supplemental.getProgressAnnotation() != null) { if (progressMirroring == null) { commandProgress.setTotalStepCount(replicationCount + 1); progressMirroring = commandProgress.createMirroringChild(1); progressForMainCommand = progressMirroring.createChild(null, 0, progressAnnotation.totalStepCount()); } supplemental.setProgressStatus(progressMirroring.createChild(supplemental.getProgressAnnotation().name(), 0, supplemental.getProgressAnnotation().totalStepCount())); } }
/** Ignores allocated steps. It's mirroring implementation. */ @Override public synchronized ProgressStatus createChild(String name, int allocatedSteps, int totalStepCount) { ProgressStatusBase result = doCreateChild(name, totalStepCount); children.add(new ChildProgressStatus(allocatedSteps, result)); fireEvent(new ProgressStatusEventCreateChild(id, name, result.getId(), 0, totalStepCount)); return result; }
@Override protected synchronized void fireEvent(ProgressStatusEvent event) { recount(); super.fireEvent(event); }
@Override public synchronized float computeCompletePortion() { if (isComplete()) { return 1; } if (totalStepCount == 0) { if (currentStepCount == 0) { return 0; } else { return 1; } } return ((float) currentStepCount) / ((float) totalStepCount); }