View Javadoc

1   package cz.cuni.amis.pogamut.sposh.executor;
2   
3   import cz.cuni.amis.pogamut.sposh.context.Context;
4   
5   /**
6    * Basic state action primitive. It contains context and name. Wizzard for new
7    * state actions generates class that is extension of this class.
8    * @author Honza
9    * @param <CONTEXT> Context of this action, used to manipulate the environment.
10   * @param <RETURN> Class of object this action returns every time it is evaluated.
11   */
12  public abstract class StateAction<CONTEXT extends Context, RETURN> implements IAction<RETURN> {
13      /** Name of the action */
14      private String name;
15      /** Context for the action */
16      protected final CONTEXT ctx;
17  
18      /**
19       * Create new state action.
20       * @param name name of the action
21       * @param ctx action context, used as shared memory or environment interactor.
22       */
23      protected StateAction(String name, CONTEXT ctx) {
24          this.name = name;
25          this.ctx = ctx;
26      }
27  
28      /**
29       * Get name of the action.
30       * @return the name
31       */
32      public String getName() {
33          return name;
34      }
35  
36      /**
37       * Get shared context of all primitives.
38       * @return the ctx
39       */
40      public CONTEXT getCtx() {
41          return ctx;
42      }
43  
44  }