public class JIPipeProgressInfo extends Object implements org.scijava.Cancelable
JIPipeRunnable
and contains methods to report progress, logs, and request cancellation.Modifier and Type | Class and Description |
---|---|
static class |
JIPipeProgressInfo.StatusUpdatedEvent |
static class |
JIPipeProgressInfo.StatusUpdatedEventEmitter |
static interface |
JIPipeProgressInfo.StatusUpdatedEventListener |
Modifier and Type | Field and Description |
---|---|
static JIPipeProgressInfo |
SILENT |
static JIPipeProgressInfo |
STDOUT |
Constructor and Description |
---|
JIPipeProgressInfo() |
JIPipeProgressInfo(JIPipeProgressInfo other) |
Modifier and Type | Method and Description |
---|---|
void |
addMaxProgress(int maxProgress) |
void |
addProgress(int progress) |
void |
cancel() |
void |
cancel(String reason) |
void |
clearLog() |
JIPipeProgressInfo |
detachProgress()
Creates a sub-progress that detaches the references to the global process counters.
|
String |
getCancelReason() |
StringBuilder |
getLog() |
String |
getLogPrepend() |
int |
getMaxProgress() |
JIPipeNotificationInbox |
getNotifications() |
int |
getProgress() |
JIPipeProgressInfo.StatusUpdatedEventEmitter |
getStatusUpdatedEventEmitter() |
void |
incrementProgress() |
boolean |
isCanceled() |
boolean |
isCancelled() |
boolean |
isDetachedProgress()
Returns true if the progress was detached from the root progress
|
boolean |
isLogToStdOut() |
boolean |
isWithSpinner() |
void |
log(String message)
Writes a message into the log
|
void |
log(Throwable e) |
JIPipePercentageProgressInfo |
percentage(String text) |
JIPipeProgressInfo |
resolve(String logPrepend)
Creates a sub-progress that has the same cancellation and progress, but shows the new category in front of sub-messages
|
JIPipeProgressInfo |
resolve(String text,
int index,
int size)
Creates a sub-progress that has the same cancellation and progress, but shows the new category in front of sub-messages.
|
JIPipeProgressInfo |
resolveAndLog(String logPrepend)
Applies resolve(logPrepend) and then logs an empty message
|
JIPipeProgressInfo |
resolveAndLog(String text,
int index,
int size)
Creates a sub-progress that has the same cancellation and progress, but shows the new category in front of sub-messages.
|
void |
resolveAndLogForEach(String text,
byte[] collection,
BiConsumer<Byte,JIPipeProgressInfo> function)
Applies a for-each operation where the progress is logged
|
<T> void |
resolveAndLogForEach(String text,
Collection<T> collection,
BiConsumer<T,JIPipeProgressInfo> function)
Applies a for-each operation where the progress is logged
|
void |
resolveAndLogForEach(String text,
double[] collection,
BiConsumer<Double,JIPipeProgressInfo> function)
Applies a for-each operation where the progress is logged
|
void |
resolveAndLogForEach(String text,
float[] collection,
BiConsumer<Float,JIPipeProgressInfo> function)
Applies a for-each operation where the progress is logged
|
void |
resolveAndLogForEach(String text,
int[] collection,
BiConsumer<Integer,JIPipeProgressInfo> function)
Applies a for-each operation where the progress is logged
|
void |
resolveAndLogForEach(String text,
long[] collection,
BiConsumer<Long,JIPipeProgressInfo> function)
Applies a for-each operation where the progress is logged
|
void |
resolveAndLogForEach(String text,
short[] collection,
BiConsumer<Short,JIPipeProgressInfo> function)
Applies a for-each operation where the progress is logged
|
<T> void |
resolveAndLogForEach(String text,
T[] collection,
BiConsumer<T,JIPipeProgressInfo> function)
Applies a for-each operation where the progress is logged
|
void |
setLogToStdOut(boolean value) |
void |
setMaxProgress(int maxProgress) |
void |
setNotifications(JIPipeNotificationInbox notifications) |
void |
setProgress(int progress) |
void |
setProgress(int count,
int total)
Sets the progress and max progress
|
void |
setStatusUpdatedEventEmitter(JIPipeProgressInfo.StatusUpdatedEventEmitter statusUpdatedEventEmitter) |
void |
setWithSpinner(boolean b) |
public static final JIPipeProgressInfo SILENT
public static final JIPipeProgressInfo STDOUT
public JIPipeProgressInfo()
public JIPipeProgressInfo(JIPipeProgressInfo other)
public void clearLog()
public void incrementProgress()
public String getLogPrepend()
public JIPipeProgressInfo.StatusUpdatedEventEmitter getStatusUpdatedEventEmitter()
public void setStatusUpdatedEventEmitter(JIPipeProgressInfo.StatusUpdatedEventEmitter statusUpdatedEventEmitter)
public int getProgress()
public void setProgress(int progress)
public int getMaxProgress()
public void setMaxProgress(int maxProgress)
public boolean isCancelled()
public boolean isCanceled()
isCanceled
in interface org.scijava.Cancelable
public void cancel(String reason)
cancel
in interface org.scijava.Cancelable
public String getCancelReason()
getCancelReason
in interface org.scijava.Cancelable
public void cancel()
public StringBuilder getLog()
public boolean isLogToStdOut()
public void setLogToStdOut(boolean value)
public boolean isWithSpinner()
public void setWithSpinner(boolean b)
public JIPipeNotificationInbox getNotifications()
public void setNotifications(JIPipeNotificationInbox notifications)
public void log(String message)
message
- the messagepublic boolean isDetachedProgress()
public JIPipeProgressInfo detachProgress()
public JIPipeProgressInfo resolve(String logPrepend)
logPrepend
- the categorypublic JIPipeProgressInfo resolve(String text, int index, int size)
text
- the categoryindex
- index of the index operationsize
- size of the index operationpublic JIPipeProgressInfo resolveAndLog(String logPrepend)
logPrepend
- the categorypublic JIPipeProgressInfo resolveAndLog(String text, int index, int size)
text
- the categoryindex
- index of the index operationsize
- size of the index operationpublic <T> void resolveAndLogForEach(String text, Collection<T> collection, BiConsumer<T,JIPipeProgressInfo> function)
T
- collection contentstext
- the textcollection
- the iterated collectionfunction
- the function executed for each item in the collectionpublic <T> void resolveAndLogForEach(String text, T[] collection, BiConsumer<T,JIPipeProgressInfo> function)
T
- collection contentstext
- the textcollection
- the iterated collectionfunction
- the function executed for each item in the collectionpublic void resolveAndLogForEach(String text, int[] collection, BiConsumer<Integer,JIPipeProgressInfo> function)
text
- the textcollection
- the iterated collectionfunction
- the function executed for each item in the collectionpublic void resolveAndLogForEach(String text, byte[] collection, BiConsumer<Byte,JIPipeProgressInfo> function)
text
- the textcollection
- the iterated collectionfunction
- the function executed for each item in the collectionpublic void resolveAndLogForEach(String text, long[] collection, BiConsumer<Long,JIPipeProgressInfo> function)
text
- the textcollection
- the iterated collectionfunction
- the function executed for each item in the collectionpublic void resolveAndLogForEach(String text, short[] collection, BiConsumer<Short,JIPipeProgressInfo> function)
text
- the textcollection
- the iterated collectionfunction
- the function executed for each item in the collectionpublic void resolveAndLogForEach(String text, float[] collection, BiConsumer<Float,JIPipeProgressInfo> function)
text
- the textcollection
- the iterated collectionfunction
- the function executed for each item in the collectionpublic void resolveAndLogForEach(String text, double[] collection, BiConsumer<Double,JIPipeProgressInfo> function)
text
- the textcollection
- the iterated collectionfunction
- the function executed for each item in the collectionpublic void setProgress(int count, int total)
count
- the progresstotal
- the max progresspublic void addMaxProgress(int maxProgress)
public void addProgress(int progress)
public JIPipePercentageProgressInfo percentage(String text)
public void log(Throwable e)
Copyright © 2020–2025 Leibniz Institute for Natural Product Research and Infection Biology - Hans Knöll Institute (HKI). All rights reserved.