本文整理汇总了Java中net.ssehub.easy.basics.progress.ProgressObserver.notifyProgress方法的典型用法代码示例。如果您正苦于以下问题:Java ProgressObserver.notifyProgress方法的具体用法?Java ProgressObserver.notifyProgress怎么用?Java ProgressObserver.notifyProgress使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类net.ssehub.easy.basics.progress.ProgressObserver
的用法示例。
在下文中一共展示了ProgressObserver.notifyProgress方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: scanAll
import net.ssehub.easy.basics.progress.ProgressObserver; //导入方法依赖的package包/类
/**
* Scans the entire environment starting at <code>root</code>.
*
* @param observer the observer to be notified in case of progress, use
* {@link ProgressObserver#NO_OBSERVER} if progress shall not be monitored
* @throws VilException in case that creating / obtaining artifacts fails
*/
public void scanAll(ProgressObserver observer) throws VilException {
if (null != base) {
ITask task = observer.registerTask("creating complete artifact model for " + base.getAbsolutePath());
int count = 0;
if (ProgressObserver.NO_OBSERVER != observer) {
count = scanAll(base, 0, null, null, null);
}
observer.notifyProgress(task, 0, count);
List<VilException> errors = new ArrayList<VilException>();
scanAll(base, 0, observer, task, errors);
observer.notifyEnd(task);
if (errors.size() > 0) {
throw new VilException(errors);
}
}
}
示例2: progress
import net.ssehub.easy.basics.progress.ProgressObserver; //导入方法依赖的package包/类
/**
* Notifies the tracer about the actual progress in order to inform the user.
*
* @param actual the actual step (negative disables display)
* @param max the maximum number of steps (may vary over time, negative disables display)
* @param description an optional description of the step (may be <b>null</b>)
*/
public static void progress(int actual, int max, String description) {
for (Map.Entry<ProgressObserver, TaskData> entry : PROGRESS_OBSERVERS.entrySet()) {
ProgressObserver obs = entry.getKey();
TaskData task = entry.getValue();
boolean newTask = false;
if (null == task) {
newTask = true;
} else if (null != description && !task.taskDescription.equals(description)) {
// null == description -> keep task
// not same description -> new task
obs.notifyEnd(task.task);
newTask = true;
}
if (newTask) {
task = new TaskData();
task.taskDescription = null == description ? "..." : description;
task.task = obs.registerTask(task.taskDescription);
entry.setValue(task);
}
obs.notifyProgress(task.task, actual, max);
}
}
示例3: updateModelInformation
import net.ssehub.easy.basics.progress.ProgressObserver; //导入方法依赖的package包/类
/**
* Updates the model information in all known locations.
*
* @param observer an optional progress observer (use {@link ProgressObserver#NO_OBSERVER} but
* not <b>null</b> in case that no observation is intended)
* @throws ModelManagementException in case that the available information
* may be come inconsistent due to this update
*/
public synchronized void updateModelInformation(ProgressObserver observer) throws ModelManagementException {
ModelInfoHolder<M> holder = new ModelInfoHolder<M>(availableModels);
ITask task = observer.registerTask("update model model information");
observer.notifyStart(task, locations.getLocationCount());
Set<Location> done = new HashSet<Location>();
for (int l = 0; l < locations.getLocationCount(); l++) {
updateModelInformation(locations.getLocation(l), holder, observer, task, done);
observer.notifyProgress(task, l);
}
observer.notifyEnd(task);
}