Ejemplo n.º 1
0
 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;
 }
Ejemplo n.º 2
0
  public static String parseAction(String stmts, int funcType, int funcNum)
      throws RecognitionException, TokenStreamException {
    // m_requiresClear = true;
    m_funcType = funcType;
    m_funcNum = funcNum;
    OalLexer lexer = new OalLexer(new StringReader(stmts));
    OalParser parser;
    parser = new OalParser(arrayModelRoot, 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_INT_RO:
          parser.m_oal_context =
              new Oal_validate(ContainerUtil.getContainer(m_testReqOpr[funcNum]));
          m_testReqOpr[funcNum].setAction_semantics_internal(stmts);
          parser.action(m_testReqOpr[funcNum].getId(), Oalconstants_c.REQ_OPERATION_TYPE);
          break;
        case ACTIVITY_TYPE_INT_PO:
          parser.m_oal_context =
              new Oal_validate(ContainerUtil.getContainer(m_testProvOpr[funcNum]));
          m_testProvOpr[funcNum].setAction_semantics_internal(stmts);
          parser.action(m_testProvOpr[funcNum].getId(), Oalconstants_c.PROV_OPERATION_TYPE);
          break;

        case ACTIVITY_TYPE_ArraySTATE:
          parser.m_oal_context =
              new Oal_validate(ContainerUtil.getContainer(m_arrayStateAction[funcNum]));
          TransitionActionBody_c tab2 =
              TransitionActionBody_c.getOneACT_TABOnR688(m_arrayStateAction[funcNum]);
          if (tab2 != null) {
            Body_c body = Body_c.getOneACT_ACTOnR698(tab2);
            body.Dispose();
          }
          m_arrayStateAction[funcNum].setAction_semantics_internal(stmts);
          parser.action(m_arrayStateAction[funcNum].getAct_id(), Oalconstants_c.STATE_TYPE);
          break;
        default:
          fail("parseAction: Unknown Activity type constant");
      }
    } catch (TokenStreamException e) {
      Block_c.Clearcurrentscope(arrayModelRoot, 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(arrayModelRoot, parser.m_oal_context.m_act_id);
      parser.reportError(e);
    } catch (InterruptedException ie) {
    }
    return parser.m_output;
  }
Ejemplo n.º 3
0
 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;
 }