Package ion.Core
Class Action<TStartArguments>
- java.lang.Object
-
- ion.Meta.Element
-
- ion.Core.Action<TStartArguments>
-
- Type Parameters:
TStartArguments-
public class Action<TStartArguments> extends ion.Meta.ElementAn Action is an Element that represents an ongoing operation. During this process it can be in three possible states: Running, Idle or Paused.- Author:
- GAIPS
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected classAction.ActionRequestHandlerprotected classAction.PauseRequestprotected classAction.ResumeRequestprotected classAction.StartArgumentsRequestprotected classAction.StartRequeststatic classAction.StateRepresents the possible states of an Action.protected classAction.StepRequestprotected classAction.StopFailRequestprotected classAction.StopSuccessRequest
-
Field Summary
Fields Modifier and Type Field Description protected TStartArgumentsstartArgumentsDirecly changes the value of the Action starting arguments without regarding the synchronization cycle.protected Action.StatestateDirecly changes the value of the Action state without regarding the synchronization cycle.
-
Constructor Summary
Constructors Constructor Description Action()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Action.StategetCurrentState()Gets the Action current State.TStartArgumentsgetStartArguments()Gets the Argument with which the action was started.protected voidhandleRequests(ion.Meta.IReadOnlyQueueSet<ion.Meta.Request> requests)Calls the appropriate handler according to the state of the action.voidonDestroy()protected voidonResume(IResumed evt)protected voidonStart(IStarted evt)protected voidonStep(IStepped evt)voidpause()Pauses the Action.voidresume()Resumes the Action.voidstart()Starts the Action.voidstart(TStartArguments arguments)Starts the Action with a specific starting arguments.voidstop(boolean success)Stops the Action.
-
-
-
Field Detail
-
startArguments
protected TStartArguments startArguments
Direcly changes the value of the Action starting arguments without regarding the synchronization cycle. Only change this value if you know what you are doing!!!
-
state
protected Action.State state
Direcly changes the value of the Action state without regarding the synchronization cycle. Only change this value if you know what you are doing!!!
-
-
Method Detail
-
handleRequests
protected void handleRequests(ion.Meta.IReadOnlyQueueSet<ion.Meta.Request> requests) throws java.lang.ExceptionCalls the appropriate handler according to the state of the action. Has the following policy: Idle State Request Priorities: Start > Other requests Running State Request Priorities: Stop Fail > Stop Sucess > Pause > Step > Other Requests Paused State Request Priorities: Stop Fail > Stop Success > Resume > Other Requests- Parameters:
requests- the set of request queues to be processed- Throws:
java.lang.Exception
-
onStep
protected void onStep(IStepped evt)
-
onStart
protected void onStart(IStarted evt)
-
onResume
protected void onResume(IResumed evt)
-
start
public void start()
Starts the Action.
-
stop
public void stop(boolean success)
Stops the Action.- Parameters:
success- Indicates whether the Action stops successfully or not.
-
pause
public void pause()
Pauses the Action.
-
resume
public void resume()
Resumes the Action.
-
start
public void start(TStartArguments arguments)
Starts the Action with a specific starting arguments.- Parameters:
arguments- the starting arguments
-
getCurrentState
public Action.State getCurrentState()
Gets the Action current State.- Returns:
- the current State of the Action.
-
getStartArguments
public TStartArguments getStartArguments()
Gets the Argument with which the action was started.- Returns:
- the starting arguments of the Action
-
onDestroy
public void onDestroy()
- Specified by:
onDestroyin classion.Meta.Element
-
-