Exemple #1
0
 /**
  * Constructs an ExtendedPetriNet out of an ordinary one.
  *
  * @param net the Petri net that is re-established in the replayed net
  * @param caseIDs a list of strings containing the IDs of those instances that want to store
  *     diagnostic information
  */
 public ExtendedPetriNet(PetriNet net, ArrayList caseIDs) {
   super(net, caseIDs);
   HashMap activities = new HashMap();
   ListIterator lit = this.getTransitions().listIterator();
   while (lit.hasNext()) {
     // walk through transitions
     ExtendedTransition trans = (ExtendedTransition) lit.next();
     // TODO: Peter, please check whether this is in fact what you want
     // to do?
     // asking avoids the exception below (Anne)
     if (trans.isInvisibleTask() == false) {
       // try {
       String activityName = trans.getLogEvent().getModelElementName();
       ExtendedActivity activity;
       if (activities.get(activityName) == null) {
         activity = new ExtendedActivity(activityName);
         activities.put(activityName, activity);
       } else {
         activity = (ExtendedActivity) activities.get(activityName);
       }
       // connect transition to activity
       trans.setAssociatedActivity(activity);
     } // catch (NullPointerException ex) {
     // //NullPointerException can occur when invisible transitions exist
     // //within the Petri net
     // ex.printStackTrace();
     // }
   }
 }
Exemple #2
0
 /**
  * This is the transition writing part of the writeToDot procedure (refer to it for further
  * information).
  *
  * @param bw The writer used by the framework to create the temporary dot file.
  * @throws IOException If writing to the writer fails.
  */
 protected void writeTransitionsToDot(Writer bw) throws IOException {
   // No performance information drawn in transitions, so write transitions
   // to dot normally
   Iterator it = this.getTransitions().iterator();
   while (it.hasNext()) {
     ExtendedTransition myExtendedTransition = (ExtendedTransition) (it.next());
     String label = myExtendedTransition.getIdentifier();
     try {
       bw.write(
           "t"
               + myExtendedTransition.getNumber()
               + " [shape=\"box\",label=\""
               + label
               + "\""
               + (myExtendedTransition.getLogEvent() != null ? "" : "style=\"filled\"")
               + "];\n");
       // connect Petri net nodes to later grappa components
       nodeMapping.put(new String("t" + myExtendedTransition.getNumber()), myExtendedTransition);
     } catch (Exception ex) {
       Message.add("Failure while updating the visualization.\n" + ex.toString(), 2);
       ex.printStackTrace();
     }
   }
 }