View Javadoc
1   package org.andromda.metafacades.emf.uml22;
2   
3   import java.util.ArrayList;
4   import java.util.Collection;
5   import org.eclipse.uml2.uml.Behavior;
6   import org.eclipse.uml2.uml.State;
7   
8   /**
9    * MetafacadeLogic implementation for org.andromda.metafacades.uml.StateFacade.
10   *
11   * @see org.andromda.metafacades.uml.StateFacade
12   */
13  public class StateFacadeLogicImpl
14      extends StateFacadeLogic
15  {
16      private static final long serialVersionUID = 34L;
17      /**
18       * @param metaObject
19       * @param context
20       */
21      public StateFacadeLogicImpl(
22          final State metaObject,
23          final String context)
24      {
25          super(metaObject, context);
26      }
27  
28      /**
29       * @see org.andromda.metafacades.uml.StateFacade#getDeferrableEvents()
30       */
31      @Override
32      protected Collection<Behavior> handleGetDeferrableEvents()
33      {
34          // UML1.4 Events are mapped to UML2 Activity
35          // We obtain them through entry, doActivity and exit
36          final Collection<Behavior> events = new ArrayList<Behavior>();
37          final Behavior entry = this.metaObject.getEntry();
38          final Behavior doActivity = this.metaObject.getDoActivity();
39          final Behavior onExit = this.metaObject.getExit();
40  
41          if (entry != null)
42          {
43              events.add(entry);
44          }
45          if (doActivity != null)
46          {
47              events.add(doActivity);
48          }
49          if (onExit != null)
50          {
51              events.add(onExit);
52          }
53          return events;
54      }
55  }