Decompose/NetDecom.java
private void generateBlock(PetriNet4 G, Transition t, Place end, PetriNet4 blk) {
		// System.out.println("Phase start------"+t.getLabel()+ " " +
		// end.getLabel());
		List<Transition> tempT = null;
		List<Place> tempP = null;

		HashMap<Place, List<Transition>> p2t = G.get_p2t();
		HashMap<Transition, List<Place>> t2p = G.get_t2p();

		List<Place> neighbourP = t2p.get(t);
		HashSet<Place> currentLP = new HashSet<Place>();

		for (Place p : neighbourP) {
			if (!p.equals(end)) {
				currentLP.add(p);
			}
			blk.add(t, p);
		}

		HashSet<Transition> currentLT = null;
		while (currentLP.size() != 0) {
			tempT = new ArrayList<Transition>();
			tempP = new ArrayList<Place>();
			currentLT = new HashSet<Transition>();

			for (Place p : currentLP) {
				tempT = p2t.get(p);
				if (tempT == null) {
					System.out.println(
							"debug error 1 " + p.getLabel() + " " + G.getSink().getLabel() + " " + end.getLabel());
				}
				blk.add(p, tempT);

				for (Transition t1 : tempT) {
					currentLT.add(t1);
				}
			}

			currentLP = new HashSet<Place>();
			// get all the places
			for (Transition t1 : currentLT) {
				tempP = t2p.get(t1);
				blk.add(t1, tempP);

				// remove the reach points
				for (Place p : tempP) {
					if (!p.equals(end)) {
						currentLP.add(p);
					}
				}
			}
			// System.out.println("currentLP size is "+currentLP.size());
		}
	}
//generate net block based on the starting and end point
generate net block based on the starting and end point
generate net block based on the starting and end point
private void generateBlock(PetriNet4 G, Transition t, Place end, PetriNet4 blk) {
		List<Transition> tempT = null;
		List<Place> tempP = null;
		HashMap<Place, List<Transition>> p2t = G.get_p2t();
		HashMap<Transition, List<Place>> t2p = G.get_t2p();
		List<Place> neighbourP = t2p.get(t);
		HashSet<Place> currentLP = new HashSet<Place>();
		for (Place p : neighbourP) {
			if (!p.equals(end)) {
				currentLP.add(p);
			}
			blk.add(t, p);
		}
		HashSet<Transition> currentLT = null;
		while (currentLP.size() != 0) {
			tempT = new ArrayList<Transition>();
			tempP = new ArrayList<Place>();
			currentLT = new HashSet<Transition>();
			for (Place p : currentLP) {
				tempT = p2t.get(p);
				if (tempT == null) {
					System.out.println(
							"debug error 1 " + p.getLabel() + " " + G.getSink().getLabel() + " " + end.getLabel());
				}
				blk.add(p, tempT);
				for (Transition t1 : tempT) {
					currentLT.add(t1);
				}
			}
			currentLP = new HashSet<Place>();
			for (Transition t1 : currentLT) {
				tempP = t2p.get(t1);
				blk.add(t1, tempP);
				for (Place p : tempP) {
					if (!p.equals(end)) {
						currentLP.add(p);
					}
				}
			}
		}
	}
private void generateBlock ( PetriNet4 G , Transition t , Place end , PetriNet4 blk ) { List < Transition > tempT = null ; List < Place > tempP = null ; HashMap < Place , List < Transition > > p2t = G . get_p2t ( ) ; HashMap < Transition , List < Place > > t2p = G . get_t2p ( ) ; List < Place > neighbourP = t2p . get ( t ) ; HashSet < Place > currentLP = new HashSet < Place > ( ) ; for ( Place p : neighbourP ) { if ( ! p . equals ( end ) ) { currentLP . add ( p ) ; } blk . add ( t , p ) ; } HashSet < Transition > currentLT = null ; while ( currentLP . size ( ) != 0 ) { tempT = new ArrayList < Transition > ( ) ; tempP = new ArrayList < Place > ( ) ; currentLT = new HashSet < Transition > ( ) ; for ( Place p : currentLP ) { tempT = p2t . get ( p ) ; if ( tempT == null ) { System . out . println ( "debug error 1 " + p . getLabel ( ) + " " + G . getSink ( ) . getLabel ( ) + " " + end . getLabel ( ) ) ; } blk . add ( p , tempT ) ; for ( Transition t1 : tempT ) { currentLT . add ( t1 ) ; } } currentLP = new HashSet < Place > ( ) ; for ( Transition t1 : currentLT ) { tempP = t2p . get ( t1 ) ; blk . add ( t1 , tempP ) ; for ( Place p : tempP ) { if ( ! p . equals ( end ) ) { currentLP . add ( p ) ; } } } } }
generate net block based on the starting and end point
generate net block based on the starting and end point
// System.out.println("Phase start------"+t.getLabel()+ " " + // end.getLabel()); // get all the places // remove the reach points // System.out.println("currentLP size is "+currentLP.size());