java.lang.Object
com.pauware.pauware_engine.Core.AbstractAction
- Direct Known Subclasses:
Action
public abstract class AbstractAction
extends java.lang.Object
This abstract class represents the general notion of Action in UML.
Instances of this class are executed when entering states (entry/
notation), exiting states (exit/ notation) and at event processing
time (event[guard]/action(s) notation). Use of this class occurs
through the following subclasses:
Action, SendSignalAction.
It is instantiated within the
AbstractStateMachine.fires(String,AbstractState,AbstractState,Object,String,Object[],Object,String,Object[],byte)
method. Instances of this class are executed by means of the
execute() method
during a run-to-completion cycle
(AbstractStateMachine.run_to_completion(String,boolean)
method).
Compatibility: Java 9.
- Since:
- 1.0
-
Field Summary
Fields Modifier and Type Field Description protected java.lang.String_actionThis field represents the action itself.protected java.lang.Object[]_argsThis field represents the action's arguments.protected java.lang.Object_objectThis field represents the object in charge of executing the action.protected java.lang.Object_resultThis field represents the action's result, if already executed.static java.lang.StringPseudo_resultThe default value is the"no result" Stringinstance if there is no execution.static java.lang.StringSendSignalAction_symbolThis class variable is the symbol of an action, which sends a signal (an event). -
Constructor Summary
Constructors Modifier Constructor Description protectedAbstractAction(java.lang.Object object, java.lang.String action, java.lang.Object[] args)This constructor is called by theAbstractStateMachine.fires(String,AbstractState,AbstractState,Object,String,Object[],Object,String,Object[],byte)method. -
Method Summary
Modifier and Type Method Description protected booleancompare_args(java.lang.Object[] args)This method is called by theequals(Object)method.booleanequals(java.lang.Object action)This method is used when an action object is put in a map data structure as a key.protected abstract voidexecute()Implementation of this method depends upon the chosen platform, i.e., adaptation for platforms different from Java 9 have to provide specific code.inthashCode()This method is used when an action object is put in a map data structure as a key.inthashCode_args()This method is called by thehashCode()method.protected java.lang.Stringprintable_action()This method is called by theverbose()method.protected java.lang.Stringprintable_object()This method is called by theverbose()method.protected java.lang.Stringprintable_result()This method is called by theverbose()method.protected voidset_args(java.lang.Object[] args)This method is called by theAbstractAction(Object,String,Object[])constructor.java.lang.Stringto_UML()This method returns the action in the form of a UML-compliant string.protected java.lang.Stringverbose()This method returns the detailed result of the action's execution, or the content of thePseudo_resultclass variable in case of theexecute()method has not yet been run.protected abstract voidwait_for_completion()This method allows the possibility of waiting for actions to complete.Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
-
Field Details
-
SendSignalAction_symbol
public static final java.lang.String SendSignalAction_symbolThis class variable is the symbol of an action, which sends a signal (an event).- See Also:
- Constant Field Values
-
Pseudo_result
public static final java.lang.String Pseudo_resultThe default value is the"no result" Stringinstance if there is no execution.- See Also:
- Constant Field Values
-
_object
protected java.lang.Object _objectThis field represents the object in charge of executing the action. -
_action
protected java.lang.String _actionThis field represents the action itself. -
_args
protected java.lang.Object[] _argsThis field represents the action's arguments. -
_result
protected java.lang.Object _resultThis field represents the action's result, if already executed.- See Also:
Pseudo_result
-
-
Constructor Details
-
AbstractAction
protected AbstractAction(java.lang.Object object, java.lang.String action, java.lang.Object[] args)This constructor is called by theAbstractStateMachine.fires(String,AbstractState,AbstractState,Object,String,Object[],Object,String,Object[],byte)method.- Parameters:
object- The object executing the action; Java arrays are supported.action- The executed action (nullmeans no effect).args- The action's arguments (nullmeans no arguments).
-
-
Method Details
-
equals
public boolean equals(java.lang.Object action)This method is used when an action object is put in a map data structure as a key.- Overrides:
equalsin classjava.lang.Object- Parameters:
action-
-
hashCode
public int hashCode()This method is used when an action object is put in a map data structure as a key.- Overrides:
hashCodein classjava.lang.Object
-
execute
Implementation of this method depends upon the chosen platform, i.e., adaptation for platforms different from Java 9 have to provide specific code.- Throws:
State_exception- An encapsulation of any Java problem that results from executing the action
-
wait_for_completion
This method allows the possibility of waiting for actions to complete.- Throws:
State_exception
-
compare_args
protected boolean compare_args(java.lang.Object[] args)This method is called by theequals(Object)method.- Parameters:
args-- Returns:
-
hashCode_args
public int hashCode_args()This method is called by thehashCode()method. Caution: actions are known to be similar when the type and the number of their arguments are the same. The identities of their arguments are NOT used at comparison time. In this perspective, this method guarantees thata1.equals(a2)impliesa1.hashCode() == a2.hashCode().- Returns:
-
set_args
protected void set_args(java.lang.Object[] args)This method is called by theAbstractAction(Object,String,Object[])constructor.- Parameters:
args-
-
printable_action
protected java.lang.String printable_action()This method is called by theverbose()method.- Returns:
-
printable_object
protected java.lang.String printable_object()This method is called by theverbose()method.- Returns:
-
printable_result
protected java.lang.String printable_result()This method is called by theverbose()method.- Returns:
-
verbose
protected java.lang.String verbose()This method returns the detailed result of the action's execution, or the content of thePseudo_resultclass variable in case of theexecute()method has not yet been run.- Returns:
-
to_UML
public java.lang.String to_UML()This method returns the action in the form of a UML-compliant string.- Returns:
-