private static String createFreshName(Marking marking) {
   freshNameCounter++; // this guarantees that no previously used name is used again
   while (marking.containsName("new#" + freshNameCounter)) {
     freshNameCounter++;
   }
   return "new#" + freshNameCounter;
 }
예제 #2
0
  public Marking getCopy() {
    Marking newmarking = new Marking(net);
    for (Iterator<Entry<Place, List<Token>>> it = marking.entrySet().iterator(); it.hasNext(); ) {
      Entry<Place, List<Token>> e = it.next();
      Place p = e.getKey();
      List<Token> tokens = e.getValue();

      // copy token list
      newmarking.getTokens(p).addAll(tokens);
      //			for (Iterator<Token> it2=tokens.iterator(); it2.hasNext(); ) {
      //				Token token = it2.next();
      //				Token newtoken = new TokenImpl();
      //				newtoken.getNames().addAll(token.getNames());
      //				newmarking.get(p).add(newtoken);
      //			}
    }
    return newmarking;
  }