Constructor and Description |
---|
Progress()
DO NOT USE this constructor.
|
Modifier and Type | Method and Description |
---|---|
void |
checkNext()
This calls next() and throws a StoppedException if it returns false.
|
void |
checkNext(String doingNow) |
void |
checkStopped()
If shouldStop() is true this will throw a new StoppedException.
|
void |
checkStopped(Throwable t)
If the supplied Throwable is a StoppedException or if its cause is a StoppedException, then throw
that StoppedException.
|
void |
clearOutgoingParameters()
Clear current outgoing parameters.
|
void |
close()
Indicate that the Progress is no longer to be used.
|
static Progress |
disable()
Return a new Progress that has no Handle associated with it and that prevents other method calls
from accessing the Handle until close() is called on it.
|
void |
dontcheckNext()
This calls next() but does NOT throw a StoppedException if the
shouldStop flag is true.
|
void |
dontcheckStopped()
This is used for debugging and it performs no action.
|
static Progress |
dontget()
This is the same as disable() but is convenient for debugging allowing you to simply changing the get() to a dontget().
|
Progress |
dontgetSub()
This is the same as disable() but is included as a quick way for debugging Progress handling.
|
void |
forceStopped()
This always throws a StoppedException.
|
Progress |
freeze(boolean onlyDoing)
Prevent any further Progress from altering the progress and/or doing of the handle.
|
static Progress |
get()
Get a Progress for the Handle associated with the current Thread (if any).
|
static Progress |
getFor(Handle h,
boolean exclusive)
Get a Progress object for the specified Handle (which may be null) and indicate
if no other Progress objects can change the progress of the Handle.
|
static Progress |
getFor(Handle h,
boolean exclusive,
String startDoing)
Get a Progress object for the specified Handle (which may be null) and indicate
if no other Progress objects can change the progress of the Handle.
|
Object |
getIncomingParameter(String name,
Object defaultValue) |
Object |
getIncomingParameter(String name,
Object defaultValue,
Class objectType) |
PropertyList |
getIncomingParameters()
Get the extra incoming parameters - this should be called as soon as the Progress is created since
it can be reset whenever a method is called from the current method.
|
static Progress |
getNullProgress()
Return a non-null Progress object that refers to a null Handle.
|
PropertyList |
getOutgoingParameters()
Return the current set of outgoing parameters.
|
StoppedException |
getStopped()
Returns a StoppedException only if the Handle was actually stopped.
|
Progress |
getSub()
Create a new Handle for the Thread and set it as a subHandle for the current Handle.
|
Progress |
getSub(Handle subHandleToUse)
Create a new Handle for the Thread and set it as a subHandle for the current Handle.
|
Progress |
getSubProgress(float percentOfParent) |
Handle |
handle()
Return the handle associated with this Progress, which may be null.
|
boolean |
isNull() |
boolean |
next()
Call start() before making calls to next().
|
int |
nextIteration(String newTask) |
Handle |
nonNullHandle()
Return the handle associated with this Progress, or a new Handle that
is not connected with the current Thread if the real current Handle is null.
|
static PropertyList |
quickGetIncomingParmeters()
Only use this if you are not going to be using a Progress for the current method.
|
void |
resetProgress(float progressResolution) |
Progress |
setDoing(String what) |
int |
setProgress(float currentProgress) |
int |
setProgress(float currentProgress,
String newTask) |
int |
setTask(String task) |
boolean |
shouldStop() |
Progress |
start(int maxIterations)
This calls startDoing() and then sets the expected number of times next() will be called.
|
Progress |
start(String what,
int maxIterations)
This calls startDoing() and then sets the expected number of times next() will be called.
|
int |
startDoing(String what) |
int |
startIteration(String task,
int maxIterations) |
PropertyList |
startOutgoingParameters()
Every time this is called a NEW set of parameters is created - any old ones are cleared.
|
int |
startTask(String task) |
void |
transferParameters(PropertyList from,
String parameterList)
Transfer a set of incoming parameters to the outgoing parameters, possibly renaming the parameters.
|
static Progress |
tryGet(Handle h)
If the provided Handle is not null then return a Progress for it.
|
void |
unfreeze()
This is automatically done on close() but you can call it before if you called freeze() previously.
|
boolean |
waitChangeAccepted(int valueFromSetProgress,
int timeout) |
public PropertyList getIncomingParameters()
public PropertyList startOutgoingParameters()
public PropertyList getOutgoingParameters()
public void clearOutgoingParameters()
public void transferParameters(PropertyList from, String parameterList)
parameterList
- a comma separated list of parameter names. Each parameter name may be a single name
or it may be of the form "incomingName->outgoingName".public Object getIncomingParameter(String name, Object defaultValue, Class objectType)
public static PropertyList quickGetIncomingParmeters()
public Handle handle()
public Handle nonNullHandle()
public static Progress getNullProgress()
public Progress freeze(boolean onlyDoing)
onlyDoing
- if this is true then new Progress objects can change the progress value of the Handle
but not the doing value.public void unfreeze()
public static Progress disable()
public static Progress dontget()
public static Progress tryGet(Handle h)
h
- a possibly null Handle.public static Progress get()
public Progress getSub(Handle subHandleToUse)
subHandleToUse
- a Handle to use as the sub-handle.public Progress getSub()
public Progress dontgetSub()
public static Progress getFor(Handle h, boolean exclusive)
h
- the Handle, which may be null.exclusive
- if this is true then only this Progress is allowed to change the Handle status, unless
a previous Progress had already made it exclusive.public static Progress getFor(Handle h, boolean exclusive, String startDoing)
h
- the Handle, which may be null.exclusive
- if this is true then only this Progress is allowed to change the Handle status, unlessstartDoing
- if this is non-null then startDoing() will be called on the Progress and further Progress
objects will not be able to alter this doing String.
a previous Progress had already made it exclusive.public final void close()
public final boolean shouldStop()
public final int startDoing(String what)
public final Progress start(String what, int maxIterations)
what
- the parameter sent to startDoing().maxIterations
- the maximum number of expected iterations - or -1 if it is unknown.public final Progress start(int maxIterations)
maxIterations
- the maximum number of expected iterations, or -1 if it is unknown.public final boolean next()
public void checkStopped() throws StoppedException
checkStopped
in interface Progress
StoppedException
public void checkStopped(Throwable t) throws StoppedException
t
- a Throwable.StoppedException
public void dontcheckStopped()
public void forceStopped() throws StoppedException
forceStopped
in interface Progress
StoppedException
public void checkNext(String doingNow) throws StoppedException
StoppedException
public void checkNext() throws StoppedException
StoppedException
public void dontcheckNext() throws StoppedException
StoppedException
public StoppedException getStopped()
public final void resetProgress(float progressResolution)
public final int setProgress(float currentProgress)
setProgress
in interface Progress
public final boolean waitChangeAccepted(int valueFromSetProgress, int timeout)
waitChangeAccepted
in interface Progress
public Progress getSubProgress(float percentOfParent)
getSubProgress
in interface Progress
public int setProgress(float currentProgress, String newTask)
setProgress
in interface Progress
public int startIteration(String task, int maxIterations)
startIteration
in interface Progress
public int nextIteration(String newTask)
nextIteration
in interface Progress