|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.kuka.roboticsAPI.controllerModel.sunrise.SPRRuntime
public class SPRRuntime
Class managing all runtime issues of the associated SPR.
Works together with SunriseExecutionService class to manage all aspects of the SPR execution including
pausing and canceling.
The class will be automatically created for every new SPR instance.
| Nested Class Summary | |
|---|---|
static interface |
SPRRuntime.ISPRCancelListener
Listener which is called if nobody has canceled the SPR so far and the cancel process is started. |
| Constructor Summary | |
|---|---|
SPRRuntime(SPR spr)
Creates an instance of the class for the specified SPR. |
|
| Method Summary | |
|---|---|
void |
addAsyncCompoundEventListener(ICompoundEventListener listener)
Adds a listener for this SPR. |
void |
addIdListener(ISPRIdListener listener)
Adds a listener for this SPR. |
void |
addStateListener(ISPRStateListener listener)
Adds a listener for this SPR. |
void |
addSyncCompoundEventListener(ICompoundEventListener listener)
Adds a synchronous compound event listener for this SPR. |
void |
addSyncStateListener(ISPRStateListener listener)
Adds a synchronous SPR state listener for this SPR. |
void |
callCompoundEventListeners(Message eventMessage)
Calls all listeners and informs them that a new compound event was thrown. |
boolean |
cancel()
Cancels the associated SPR. |
boolean |
cancel(SPRRuntime.ISPRCancelListener cancelStartedListener)
Cancels the associated SPR. |
ISPRCancelBehavior |
cancelBehavior()
Gets the cancel behavior for the associated SPR. |
void |
cancelOnController()
Sends cancel request to the controller. |
boolean |
cancelOnControllerAndWait(int time,
TimeUnit unit)
Sends a cancel request to Sunrise and waits the SPR will be finished. |
void |
cancelOnExit(boolean sendToController)
Cancels the SPR on application exit (dispose of the ExecutionService). |
String |
getErrorMessage()
Gets the error message for this SPR if applicable. |
SunriseStopCondition |
getFiredStopCondition()
Gets the stop condition which has finished this SPR. |
long |
getId()
Gets the id of this SPR. |
SPR |
getSPR()
Gets the SPR with which this runtime object is associated. |
String |
getSPRIdString()
Gets the readable string representation of thisSPR id. |
long |
getStackId()
Gets the id of the stack to which belongs the associated SPR. |
SPR |
getStackRepresentative()
Returns the SPR that is the representative for a SPR stack. |
SPRState |
getState()
Gets the state of the associated SPR. |
void |
handleReturnStateMessage(Message message)
Sets the return values associated with the change of the SPR state. |
boolean |
hasStopEvaluator()
States if the SPR possess a StopEvaluator module. |
void |
initialize(ISunriseCommandExecutor execService,
long id)
Initializes the associated SPR for execution. |
void |
invalidateSPR(String errorMessage)
Makes the associated SPR invalid for listeners with the specified error message. |
boolean |
isApplicationExit()
Returns true if the SPR was finished due to the application exiting. |
boolean |
isCanceled()
Return true, if the canceled flag is set. |
boolean |
isCancelledBeforePreActive()
States whether the SPR was canceled before 'PreActive' or not. |
boolean |
isObserverSPR()
Returns true if the SPR is an observer SPR. |
boolean |
isStoppedWithStack()
Returns true if the SPR was or will be stopped because another SPR in the stack was stopped. |
void |
removeAsyncCompoundEventListener(ICompoundEventListener listener)
Removes the listener from this SPR. |
void |
removeIdListener(ISPRIdListener listener)
Removes the listener from this SPR. |
void |
removeStateListener(ISPRStateListener listener)
Removes the listener from this SPR. |
void |
removeSyncCompoundEventListener(ICompoundEventListener listener)
Removes the given synchronous compound event listener from this SPR. |
void |
removeSyncStateListener(ISPRStateListener listener)
Removes the given synchronous state listener from this SPR. |
void |
setCancelBehavior(ISPRCancelBehavior cancelBehavior)
Sets the cancel behavior for the SPR. |
void |
setObserverSPR(boolean isObserverSPR)
Should be set to true if the SPR is an observer SPR. |
void |
setStackIdFromRepresentative()
Sets the stack id of this SPR. |
void |
setStackRepresentative(SPR stackRepresentative)
Sets the SPR that is the representative for a SPR stack. |
void |
setState(SPRState newState)
Sets the SPR State of the runtime. |
void |
setState(SPRState newState,
StopConditionType stopCondition)
Sets the SPR State of the runtime. |
void |
setState(SPRState newState,
StopConditionType stopCondition,
String errorString)
Sets the SPR State of the runtime. |
String |
toString()
|
void |
update()
Updates the associated SPR. |
boolean |
waitForActive(long timeout,
TimeUnit unit)
Blocks the calling thread until the SPR is active. |
boolean |
waitForFinished(int timeout,
TimeUnit unit)
Blocks the calling thread until the SPR is in finished. |
boolean |
waitForMaintaining(int timeout,
TimeUnit unit)
Blocks the calling thread until the SPR is in maintaining. |
boolean |
waitForPreparationFinished(int timeout,
TimeUnit unit)
Blocks the calling thread until the SPR is in preparation finished. |
boolean |
waitForTransferred(int timeout,
TimeUnit unit)
Blocks the calling thread until the SPR was transferred to Sunrise. |
boolean |
waitForTuning(long timeout,
TimeUnit unit)
Blocks the calling thread until the SPR is tuning. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public SPRRuntime(SPR spr)
spr - SPR to associate with the runtime.| Method Detail |
|---|
public SPR getSPR()
public final SPRState getState()
public final void setState(SPRState newState)
newState - new SPR state
public final void setState(SPRState newState,
StopConditionType stopCondition)
newState - new SPR statestopCondition - id of the fired user stop condition
public final void setState(SPRState newState,
StopConditionType stopCondition,
String errorString)
newState - new SPR statestopCondition - id of the fired user stop conditionerrorString - e.g. Invalidation of SPRpublic boolean isCancelledBeforePreActive()
True if the SPR was canceled before 'PreActive', otherwise false.public final boolean isCanceled()
public boolean isStoppedWithStack()
public boolean isApplicationExit()
public final void addStateListener(ISPRStateListener listener)
listener - The state listener for this SPR. null is not allowed.
IllegalArgumentException - if listener is null or the same listener is already registeredpublic final void removeStateListener(ISPRStateListener listener)
listener - The state listener for this SPR. null is not allowed.public final void addSyncStateListener(ISPRStateListener listener)
listener - The synchronous compound event listener for this SPR.public final void removeSyncStateListener(ISPRStateListener listener)
listener - The synchronous compound event listener which should be removed.public final void addSyncCompoundEventListener(ICompoundEventListener listener)
listener - The synchronous compound event listener for this SPR.public final void removeSyncCompoundEventListener(ICompoundEventListener listener)
listener - The synchronous compound event listener which should be removed.public final void addAsyncCompoundEventListener(ICompoundEventListener listener)
listener - The compound event listener for this SPR. null is not allowed.
IllegalArgumentException - if listener is null or the same listener is already registeredpublic final void removeAsyncCompoundEventListener(ICompoundEventListener listener)
listener - The compound event listener for this SPR. null is not allowed.public final void addIdListener(ISPRIdListener listener)
listener - The state listener for this SPR. null is not allowed.
IllegalArgumentException - if listener is null or the same listener is already registeredpublic final void removeIdListener(ISPRIdListener listener)
listener - The state listener for this SPR. null is not allowed.
public final boolean waitForTransferred(int timeout,
TimeUnit unit)
timeout - The timeout.unit - The unit of the timeout.
public final boolean waitForTuning(long timeout,
TimeUnit unit)
timeout - The timeout.unit - The unit of the timeout.
public final boolean waitForActive(long timeout,
TimeUnit unit)
timeout - The timeout.unit - The unit of the timeout.
public final boolean waitForMaintaining(int timeout,
TimeUnit unit)
timeout - The timeout.unit - The unit of the timeout.
public final boolean waitForPreparationFinished(int timeout,
TimeUnit unit)
timeout - The timeout.unit - The unit of the timeout.
public final boolean waitForFinished(int timeout,
TimeUnit unit)
timeout - The timeout.unit - The unit of the timeout.
public final void callCompoundEventListeners(Message eventMessage)
eventMessage - The event message.public final SunriseStopCondition getFiredStopCondition()
public final long getId()
public final void setStackIdFromRepresentative()
public final long getStackId()
public final void initialize(ISunriseCommandExecutor execService,
long id)
Is only possible in created and finished state.
execService - execution service which processes the execution of the associated SPR.id - the SPR idpublic boolean cancel()
If the SPR is paused - does not send cancel request to controller - just sets the SPR state and notifies listeners. Otherwise uses the cancel behavior set for the SPR to cancel it.
public boolean cancel(SPRRuntime.ISPRCancelListener cancelStartedListener)
If the SPR is paused - does not send cancel request to controller - just sets the SPR state and notifies listeners. Otherwise uses the cancel behavior set for the SPR to cancel it.
cancelStartedListener - Listener which is called if nobody has canceled the SPR so far and the cancel process is started.
true, when SPR canceled now, false when SPR was already canceled.public void cancelOnExit(boolean sendToController)
sendToController - cancel should be sent to the controller if this parameter is set to true.public void cancelOnController()
public ISPRCancelBehavior cancelBehavior()
if behavior was never set by user - default behavior DefaultCancelBehavior will be returned (and used by
the SPR).
public void setCancelBehavior(ISPRCancelBehavior cancelBehavior)
cancelBehavior - cancel behavior to set. Can not be null .
public boolean cancelOnControllerAndWait(int time,
TimeUnit unit)
time - time to wait for finished.unit - time unit for time parameter.
true if SPR was finished before the specified timeout expired; otherwise false.public boolean isObserverSPR()
true if the SPR is an observer SPR.
true if the SPR is an observer SPR.public void setObserverSPR(boolean isObserverSPR)
true if the SPR is an observer SPR.
Observer SPR automatically gets special pause behavior: ObserverSPRPauseBehavior. And a "false" stop
condition.
isObserverSPR - true if the SPR is an observer SPR.public String toString()
toString in class Objectpublic void invalidateSPR(String errorMessage)
The SPR will be canceled on the controller and all listeners of the SPR state get the information that the SPR is invalid.
errorMessage - error messagepublic String getErrorMessage()
nullpublic void update()
public String getSPRIdString()
public SPR getStackRepresentative()
public void setStackRepresentative(SPR stackRepresentative)
stackRepresentative - the representative for the SPR stackpublic void handleReturnStateMessage(Message message)
message - The new return values message.public boolean hasStopEvaluator()
True if the SPR possess a StopEvalutor module, otherwise false;
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||