Module PauWareTwo

Class AbstractAction

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 _action
    This field represents the action itself.
    protected java.lang.Object[] _args
    This field represents the action's arguments.
    protected java.lang.Object _object
    This field represents the object in charge of executing the action.
    protected java.lang.Object _result
    This field represents the action's result, if already executed.
    static java.lang.String Pseudo_result
    The default value is the "no result" String instance if there is no execution.
    static java.lang.String SendSignalAction_symbol
    This class variable is the symbol of an action, which sends a signal (an event).
  • Constructor Summary

    Constructors
    Modifier Constructor Description
    protected AbstractAction​(java.lang.Object object, java.lang.String action, java.lang.Object[] args)
  • Method Summary

    Modifier and Type Method Description
    protected boolean compare_args​(java.lang.Object[] args)
    This method is called by the equals(Object) method.
    boolean equals​(java.lang.Object action)
    This method is used when an action object is put in a map data structure as a key.
    protected abstract void execute()
    Implementation of this method depends upon the chosen platform, i.e., adaptation for platforms different from Java 9 have to provide specific code.
    int hashCode()
    This method is used when an action object is put in a map data structure as a key.
    int hashCode_args()
    This method is called by the hashCode() method.
    protected java.lang.String printable_action()
    This method is called by the verbose() method.
    protected java.lang.String printable_object()
    This method is called by the verbose() method.
    protected java.lang.String printable_result()
    This method is called by the verbose() method.
    protected void set_args​(java.lang.Object[] args)
    This method is called by the AbstractAction(Object,String,Object[]) constructor.
    java.lang.String to_UML()
    This method returns the action in the form of a UML-compliant string.
    protected java.lang.String verbose()
    This method returns the detailed result of the action's execution, or the content of the Pseudo_result class variable in case of the execute() method has not yet been run.
    protected abstract void wait_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_symbol
      This 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_result
      The default value is the "no result" String instance if there is no execution.
      See Also:
      Constant Field Values
    • _object

      protected java.lang.Object _object
      This field represents the object in charge of executing the action.
    • _action

      protected java.lang.String _action
      This field represents the action itself.
    • _args

      protected java.lang.Object[] _args
      This field represents the action's arguments.
    • _result

      protected java.lang.Object _result
      This field represents the action's result, if already executed.
      See Also:
      Pseudo_result
  • Constructor Details

  • 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:
      equals in class java.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:
      hashCode in class java.lang.Object
    • execute

      protected abstract void execute() throws State_exception
      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

      protected abstract void wait_for_completion() throws State_exception
      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 the equals(Object) method.
      Parameters:
      args -
      Returns:
    • hashCode_args

      public int hashCode_args()
      This method is called by the hashCode() 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 that a1.equals(a2) implies a1.hashCode() == a2.hashCode().
      Returns:
    • set_args

      protected void set_args​(java.lang.Object[] args)
      This method is called by the AbstractAction(Object,String,Object[]) constructor.
      Parameters:
      args -
    • printable_action

      protected java.lang.String printable_action()
      This method is called by the verbose() method.
      Returns:
    • printable_object

      protected java.lang.String printable_object()
      This method is called by the verbose() method.
      Returns:
    • printable_result

      protected java.lang.String printable_result()
      This method is called by the verbose() method.
      Returns:
    • verbose

      protected java.lang.String verbose()
      This method returns the detailed result of the action's execution, or the content of the Pseudo_result class variable in case of the execute() 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: