Esempio n. 1
0
 private void parsePlaces(MID mid) throws ParseException {
   Marking initialMarking = parsePlaces(mid, mainNet);
   if (initialMarking.getPlaces().size() > 0) mid.addInitialMarking(initialMarking);
   if (editor.getKernel().getSystemOptions().isNetHierarchyEnabled()) {
     for (JPanel subModel : editor.getSubModels())
       if (subModel instanceof PrTPanel) {
         Marking subInitMarking = parsePlaces(mid, (PrTPanel) subModel);
         if (subInitMarking.getPlaces().size() > 0)
           subModelNonAnnotationInitialMarkings.put((PrTPanel) subModel, subInitMarking);
       }
   }
 }
Esempio n. 2
0
 protected void parseMainModelAnnotationMarking(MID mid, String text) throws ParseException {
   String markingString = text.substring(XMIDProcessor.INIT_KEYWORD.length());
   if (markingString.trim().equals("")) return;
   Marking marking = null;
   try {
     marking = MIDParser.parseMarkingString(markingString);
     mid.addInitialMarking(marking);
   } catch (ParseException e) {
     throw new ParseException(
         XMIDProcessor.INIT_KEYWORD
             + " "
             + LocaleBundle.bundleString("annotation")
             + " "
             + text
             + ". "
             + e.toString());
   }
 }
Esempio n. 3
0
 private void parseDataAnnotations(MID mid) throws ParseException {
   DataLayerInterface net = mainNet.getModel();
   AnnotationNote[] annotationNotes = net.getLabels();
   for (AnnotationNote annotation : annotationNotes) {
     String text = annotation.getText();
     if (text.startsWith(XMIDProcessor.DATA_KEYWORD)) {
       String dataPath = text.substring(XMIDProcessor.DATA_KEYWORD.length()).trim();
       try {
         ExcelTestDataLoader excelTestDataLoader =
             new ExcelTestDataLoader(
                 editor.midFile.getParent() + File.separator + dataPath, mid.getPlaces());
         for (Marking initMarking : excelTestDataLoader.getInitMarkings()) {
           mid.addInitialMarking(initMarking);
         }
       } catch (Exception e) {
         throw new ParseException(text + " -> " + e.getMessage());
       }
     }
   }
 }
Esempio n. 4
0
 private void parseSubModelMarkingAnnotations(MID mid) throws ParseException {
   for (JPanel subModel : editor.getSubModels())
     if (subModel instanceof PrTPanel) {
       // deal with initial markings
       ArrayList<Marking> initMarkings =
           parseSubModelMarkingAnnotations((PrTPanel) subModel, XMIDProcessor.INIT_KEYWORD);
       Marking nonAnnotationInitMarking =
           subModelNonAnnotationInitialMarkings.get((PrTPanel) subModel);
       if (nonAnnotationInitMarking != null) initMarkings.add(0, nonAnnotationInitMarking);
       if (initMarkings.size() > 1)
         throw new ParseException(
             LocaleBundle.bundleString("Warning")
                 + ": "
                 + modelNameMessage((PrTPanel) subModel)
                 + LocaleBundle.bundleString("SUBMODEL_HAS_MORE_THAN_ONE_INITIAL_MARKINGS"));
       if (initMarkings.size() > 0) {
         if (mid.getInitialMarkings().size() == 0) mid.addInitialMarking(initMarkings.get(0));
         else mid.getInitialMarkings().get(0).merge(initMarkings.get(0));
       }
     }
 }