private void setProjectPreference(String key, boolean value) throws BackingStoreException {
   BaseTest.dispatchEvents(0);
   IScopeContext projectScope = new ProjectScope(project);
   Preferences projectNode =
       projectScope.getNode(BridgePointProjectPreferences.BP_PROJECT_PREFERENCES_ID);
   projectNode.putBoolean(key, value);
   BaseTest.dispatchEvents(0);
 }
  private IMarker[] parseModel(NonRootModelElement testElement) throws CoreException {
    BaseTest.dispatchEvents(0);
    try {
      Bundle ui_text = Platform.getBundle("org.xtuml.bp.ui.text"); // $NON-NLS-1$
      Class<?> factoryClass =
          ui_text.loadClass("org.xtuml.bp.ui.text.activity.AllActivityModifier"); // $NON-NLS-1$

      // find the constructor that takes package and monitor as parameters
      Class<?>[] arg_types = new Class[] {testElement.getClass(), IProgressMonitor.class};
      Constructor<?> ctor = factoryClass.getDeclaredConstructor(arg_types);

      // invoke the constructor to create an instance
      Object[] args = new Object[] {testElement, new NullProgressMonitor()};
      IAllActivityModifier aam = (IAllActivityModifier) ctor.newInstance(args);

      aam.processAllActivities(IAllActivityModifier.PARSE);
    } catch (ClassNotFoundException cnf) {
      CorePlugin.logError("Problem loading activity parser ", cnf);
    } catch (IllegalAccessException i) {
      CorePlugin.logError("Problem loading activity parser ", i);
    } catch (InstantiationException i) {
      CorePlugin.logError("Problem loading activity parser ", i);
    } catch (InvocationTargetException e) {
      CorePlugin.logError("Problem running activity parser ", e);
    } catch (SecurityException e) {
      CorePlugin.logError("Problem running activity parser ", e);
    } catch (NoSuchMethodException e) {
      CorePlugin.logError("Problem running activity parser ", e);
    }
    return collectParseErrors(testElement);
  }
 @Override
 public void setUp() throws Exception {
   super.setUp();
   CorePlugin.getDefault()
       .getPreferenceStore()
       .setValue(BridgePointPreferencesStore.USE_DEFAULT_NAME_FOR_CREATION, false);
   Ooaofooa.setPersistEnabled(true);
 }
 protected void tearDown() throws Exception {
   if (mdlClassPath != null) setProperty("mdlClassPath", mdlClassPath.toString());
   super.tearDown();
   if (toRunTests() && project.exists()) {
     Workbench.getInstance().getActiveWorkbenchWindow().getActivePage().closeAllEditors(true);
   }
   BaseTest.waitForJobs();
 }
  public void doTestDeleteModelElement() throws Exception {
    BaseTest.dispatchEvents(0);
    ActionTestGenerics delAction = new ActionTestGenerics();
    delAction.setUp();
    modelRoot = BaseTest.getDefaultTestInstance();

    Ooaofooa.getDefaultInstance().addModelChangeListener(instantListener);
    Ooaofooa.getDefaultInstance().addModelChangeListener(batchedListener);
    Ooaofgraphics c = Ooaofgraphics.getInstance(modelRoot.getId());
    c.addModelChangeListener(instantListener);
    c.addModelChangeListener(batchedListener);
    try {
      delAction.testDeleteEP_PKG();

      BaseTest.dispatchEvents(0);

    } catch (Exception e) {
      fail("Test deletion of model Element Failed: " + e.toString()); // $NON-NLS-1$
    }

    // Comparing Events
    assertTrue(
        "No events heard by instant listener",
        instantListener.eventsList.size() > 0); // $NON-NLS-1$
    assertTrue(
        "No events heard by batched listener",
        batchedListener.eventsList.size() > 0); // $NON-NLS-1$
    // the number of events will be different by one
    // this is due to the fact that deltas that affect
    // the same element's name are not collected only the
    // first delta found is updated.  This test collects
    // events that were fired, in the case of an instant
    // listener the update needs to be fired, for a batched
    // listener it does not.
    assertEquals(
        "Number of Events in the instant Listener: "
            + instantListener.eventsList.size() // $NON-NLS-1$
            + " is not same as in batched listener: "
            + batchedListener.eventsList.size(), // $NON-NLS-1$
        instantListener.eventsList.size(),
        batchedListener.eventsList.size() + 1);

    Ooaofooa.getDefaultInstance().removeModelChangeListener(instantListener);
    Ooaofooa.getDefaultInstance().removeModelChangeListener(batchedListener);
  }
 public void testNewInterfaceEditorExistingFolder() throws CoreException {
   // create existing folder first
   ResourcesPlugin.getWorkspace()
       .getRoot()
       .getFolder(new Path(testPackage.getFile().getParent().getFullPath() + "/" + getName()))
       .create(true, true, new NullProgressMonitor());
   BaseTest.dispatchEvents(0);
   doGraphicalCreationTest("Components::Interface", EXISTING_FOLDER_ERROR, getName());
 }
  public void doTestCreateModelElement() throws Exception {
    ActionTestGenerics test = new ActionTestGenerics();
    test.setUp();
    modelRoot = BaseTest.getDefaultTestInstance();
    Ooaofooa.getDefaultInstance().addModelChangeListener(instantListener);
    Ooaofooa.getDefaultInstance().addModelChangeListener(batchedListener);
    Ooaofgraphics c = Ooaofgraphics.getInstance(modelRoot.getId());
    c.addModelChangeListener(instantListener);
    c.addModelChangeListener(batchedListener);
    try {
      // Test add Instance State Machine
      // Must turn off ConsistencyTransactionListener - the test will check the
      // consistency of the relevant individual components
      Ooaofooa.setConsistencyEnabled(false);
      test.testNewO_OBJInstanceStateMachine();
      // Turn consistency checking back on.
      Ooaofooa.setConsistencyEnabled(true);

      Display d = Display.getDefault();
      while (d.readAndDispatch()) {}

    } catch (Exception e) {
      fail("Test creation of model Element Failed: " + e.toString()); // $NON-NLS-1$
    }

    // Comparing Events
    assertTrue(
        "No events heard by instant listener",
        instantListener.eventsList.size() > 0); // $NON-NLS-1$
    assertTrue(
        "No events heard by batched listener",
        batchedListener.eventsList.size() > 0); // $NON-NLS-1$
    // the number of events will be different by one
    // this is due to the fact that deltas that affect
    // the same element's name are not collected only the
    // first delta found is updated.  This test collects
    // events that were fired, in the case of an instant
    // listener the update needs to be fired, for a batched
    // listener it does not.
    assertEquals(
        "Number of Events in the instant Listener: "
            + instantListener.eventsList.size()
            + " is not same as in batched listener: "
            + batchedListener.eventsList.size(),
        instantListener.eventsList.size() - 1,
        batchedListener.eventsList.size()); // $NON-NLS-1$//$NON-NLS-2$

    // the events should be in a different order, the instant listener updates Model_c.OOA_ID
    // at a different time that the batch listener
    assertFalse(
        "Batched events are in same order as instance events",
        instantListener.eventsList.equals(batchedListener.eventsList)); // $NON-NLS-1$//$NON-NLS-2$

    Ooaofooa.getDefaultInstance().removeModelChangeListener(instantListener);
    Ooaofooa.getDefaultInstance().removeModelChangeListener(batchedListener);
  }
 /* (non-Javadoc)
  * @see junit.framework.TestCase#tearDown()
  */
 protected void tearDown() throws Exception {
   try {
     super.tearDown();
     OalParserTest_Generics.tearDownActionData();
   } catch (RecognitionException re) {
     // do nothing
   } catch (TokenStreamException te) {
     // do nothing
   }
 }
 public void testNewInterfaceCMEExistingFolder() throws CoreException {
   // create existing folder first
   ResourcesPlugin.getWorkspace()
       .getRoot()
       .getFolder(new Path(testPackage.getFile().getParent().getFullPath() + "/" + getName()))
       .create(true, true, new NullProgressMonitor());
   BaseTest.dispatchEvents(0);
   String expectedError = EXISTING_FOLDER_ERROR;
   if (!Platform.getOS().contains("win")) {
     expectedError = expectedError.replace("\r", "");
   }
   doNewCMETest("Components::Interface", expectedError, getName());
 }
 public void testRenameInterfaceExistingFolder() throws CoreException {
   // create existing folder first
   ResourcesPlugin.getWorkspace()
       .getRoot()
       .getFolder(new Path(testPackage.getFile().getParent().getFullPath() + "/" + getName()))
       .create(true, true, new NullProgressMonitor());
   BaseTest.dispatchEvents(0);
   createElement("Newinterface", testPackage);
   Interface_c[] is =
       Interface_c.getManyC_IsOnR8001(PackageableElement_c.getManyPE_PEsOnR8000(testPackage));
   Interface_c i = is[is.length - 1];
   UITestingUtilities.addElementToGraphicalSelection(i);
   doRenameTest(EXISTING_FOLDER_ERROR, getName());
 }
 public void testRenameClassExistingFolder() throws CoreException {
   // create existing folder first
   ResourcesPlugin.getWorkspace()
       .getRoot()
       .getFolder(new Path(testPackage.getFile().getParent().getFullPath() + "/" + getName()))
       .create(true, true, new NullProgressMonitor());
   BaseTest.dispatchEvents(0);
   createElement("Newclass", testPackage);
   ModelClass_c[] objs =
       ModelClass_c.getManyO_OBJsOnR8001(PackageableElement_c.getManyPE_PEsOnR8000(testPackage));
   ModelClass_c obj = objs[objs.length - 1];
   UITestingUtilities.addElementToGraphicalSelection(obj);
   doRenameTest(EXISTING_FOLDER_ERROR, getName());
 }
 private void configureRGOReference(NonRootModelElement rgo, NonRootModelElement rto) {
   TransactionManager manager = TransactionManager.getSingleton();
   Transaction transaction = null;
   String association = ElementMap.getAssociationFor(getMethodName().replaceAll("test", ""));
   NonRootModelElement newRto =
       getElement(getMethodName().replaceAll("test", ""), rto.getClass(), true);
   try {
     transaction =
         manager.startTransaction("Adjust RGO", new Ooaofooa[] {Ooaofooa.getDefaultInstance()});
     if (rgo instanceof ProvidedExecutableProperty_c) {
       // need to reassign the provision
       Interface_c iface = Interface_c.getOneC_IOnR4003((ExecutableProperty_c) newRto);
       Provision_c provision = Provision_c.getOneC_POnR4501((ProvidedExecutableProperty_c) rgo);
       provision.Unformalize(false);
       provision.Formalize(iface.getId(), false);
       this.rgo = ProvidedExecutableProperty_c.getOneSPR_PEPOnR4501(provision);
     } else if (rgo instanceof RequiredExecutableProperty_c) {
       // need to reassign the requirement
       Interface_c iface = Interface_c.getOneC_IOnR4003((ExecutableProperty_c) newRto);
       Requirement_c requirement =
           Requirement_c.getOneC_ROnR4500((RequiredExecutableProperty_c) rgo);
       requirement.Unformalize(false);
       requirement.Formalize(iface.getId(), false);
       // need to reset the RGO
       this.rgo = RequiredExecutableProperty_c.getOneSPR_REPOnR4500(requirement);
     } else {
       Method getMethod = getAccessorMethod(rgo, rto);
       NonRootModelElement existing =
           (NonRootModelElement) getMethod.invoke(rto, new Object[] {rgo});
       Method method = getUnrelateMethod(association, existing, rgo);
       method.invoke(existing, new Object[] {rgo});
       method = getRelateMethod(association, newRto, rgo);
       method.invoke(newRto, new Object[] {rgo});
     }
   } catch (Exception e) {
     fail(e.getMessage());
     if (transaction != null) {
       manager.cancelTransaction(transaction);
     }
   } finally {
     if (transaction != null) {
       manager.endTransaction(transaction);
       rgoUpdateSuccessful = true;
     }
   }
   BaseTest.dispatchEvents(0);
 }
  /* (non-Javadoc)
   * @see junit.framework.TestCase#setUp()
   */
  protected void setUp() throws Exception {
    super.setUp();

    if (!firstSetup) {

      String modelName = "testOAL1";

      TestingUtilities.importTestingProjectIntoWorkspace("testOAL1");

      project = ResourcesPlugin.getWorkspace().getRoot().getProject("testOAL1");
      m_sys = getSystemModel(project.getName());

      String modelRootId = Ooaofooa.createModelRootId(project, modelName, true);
      modelRoot = Ooaofooa.getInstance(modelRootId, true);
    }

    firstSetup = true;

    populateFunctionInstances();
    populateBridgeInstances();
    class Object_test1_c implements ClassQueryInterface_c {
      Object_test1_c(String id) {
        m_id = id;
      }

      private String m_id;

      public boolean evaluate(Object inst) {
        ModelClass_c selected = (ModelClass_c) inst;
        return selected.getKey_lett().equals(m_id);
      }
    }
    ModelClass_c diskObj =
        ModelClass_c.ModelClassInstance(modelRoot, new Object_test1_c("D_D")); // $NON-NLS-1$
    ModelClass_c libObj =
        ModelClass_c.ModelClassInstance(modelRoot, new Object_test1_c("D_H")); // $NON-NLS-1$
    populateTransformerInstances(diskObj, false);
    populateTransformerInstances(libObj, true);
    populateStateActionInstances();
    populateMDAInstances();
  }
 private void createElement(String creationMethod, Object container) {
   // new a test Model Class
   Transaction transaction = null;
   try {
     transaction =
         TransactionManager.getSingleton()
             .startTransaction(
                 "Create test element.",
                 new ModelElement[] {
                   Ooaofooa.getDefaultInstance(), Ooaofgraphics.getDefaultInstance()
                 });
     Method method = Cl_c.findMethod(container, creationMethod, new Class<?>[0]);
     Cl_c.doMethod(method, container, new Object[0]);
     TransactionManager.getSingleton().endTransaction(transaction);
   } catch (TransactionException e) {
     if (transaction != null) {
       TransactionManager.getSingleton().cancelTransaction(transaction, e);
     }
   }
   // allow reconciler to kick in
   BaseTest.dispatchEvents(0);
 }
public class OalParserTest_Generics extends BaseTest {

  private static boolean m_requiresClear = false;
  private static int m_funcType = 0;
  private static int m_funcNum = 0;
  private static boolean firstSetup = false;
  public static Ooaofooa modelRoot = BaseTest.getDefaultTestInstance();

  public OalParserTest_Generics(String arg0) {
    super(null, arg0);
  }

  /* (non-Javadoc)
   * @see junit.framework.TestCase#setUp()
   */
  protected void setUp() throws Exception {
    super.setUp();

    if (!firstSetup) {

      String modelName = "testOAL1";

      TestingUtilities.importTestingProjectIntoWorkspace("testOAL1");

      project = ResourcesPlugin.getWorkspace().getRoot().getProject("testOAL1");
      m_sys = getSystemModel(project.getName());

      String modelRootId = Ooaofooa.createModelRootId(project, modelName, true);
      modelRoot = Ooaofooa.getInstance(modelRootId, true);
    }

    firstSetup = true;

    populateFunctionInstances();
    populateBridgeInstances();
    class Object_test1_c implements ClassQueryInterface_c {
      Object_test1_c(String id) {
        m_id = id;
      }

      private String m_id;

      public boolean evaluate(Object inst) {
        ModelClass_c selected = (ModelClass_c) inst;
        return selected.getKey_lett().equals(m_id);
      }
    }
    ModelClass_c diskObj =
        ModelClass_c.ModelClassInstance(modelRoot, new Object_test1_c("D_D")); // $NON-NLS-1$
    ModelClass_c libObj =
        ModelClass_c.ModelClassInstance(modelRoot, new Object_test1_c("D_H")); // $NON-NLS-1$
    populateTransformerInstances(diskObj, false);
    populateTransformerInstances(libObj, true);
    populateStateActionInstances();
    populateMDAInstances();
  }

  /* (non-Javadoc)
   * @see junit.framework.TestCase#tearDown()
   */
  protected void tearDown() throws Exception {
    try {
      super.tearDown();
      OalParserTest_Generics.tearDownActionData();
    } catch (RecognitionException re) {
      // do nothing
    } catch (TokenStreamException te) {
      // do nothing
    }
  }

  public void testAttributeWriteIssue176_3() throws RecognitionException, TokenStreamException {
    // this test must be first, so that the id assigner values are correct
    String x =
        parseAction(
            "create object instance d1 of D_D; \nx = 5 + 1; d1.Disk_ID = 2;",
            ACTIVITY_TYPE_FUNC,
            TEST_VOID_NO_PARM); //$NON-NLS-1$
    assertEquals("", x); // $NON-NLS-1$
  }

  public void testEmptyAction() throws RecognitionException, TokenStreamException {
    String x = parseAction("", ACTIVITY_TYPE_FUNC, TEST_VOID_NO_PARM); // $NON-NLS-1$
    assertEquals("", x); // $NON-NLS-1$
    validateBlkStmtVal(1, 0, 0);
    clearActionData(ACTIVITY_TYPE_FUNC, TEST_VOID_NO_PARM);
  }

  public void testParseMDA() throws RecognitionException, TokenStreamException {
    String act = "self.test_mda = 1;"; // $NON-NLS-1$
    String x = parseAction(act, ACTIVITY_TYPE_MDA, TEST_MDA);
    assertEquals("", x);
    validateBlkStmtVal(1, 1, 3);
    Variable_c[] vars = Variable_c.VariableInstances(modelRoot);
    assertEquals(1, vars.length);
  }

  public void testParseMDAReturn() throws RecognitionException, TokenStreamException {
    String act = "self.test_mda = 1; return;"; // $NON-NLS-1$
    String x = parseAction(act, ACTIVITY_TYPE_MDA, TEST_MDA);
    assertEquals("", x);
    validateBlkStmtVal(1, 2, 3);
    Variable_c[] vars = Variable_c.VariableInstances(modelRoot);
    assertEquals(1, vars.length);
  }

  public void testParseMDAWrongAttr() throws RecognitionException, TokenStreamException {
    String act = "self.test_mda = 1;  self.test_mda2 = 2;"; // $NON-NLS-1$
    String x = parseAction(act, ACTIVITY_TYPE_MDA, TEST_MDA);
    String lines[] = x.split("\n"); // $NON-NLS-1$
    assertEquals(2, lines.length);
    assertEquals(
        ":1:38-38: Cannot assign to a derived attribute ->test_mda2<-", lines[0]); // $NON-NLS-1$
    assertEquals("line 1:40: expecting Semicolon, found 'null'", lines[1]); // $NON-NLS-1$
    validateBlkStmtVal(1, 1, 5);
    Variable_c[] vars = Variable_c.VariableInstances(modelRoot);
    assertEquals(1, vars.length);
  }

  public void testMDANotAssigned() throws RecognitionException, TokenStreamException {
    String act = "x = 1;"; // $NON-NLS-1$
    String x = parseAction(act, ACTIVITY_TYPE_MDA, TEST_MDA);
    String lines[] = x.split("\n"); // $NON-NLS-1$
    assertEquals(1, lines.length);
    assertEquals(
        ":1:7-7: You must assign a value to the derived attribute self.test_mda",
        lines[0]); // $NON-NLS-1$
    validateBlkStmtVal(1, 1, 2);
    Variable_c[] vars = Variable_c.VariableInstances(modelRoot);
    assertEquals(1, vars.length);
  }

  public void testParseMDAReturnValue() throws RecognitionException, TokenStreamException {
    String act = "self.test_mda = 1; return 5;"; // $NON-NLS-1$
    String x = parseAction(act, ACTIVITY_TYPE_MDA, TEST_MDA);
    String lines[] = x.split("\n"); // $NON-NLS-1$
    assertEquals(2, lines.length);
    assertEquals(
        ":1:27-27: Return value not required by derived attribute", lines[0]); // $NON-NLS-1$
    assertEquals("line 1:29: expecting Semicolon, found 'null'", lines[1]); // $NON-NLS-1$
    validateBlkStmtVal(1, 1, 3);
    Variable_c[] vars = Variable_c.VariableInstances(modelRoot);
    assertEquals(1, vars.length);
    clearActionData(ACTIVITY_TYPE_MDA, TEST_MDA);
  }

  public void testAssignUnparsedMDA() throws RecognitionException, TokenStreamException {
    String act = "select any t from instances of D_TST; t.unparsed_mda = 3;"; // $NON-NLS-1$
    String x = parseAction(act, ACTIVITY_TYPE_FUNC, TEST_VOID_NO_PARM);
    assertEquals("", x); // $NON-NLS-1$
    validateBlkStmtVal(1, 2, 3);
    Variable_c[] vars = Variable_c.VariableInstances(modelRoot);
    assertEquals(1, vars.length);
    clearActionData(ACTIVITY_TYPE_FUNC, TEST_VOID_NO_PARM);
  }

  public void testDebugStatements() throws RecognitionException, TokenStreamException {
    String act =
        "_debug _on; _debug _off; _debug _stat; _debug _dump _off; _debug _dump _on; _debug _trace _off; _debug _trace _on; _debug _sor _off; _debug _sor _on;"; //$NON-NLS-1$
    String x = parseAction(act, ACTIVITY_TYPE_FUNC, TEST_VOID_NO_PARM);
    assertEquals("", x); // $NON-NLS-1$
    validateBlkStmtVal(1, 0, 0);
    Variable_c[] vars = Variable_c.VariableInstances(modelRoot);
    assertEquals(0, vars.length);
  }

  static final int ACTIVITY_TYPE_FUNC = 0;
  static final int ACTIVITY_TYPE_BRG = 1;
  static final int ACTIVITY_TYPE_CB_OP = 2;
  static final int ACTIVITY_TYPE_IB_OP = 3;
  static final int ACTIVITY_TYPE_MDA = 4;
  static final int ACTIVITY_TYPE_STATE = 5;
  static final int ACTIVITY_TYPE_TRANSITION = 6;

  public static String parseAction(String stmts, int funcType, int funcNum) {
    m_requiresClear = true;
    m_funcType = funcType;
    m_funcNum = funcNum;
    OalLexer lexer = new OalLexer(new StringReader(stmts));
    OalParser parser = new OalParser(modelRoot, lexer);
    try {
      switch (funcType) {
        case ACTIVITY_TYPE_FUNC:
          parser.m_oal_context = new Oal_validate(ContainerUtil.getContainer(m_testFunc[funcNum]));
          m_testFunc[funcNum].setAction_semantics_internal(stmts);
          parser.action(m_testFunc[funcNum].getSync_id(), Oalconstants_c.FUNCTION_TYPE);
          break;
        case ACTIVITY_TYPE_BRG:
          parser.m_oal_context = new Oal_validate(ContainerUtil.getContainer(m_testBrg[funcNum]));
          m_testBrg[funcNum].setAction_semantics_internal(stmts);
          parser.action(m_testBrg[funcNum].getBrg_id(), Oalconstants_c.BRIDGE_TYPE);
          break;
        case ACTIVITY_TYPE_CB_OP:
          parser.m_oal_context = new Oal_validate(ContainerUtil.getContainer(m_testCBTfr[funcNum]));
          m_testCBTfr[funcNum].setAction_semantics_internal(stmts);
          parser.action(m_testCBTfr[funcNum].getTfr_id(), Oalconstants_c.OPERATION_TYPE);
          break;
        case ACTIVITY_TYPE_IB_OP:
          parser.m_oal_context = new Oal_validate(ContainerUtil.getContainer(m_testIBTfr[funcNum]));
          m_testIBTfr[funcNum].setAction_semantics_internal(stmts);
          parser.action(m_testIBTfr[funcNum].getTfr_id(), Oalconstants_c.OPERATION_TYPE);
          break;
        case ACTIVITY_TYPE_MDA:
          parser.m_oal_context = new Oal_validate(ContainerUtil.getContainer(m_testMDA[funcNum]));
          m_testMDA[funcNum].setAction_semantics_internal(stmts);
          parser.action(m_testMDA[funcNum].getAttr_id(), Oalconstants_c.MDA_TYPE);
          break;
        case ACTIVITY_TYPE_STATE:
          parser.m_oal_context =
              new Oal_validate(ContainerUtil.getContainer(m_testAction[funcNum]));
          TransitionActionBody_c tab =
              TransitionActionBody_c.getOneACT_TABOnR688(m_testAction[funcNum]);
          if (tab != null) {
            Body_c body = Body_c.getOneACT_ACTOnR698(tab);
            body.Dispose();
          }
          m_testAction[funcNum].setAction_semantics_internal(stmts);
          parser.action(m_testAction[funcNum].getAct_id(), Oalconstants_c.STATE_TYPE);
          break;
        case ACTIVITY_TYPE_TRANSITION:
          parser.m_oal_context =
              new Oal_validate(ContainerUtil.getContainer(m_testAction[funcNum]));
          // This test action can have both forms of Action body associated
          StateActionBody_c sab = StateActionBody_c.getOneACT_SABOnR691(m_testAction[funcNum]);
          if (sab != null) {
            Body_c body = Body_c.getOneACT_ACTOnR698(sab);
            body.Dispose();
          }
          m_testAction[funcNum].setAction_semantics_internal(stmts);
          parser.action(m_testAction[funcNum].getAct_id(), Oalconstants_c.TRANSITION_TYPE);
          break;
        default:
          fail("parseAction: Unknown Activity type constant");
      }
    } catch (TokenStreamException e) {
      Block_c.Clearcurrentscope(modelRoot, parser.m_oal_context.m_act_id);
      if (e instanceof TokenStreamRecognitionException) {
        TokenStreamRecognitionException tsre = (TokenStreamRecognitionException) e;
        parser.reportError(tsre.recog);
      } else {
        fail("Token stream exception in parser");
      }
    } catch (RecognitionException e) {
      Block_c.Clearcurrentscope(modelRoot, parser.m_oal_context.m_act_id);
      parser.reportError(e);
    } catch (InterruptedException ie) {
    }
    return parser.m_output;
  }

  public static void clearActionData(int funcType, int funcNum)
      throws RecognitionException, TokenStreamException {
    switch (funcType) {
      case ACTIVITY_TYPE_FUNC:
        Body_c actact =
            Body_c.getOneACT_ACTOnR698(FunctionBody_c.getOneACT_FNBOnR695(m_testFunc[funcNum]));
        if (actact != null) {
          actact.Clear_blocks();
        }
        break;
      case ACTIVITY_TYPE_BRG:
        actact = Body_c.getOneACT_ACTOnR698(BridgeBody_c.getOneACT_BRBOnR697(m_testBrg[funcNum]));
        if (actact != null) {
          actact.Clear_blocks();
        }
        break;
      case ACTIVITY_TYPE_CB_OP:
        actact =
            Body_c.getOneACT_ACTOnR698(OperationBody_c.getOneACT_OPBOnR696(m_testCBTfr[funcNum]));
        if (actact != null) {
          actact.Clear_blocks();
        }
        break;
      case ACTIVITY_TYPE_IB_OP:
        actact =
            Body_c.getOneACT_ACTOnR698(OperationBody_c.getOneACT_OPBOnR696(m_testIBTfr[funcNum]));
        if (actact != null) {
          actact.Clear_blocks();
        }
        break;
      case ACTIVITY_TYPE_MDA:
        actact =
            Body_c.getOneACT_ACTOnR698(
                DerivedAttributeBody_c.getOneACT_DABOnR693(m_testMDA[funcNum]));
        if (actact != null) {
          actact.Clear_blocks();
        }
        break;
      case ACTIVITY_TYPE_STATE:
        actact =
            Body_c.getOneACT_ACTOnR698(
                StateActionBody_c.getOneACT_SABOnR691(m_testAction[funcNum]));
        if (actact != null) {
          actact.Clear_blocks();
        }
        break;
      case ACTIVITY_TYPE_TRANSITION:
        actact =
            Body_c.getOneACT_ACTOnR698(
                TransitionActionBody_c.getOneACT_TABOnR688(m_testAction[funcNum]));
        if (actact != null) {
          actact.Clear_blocks();
        }
        break;
      default:
        fail("clearAction: Unknown Activity type constant");
    }
    m_requiresClear = false;
  }

  public static void tearDownActionData() throws RecognitionException, TokenStreamException {
    if (m_requiresClear) {
      clearActionData(m_funcType, m_funcNum);
    }
  }

  public static void verifyBinaryOperation(
      BinaryOperation_c bin, String op, UUID left, UUID right) {
    assertEquals(bin.getOperator(), op);
    assertEquals(bin.getLeft_value_id(), left);
    assertEquals(bin.getRight_value_id(), right);
  }

  public static void verifyUnaryOperation(UnaryOperation_c u, String op, UUID operand) {
    assertEquals(op, u.getOperator());
    assertEquals(operand, u.getOperand_value_id());
  }

  public static void validateBlkStmtVal(int numBlock, int numStmt, int numVal) {
    FunctionBody_c[] fb = FunctionBody_c.FunctionBodyInstances(modelRoot);
    BridgeBody_c[] bb = BridgeBody_c.BridgeBodyInstances(modelRoot);
    OperationBody_c[] ob = OperationBody_c.OperationBodyInstances(modelRoot);
    StateActionBody_c[] sab = StateActionBody_c.StateActionBodyInstances(modelRoot);
    DerivedAttributeBody_c[] dab = DerivedAttributeBody_c.DerivedAttributeBodyInstances(modelRoot);
    TransitionActionBody_c[] tab = TransitionActionBody_c.TransitionActionBodyInstances(modelRoot);
    Body_c b[] = Body_c.BodyInstances(modelRoot);
    assertEquals(
        b.length, fb.length + bb.length + ob.length + sab.length + dab.length + tab.length);
    Block_c[] blk = Block_c.BlockInstances(modelRoot);
    assertEquals(numBlock, blk.length);
    Body_c[] bods = Body_c.BodyInstances(modelRoot);
    for (int i = 0; i < bods.length; ++i)
      assertEquals(IdAssigner.NULL_UUID, bods[i].getCurrentscope_id());
    Statement_c[] st = Statement_c.StatementInstances(modelRoot);
    assertEquals(numStmt, st.length);
    Value_c[] val = Value_c.ValueInstances(modelRoot);
    assertEquals(numVal, val.length);
  }

  public static void badRelationshipValidate(String[] vars, int numStmt, int numSel, int numVal)
      throws RecognitionException, TokenStreamException {
    Block_c[] blk = Block_c.BlockInstances(modelRoot);
    assertEquals(1, blk.length);
    Statement_c[] st = Statement_c.StatementInstances(modelRoot);
    assertEquals(numStmt, st.length);
    for (int i = 0; i < numStmt; ++i) assertEquals(blk[0].getBlock_id(), st[i].getBlock_id());
    Variable_c[] t = Variable_c.VariableInstances(modelRoot);
    assertEquals(vars.length, t.length);
    for (int i = 0; i < vars.length; ++i) assertEquals(vars[i], t[i].getName());
    Relate_c rel[] = Relate_c.RelateInstances(modelRoot);
    assertEquals(0, rel.length);
    RelateUsing_c ru[] = RelateUsing_c.RelateUsingInstances(modelRoot);
    assertEquals(0, ru.length);
    SelectFromInstances_c sel[] = SelectFromInstances_c.SelectFromInstancesInstances(modelRoot);
    assertEquals(numSel, sel.length);
    Value_c[] val = Value_c.ValueInstances(modelRoot);
    assertEquals(numVal, val.length);
  }

  public static final int TEST_VOID_NO_PARM = 0;
  public static final int TEST_INT_NO_PARM = 1;
  public static final int TEST_REAL_NO_PARM = 2;
  public static final int TEST_STRING_NO_PARM = 3;
  public static final int TEST1 = 4;
  public static final int TEST2 = 5;
  public static final int TEST3 = 6;
  public static final int TEST4 = 7;
  public static final int TEST5 = 8;
  public static final int TEST6 = 9;
  public static final int TEST7 = 10;
  public static final int MULT_FUNC1 = 11;
  public static final int MULT_FUNC2 = 12;
  public static final int MULT_PARMS = 13;
  public static final int PARAM_VAL = 14;
  public static final int PARAM_REF = 15;
  public static final int PARAM_VAL_VAL = 16;
  public static final int PARAM_VAL_REF = 17;
  public static final int PARAM_REF_REF = 18;
  public static final int _TEST = 19;
  public static final int _TEST_REF = 20;
  private static String funcs[] = {
    "testVoidNoParm", //$NON-NLS-1$
    "testIntNoParm", //$NON-NLS-1$
    "testRealNoParm", //$NON-NLS-1$
    "testStringNoParm", //$NON-NLS-1$
    "test1", //$NON-NLS-1$
    "test2", //$NON-NLS-1$
    "test3", //$NON-NLS-1$
    "test4", //$NON-NLS-1$
    "test5", //$NON-NLS-1$
    "test6", //$NON-NLS-1$
    "test7", //$NON-NLS-1$
    "mult_func1", //$NON-NLS-1$
    "mult_func2", //$NON-NLS-1$
    "mult_parms", //$NON-NLS-1$
    "paramVal", //$NON-NLS-1$
    "paramRef", //$NON-NLS-1$
    "paramValVal", //$NON-NLS-1$
    "paramValRef", //$NON-NLS-1$
    "paramRefRef", //$NON-NLS-1$
    "_test", //$NON-NLS-1$
    "_testRef"
  }; //$NON-NLS-1$
  public static Function_c[] m_testFunc = new Function_c[funcs.length];
  public static Bridge_c[] m_testBrg = new Bridge_c[funcs.length];
  public static Operation_c[] m_testCBTfr = new Operation_c[funcs.length];
  public static Operation_c[] m_testIBTfr = new Operation_c[funcs.length];

  private void populateFunctionInstances() {
    class Function_test1_c implements ClassQueryInterface_c {
      Function_test1_c(String p) {
        m_p = p;
      }

      private String m_p;

      public boolean evaluate(Object inst) {
        Function_c selected = (Function_c) inst;
        return selected.getName().equals(m_p);
      }
    }
    for (int i = 0; i < funcs.length; ++i) {
      Function_c testFunc = Function_c.FunctionInstance(modelRoot, new Function_test1_c(funcs[i]));
      if (testFunc != null) {
        if (m_testFunc[i] == null) m_testFunc[i] = testFunc;
      } else fail("Missing function " + funcs[i]); // $NON-NLS-1$
    }
  }

  private void populateBridgeInstances() {
    class EE_test1_c implements ClassQueryInterface_c {
      EE_test1_c(String p) {
        m_p = p;
      }

      private String m_p;

      public boolean evaluate(Object inst) {
        ExternalEntity_c selected = (ExternalEntity_c) inst;
        return selected.getKey_lett().equals(m_p);
      }
    }
    ExternalEntity_c testEE =
        ExternalEntity_c.ExternalEntityInstance(modelRoot, new EE_test1_c("T")); // $NON-NLS-1$
    if (testEE == null) fail("Unknown external entity T"); // $NON-NLS-1$
    class Bridge_test1_c implements ClassQueryInterface_c {
      Bridge_test1_c(String p) {
        m_p = p;
      }

      private String m_p;

      public boolean evaluate(Object inst) {
        Bridge_c selected = (Bridge_c) inst;
        return selected.getName().equals(m_p);
      }
    }
    for (int i = 0; i < funcs.length; ++i) {
      Bridge_c testFunc = Bridge_c.BridgeInstance(modelRoot, new Bridge_test1_c(funcs[i]));
      if (testFunc != null) {
        if (m_testBrg[i] == null) m_testBrg[i] = testFunc;
      } else fail("Missing bridge " + funcs[i]); // $NON-NLS-1$
    }
  }

  private void populateTransformerInstances(ModelClass_c testObj, boolean instanceBased) {
    for (int i = 0; i < funcs.length; ++i) {
      Operation_c[] testObjTrans = Operation_c.getManyO_TFRsOnR115(testObj);
      Operation_c testTrans = null;
      for (int tfrInstCount = 0; tfrInstCount < testObjTrans.length; tfrInstCount++) {
        Operation_c selected = testObjTrans[tfrInstCount];
        if (selected.getName().equals(funcs[i])) {
          testTrans = testObjTrans[tfrInstCount];
          break;
        }
      }
      if (testTrans != null) {
        if (instanceBased) {
          if (m_testIBTfr[i] == null) m_testIBTfr[i] = testTrans;
        } else {
          if (m_testCBTfr[i] == null) m_testCBTfr[i] = testTrans;
        }
      } else
        fail(
            "Missing operation "
                + testObj.getKey_lett()
                + "::"
                + funcs[i]); // $NON-NLS-1$//$NON-NLS-2$
    }
  }

  public static final int TEST_MDA = 0;
  public static final int TEST_MDA2 = 1;
  public static final int UNPARSED_MDA = 2;
  private static String mda_names[] = {
    "test_mda", //$NON-NLS-1$
    "test_mda2", //$NON-NLS-1$
    "unparsed_mda", //$NON-NLS-1$
  };
  public static DerivedBaseAttribute_c[] m_testMDA = new DerivedBaseAttribute_c[mda_names.length];

  private void populateMDAInstances() {
    class MDA_test1_c implements ClassQueryInterface_c {
      MDA_test1_c(String p) {
        m_p = p;
      }

      private String m_p;

      public boolean evaluate(Object inst) {
        DerivedBaseAttribute_c selected = (DerivedBaseAttribute_c) inst;
        Attribute_c mdattr =
            Attribute_c.getOneO_ATTROnR106(BaseAttribute_c.getOneO_BATTROnR107(selected));
        return mdattr.getName().equals(m_p);
      }
    }
    for (int i = 0; i < mda_names.length; ++i) {
      DerivedBaseAttribute_c testMDA =
          DerivedBaseAttribute_c.DerivedBaseAttributeInstance(
              modelRoot, new MDA_test1_c(mda_names[i]));
      if (testMDA != null) {
        if (m_testMDA[i] == null) m_testMDA[i] = testMDA;
      } else fail("Missing MDA " + mda_names[i]); // $NON-NLS-1$
    }
  }

  public static final int STATE_ISM_NONE = 0;
  public static final int STATE_ISM_ONE = 1;
  public static final int STATE_ISM_TWO = 2;
  public static final int STATE_ISM_THREE = 3;
  public static final int STATE_ASM_ONE = 4;
  public static final int STATE_ASM_TWO = 5;
  public static final int STATE_ASM_THREE = 6;
  public static final int STATE_ISM_POLYTWO = 7;
  public static final int STATE_ISM_POLYORPHANED = 8;
  public static final int TRANS_ISM_NONE = 9;
  public static final int TRANS_ISM_ONE = 10;
  public static final int TRANS_ISM_TWO = 11;
  public static final int TRANS_ISM_THREE = 12;
  public static final int TRANS_CREATION_ISM_NONE = 13;
  public static final int TRANS_CREATION_ISM_ONE = 14;
  public static final int TRANS_CREATION_ISM_TWO = 15;
  public static final int TRANS_CREATION_ISM_THREE = 16;
  public static final int TRANS_CSM_NONE = 17;
  public static final int TRANS_CSM_ONE = 18;
  public static final int TRANS_CSM_TWO = 19;
  public static final int TRANS_CSM_THREE = 20;
  public static final int TRANS_ISM_POLYTWO = 21;
  public static final int TRANS_ISM_POLYORPHANED = 22;
  public static final int STATE_ISM_SDTTest = 23;
  public static final int TRANS_CREATION_ISM_SDTTest = 24;
  public static final int TRANS_ISM_SDTTest = 25;
  public static final int STATE_ASM_SDTTest = 26;
  public static final int TRANS_CSM_SDTTest = 27;
  public static final int STATE_ISM_SDTMultLvlTest = 28;
  public static final int TRANS_CREATION_ISM_SDTMultLvlTest = 29;
  public static final int TRANS_ISM_SDTMultLvlTest = 30;
  public static final int STATE_ASM_SDTMultLvlTest = 31;
  public static final int TRANS_CSM_SDTMultLvlTest = 32;

  public static Action_c[] m_testAction = new Action_c[33];

  private void populateStateActionInstances() {
    class Object_test1_c implements ClassQueryInterface_c {
      Object_test1_c(String p) {
        m_p = p;
      }

      private String m_p;

      public boolean evaluate(Object inst) {
        ModelClass_c selected = (ModelClass_c) inst;
        return selected.getName().equals(m_p);
      }
    }
    ModelClass_c obj =
        ModelClass_c.ModelClassInstance(modelRoot, new Object_test1_c("Test")); // $NON-NLS-1$
    InstanceStateMachine_c ism = InstanceStateMachine_c.getOneSM_ISMOnR518(obj);
    StateMachine_c sm_i = StateMachine_c.getOneSM_SMOnR517(ism);
    StateMachineState_c[] states = StateMachineState_c.getManySM_STATEsOnR501(sm_i);
    Action_c i_acts[] =
        Action_c.getManySM_ACTsOnR514(
            ActionHome_c.getManySM_AHsOnR513(MooreActionHome_c.getManySM_MOAHsOnR511(states)));
    for (int i = 0; i < i_acts.length; ++i) {
      ActionHome_c ah = ActionHome_c.getOneSM_AHOnR514(i_acts[i]);
      MooreActionHome_c moah = MooreActionHome_c.getOneSM_MOAHOnR513(ah);
      StateMachineState_c st = StateMachineState_c.getOneSM_STATEOnR511(moah);
      if (st.getName().equals("none")) // $NON-NLS-1$
      m_testAction[STATE_ISM_NONE] = i_acts[i];
      else if (st.getName().equals("one")) // $NON-NLS-1$
      m_testAction[STATE_ISM_ONE] = i_acts[i];
      else if (st.getName().equals("two")) // $NON-NLS-1$
      m_testAction[STATE_ISM_TWO] = i_acts[i];
      else if (st.getName().equals("three")) // $NON-NLS-1$
      m_testAction[STATE_ISM_THREE] = i_acts[i];
      else if (st.getName().equals("SDTTest")) // $NON-NLS-1$
      m_testAction[STATE_ISM_SDTTest] = i_acts[i];
      else if (st.getName().equals("SDTMultLvlTest")) // $NON-NLS-1$
      m_testAction[STATE_ISM_SDTMultLvlTest] = i_acts[i];
    }

    NewStateTransition_c[] trans =
        NewStateTransition_c.getManySM_NSTXNsOnR507(Transition_c.getManySM_TXNsOnR505(sm_i));
    Action_c[] t_acts =
        Action_c.getManySM_ACTsOnR514(
            ActionHome_c.getManySM_AHsOnR513(
                TransitionActionHome_c.getManySM_TAHsOnR530(
                    Transition_c.getManySM_TXNsOnR507(trans))));
    for (int i = 0; i < t_acts.length; ++i) {
      ActionHome_c ah = ActionHome_c.getOneSM_AHOnR514(t_acts[i]);
      TransitionActionHome_c tah = TransitionActionHome_c.getOneSM_TAHOnR513(ah);
      Transition_c tran = Transition_c.getOneSM_TXNOnR530(tah);
      if (tran.Get_name().contains("none")) // $NON-NLS-1$
      m_testAction[TRANS_ISM_NONE] = t_acts[i];
      else if (tran.getName().contains("one")) // $NON-NLS-1$
      m_testAction[TRANS_ISM_ONE] = t_acts[i];
      else if (tran.getName().contains("two")) // $NON-NLS-1$
      m_testAction[TRANS_ISM_TWO] = t_acts[i];
      else if (tran.getName().contains("three")) // $NON-NLS-1$
      m_testAction[TRANS_ISM_THREE] = t_acts[i];
      else if (tran.getName().contains("SDTTest")) // $NON-NLS-1$
      m_testAction[TRANS_ISM_SDTTest] = t_acts[i];
      else if (tran.getName().contains("SDTMultLvlTest")) // $NON-NLS-1$
      m_testAction[TRANS_ISM_SDTMultLvlTest] = t_acts[i];
    }

    CreationTransition_c[] crtrs =
        CreationTransition_c.getManySM_CRTXNsOnR507(Transition_c.getManySM_TXNsOnR505(sm_i));
    Action_c[] crt_acts =
        Action_c.getManySM_ACTsOnR514(
            ActionHome_c.getManySM_AHsOnR513(
                TransitionActionHome_c.getManySM_TAHsOnR530(
                    Transition_c.getManySM_TXNsOnR507(crtrs))));
    for (int i = 0; i < crt_acts.length; ++i) {
      ActionHome_c ah = ActionHome_c.getOneSM_AHOnR514(crt_acts[i]);
      TransitionActionHome_c tah = TransitionActionHome_c.getOneSM_TAHOnR513(ah);
      Transition_c tran = Transition_c.getOneSM_TXNOnR530(tah);
      if (tran.Get_name().contains("none")) // $NON-NLS-1$
      m_testAction[TRANS_CREATION_ISM_NONE] = crt_acts[i];
      else if (tran.getName().contains("one")) // $NON-NLS-1$
      m_testAction[TRANS_CREATION_ISM_ONE] = crt_acts[i];
      else if (tran.getName().contains("two")) // $NON-NLS-1$
      m_testAction[TRANS_CREATION_ISM_TWO] = crt_acts[i];
      else if (tran.getName().contains("three")) // $NON-NLS-1$
      m_testAction[TRANS_CREATION_ISM_THREE] = crt_acts[i];
      else if (tran.getName().contains("SDTTest")) // $NON-NLS-1$
      m_testAction[TRANS_CREATION_ISM_SDTTest] = crt_acts[i];
      else if (tran.getName().contains("SDTMultLvlTest")) // $NON-NLS-1$
      m_testAction[TRANS_CREATION_ISM_SDTMultLvlTest] = crt_acts[i];
    }

    ClassStateMachine_c asm = ClassStateMachine_c.getOneSM_ASMOnR519(obj);
    StateMachine_c sm_a = StateMachine_c.getOneSM_SMOnR517(asm);
    states = StateMachineState_c.getManySM_STATEsOnR501(sm_a);
    Action_c a_acts[] =
        Action_c.getManySM_ACTsOnR514(
            ActionHome_c.getManySM_AHsOnR513(MooreActionHome_c.getManySM_MOAHsOnR511(states)));
    for (int i = 0; i < a_acts.length; ++i) {
      ActionHome_c ah = ActionHome_c.getOneSM_AHOnR514(a_acts[i]);
      MooreActionHome_c moah = MooreActionHome_c.getOneSM_MOAHOnR513(ah);
      if (moah != null) {
        StateMachineState_c st = StateMachineState_c.getOneSM_STATEOnR511(moah);
        if (st.getName().equals("one")) // $NON-NLS-1$
        m_testAction[STATE_ASM_ONE] = a_acts[i];
        else if (st.getName().equals("two")) // $NON-NLS-1$
        m_testAction[STATE_ASM_TWO] = a_acts[i];
        else if (st.getName().equals("three")) // $NON-NLS-1$
        m_testAction[STATE_ASM_THREE] = a_acts[i];
        else if (st.getName().equals("SDTTest")) // $NON-NLS-1$
        m_testAction[STATE_ASM_SDTTest] = a_acts[i];
        else if (st.getName().equals("SDTMultLvlTest")) // $NON-NLS-1$
        m_testAction[STATE_ASM_SDTMultLvlTest] = a_acts[i];
      }
    }
    trans = NewStateTransition_c.getManySM_NSTXNsOnR507(Transition_c.getManySM_TXNsOnR505(sm_a));
    t_acts =
        Action_c.getManySM_ACTsOnR514(
            ActionHome_c.getManySM_AHsOnR513(
                TransitionActionHome_c.getManySM_TAHsOnR530(
                    Transition_c.getManySM_TXNsOnR507(trans))));
    for (int i = 0; i < t_acts.length; ++i) {
      ActionHome_c ah = ActionHome_c.getOneSM_AHOnR514(t_acts[i]);
      TransitionActionHome_c tah = TransitionActionHome_c.getOneSM_TAHOnR513(ah);
      Transition_c tran = Transition_c.getOneSM_TXNOnR530(tah);
      if (tran.Get_name().contains("none")) // $NON-NLS-1$
      m_testAction[TRANS_CSM_NONE] = t_acts[i];
      else if (tran.getName().contains("one")) // $NON-NLS-1$
      m_testAction[TRANS_CSM_ONE] = t_acts[i];
      else if (tran.getName().contains("two")) // $NON-NLS-1$
      m_testAction[TRANS_CSM_TWO] = t_acts[i];
      else if (tran.getName().contains("three")) // $NON-NLS-1$
      m_testAction[TRANS_CSM_THREE] = t_acts[i];
      else if (tran.getName().contains("SDTTest")) // $NON-NLS-1$
      m_testAction[TRANS_CSM_SDTTest] = t_acts[i];
      else if (tran.getName().contains("SDTMultLvlTest")) // $NON-NLS-1$
      m_testAction[TRANS_CSM_SDTMultLvlTest] = t_acts[i];
    }

    obj =
        ModelClass_c.ModelClassInstance(modelRoot, new Object_test1_c("Test Poly")); // $NON-NLS-1$
    ism = InstanceStateMachine_c.getOneSM_ISMOnR518(obj);
    sm_i = StateMachine_c.getOneSM_SMOnR517(ism);

    i_acts = Action_c.getManySM_ACTsOnR515(sm_i);
    for (int i = 0; i < i_acts.length; ++i) {
      ActionHome_c ah = ActionHome_c.getOneSM_AHOnR514(i_acts[i]);
      MooreActionHome_c moah = MooreActionHome_c.getOneSM_MOAHOnR513(ah);
      if (moah != null) {
        StateMachineState_c st = StateMachineState_c.getOneSM_STATEOnR511(moah);
        if (st.getName().equals("PolyTwo")) // $NON-NLS-1$
        m_testAction[STATE_ISM_POLYTWO] = i_acts[i];
        else if (st.getName().equals("PolyOrphaned")) // $NON-NLS-1$
        m_testAction[STATE_ISM_POLYORPHANED] = i_acts[i];
      }
    }

    trans = NewStateTransition_c.getManySM_NSTXNsOnR507(Transition_c.getManySM_TXNsOnR505(sm_i));
    t_acts =
        Action_c.getManySM_ACTsOnR514(
            ActionHome_c.getManySM_AHsOnR513(
                TransitionActionHome_c.getManySM_TAHsOnR530(
                    Transition_c.getManySM_TXNsOnR507(trans))));
    for (int i = 0; i < t_acts.length; ++i) {
      ActionHome_c ah = ActionHome_c.getOneSM_AHOnR514(t_acts[i]);
      TransitionActionHome_c tah = TransitionActionHome_c.getOneSM_TAHOnR513(ah);
      Transition_c tran = Transition_c.getOneSM_TXNOnR530(tah);
      StateMachineState_c toState =
          StateMachineState_c.getOneSM_STATEOnR503(
              StateEventMatrixEntry_c.getManySM_SEMEsOnR504(
                  NewStateTransition_c.getManySM_NSTXNsOnR507(tran)));
      if (toState.getName().equals("PolyTwo")) // $NON-NLS-1$
      m_testAction[TRANS_ISM_POLYTWO] = t_acts[i];
      else if (toState.getName().equals("PolyOrphaned")) // $NON-NLS-1$
      m_testAction[TRANS_ISM_POLYORPHANED] = t_acts[i];
    }
  }
}