Ejemplo n.º 1
0
  public static void splitMixedPlaces(PetriNet net) {
    // perform node splitting (places)
    Collection<Place> ps = new ArrayList<Place>(net.getPlaces());
    Iterator<Place> places = ps.iterator();
    while (places.hasNext()) {
      Place place = places.next();

      if (net.getPredecessors(place).size() > 1 && net.getSuccessors(place).size() > 1) {
        Place newP = addPlace(net);
        Transition newT = addTransition(net);
        relinkOutgoingArcs(net, place, newP);
        net.addFlow(place, newT);
        net.addFlow(newT, newP);
      }
    }
  }
Ejemplo n.º 2
0
  public static void isolateTransitions(PetriNet net) {
    Collection<Transition> ts = new ArrayList<Transition>(net.getTransitions());
    Iterator<Transition> transitions = ts.iterator();
    while (transitions.hasNext()) {
      Transition transition = transitions.next();

      if (net.getPredecessors(transition).size() > 1) {
        Place newP = addPlace(net);
        Transition newT = addTransition(net);
        relinkIncomingArcs(net, transition, newT);

        net.addFlow(newT, newP);
        net.addFlow(newP, transition);
      }
      if (net.getSuccessors(transition).size() > 1) {
        Place newP = addPlace(net);
        Transition newT = addTransition(net);
        relinkOutgoingArcs(net, transition, newT);

        net.addFlow(transition, newP);
        net.addFlow(newP, newT);
      }
    }
  }