private void mirror(ProgressStatusBase source, ProgressStatus stat) { stat.setTotalStepCount(source.getTotalStepCount()); stat.setCurrentStepCount(source.getCurrentStepCount()); if (source.isComplete()) { stat.complete(); } for (ProgressStatusBase.ChildProgressStatus chld : source.getChildProgressStatuses()) { ProgressStatus dst = map.get(chld.getProgressStatus().getId()); if (dst == null) { dst = stat.createChild(chld.getProgressStatus().getName(), chld.getAllocatedSteps()); map.put(chld.getProgressStatus().getId(), dst); } mirror(chld.getProgressStatus(), dst); } }
protected void allocateStapsForChildProcess(int allocatedSteps) { if (allocatedSteps < 0) { allocatedSteps = 0; } if (totalStepCount >= 0) { for (ChildProgressStatus child : children) { allocatedSteps += child.getAllocatedSteps(); } if ((allocatedSteps + currentStepCount) > totalStepCount) { currentStepCount = totalStepCount - allocatedSteps; if (currentStepCount < 0) { currentStepCount = 0; totalStepCount = allocatedSteps; } } } }
protected void allocateStapsForChildProcess(int allocatedSteps) { if (allocatedSteps < 0) { allocatedSteps = 0; } if (totalStepCount >= 0) { for (ChildProgressStatus child : children) { allocatedSteps += child.getAllocatedSteps(); } if ((allocatedSteps + currentStepCount) > totalStepCount) { currentStepCount = totalStepCount - allocatedSteps; if (currentStepCount < 0) { currentStepCount = 0; totalStepCount = allocatedSteps; } } } }
protected synchronized float computeCompleteSteps() { if (isComplete()) { return totalStepCount; } float realStepCount = currentStepCount; for (ChildProgressStatus child : children) { float childPortion = child.progressStatus.computeCompletePortion(); if (childPortion < 0) { return -1; } realStepCount += ((float) child.getAllocatedSteps()) * childPortion; } return realStepCount; }
protected synchronized float computeCompleteSteps() { if (isComplete()) { return totalStepCount; } float realStepCount = currentStepCount; for (ChildProgressStatus child : children) { float childPortion = child.progressStatus.computeCompletePortion(); if (childPortion < 0) { return -1; } realStepCount += ((float) child.getAllocatedSteps()) * childPortion; } return realStepCount; }
@Override public int getRemainingStepCount() { int childAlocSteps = 0; for (ChildProgressStatus childProgressStatus : children) { childAlocSteps += childProgressStatus.getAllocatedSteps(); } return totalStepCount - currentStepCount - childAlocSteps; }
@Override public int getRemainingStepCount() { int childAlocSteps = 0; for (ChildProgressStatus childProgressStatus : children) { childAlocSteps += childProgressStatus.getAllocatedSteps(); } return totalStepCount - currentStepCount - childAlocSteps; }