示例#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);
       }
   }
 }
示例#2
0
 private void parseTokens(Marking marking, PipePlace place) throws ParseException {
   String activeTokenClassID = CreateGui.getModel().getActiveTokenClassID();
   DataLayerInterface net = mainNet.getModel();
   int pos = net.getPosInList(activeTokenClassID, place.getCurrentMarking());
   if (pos >= 0) {
     String tokenString = place.getCurrentMarking().get(pos).getCurrentMarking().trim();
     if (tokenString != null && !tokenString.equals("")) {
       ArrayList<Tuple> tokenList = new ArrayList<Tuple>();
       try {
         tokenList = MIDParser.parseTokenString(tokenString);
       } catch (ParseException e) {
         throw new ParseException(place.getName() + ": " + tokenString + ". " + e.toString());
       }
       if (tokenList.size() > 0) {
         // check arity consistency
         int firstArity = tokenList.get(0).arity();
         for (int index = 1; index < tokenList.size(); index++)
           if (tokenList.get(0).arity() != firstArity)
             throw new ParseException(
                 place.getName()
                     + " "
                     + LocaleBundle.bundleString("has inconsistent token length"));
         // check duplication
         checkDuplicateTokens(tokenList, place.getName(), tokenString);
       }
       marking.addTuples(place.getName(), tokenList);
     }
   }
 }