コード例 #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_INT_RO:
       actact =
           Body_c.getOneACT_ACTOnR698(
               RequiredOperationBody_c.getOneACT_ROBOnR685(m_testReqOpr[funcNum]));
       if (actact != null) {
         actact.Clear_blocks();
       }
       break;
     case ACTIVITY_TYPE_INT_PO:
       actact =
           Body_c.getOneACT_ACTOnR698(
               ProvidedOperationBody_c.getOneACT_POBOnR687(m_testProvOpr[funcNum]));
       if (actact != null) {
         actact.Clear_blocks();
       }
       break;
     case ACTIVITY_TYPE_ArraySTATE:
       actact =
           Body_c.getOneACT_ACTOnR698(
               StateActionBody_c.getOneACT_SABOnR691(m_arrayStateAction[funcNum]));
       if (actact != null) {
         actact.Clear_blocks();
       }
     default:
       fail("clearAction: Unknown Activity type constant");
   }
   m_requiresClear = false;
 }
コード例 #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;
  }