Decompose/NetDecom.java
private void exportPetriNetToPNMLOrEPNMLFile(PluginContext context, PetrinetGraph spg, File file,
			Pnml.PnmlType type) throws IOException {
		Marking marking = getInitialMarking(spg);
		Collection<Marking> finalMarkings = getFinalMarkings(spg);
		Petrinet net = (Petrinet) spg;

		GraphLayoutConnection layout;
		try {
			layout = context.getConnectionManager().getFirstConnection(GraphLayoutConnection.class, context, net);
		} catch (ConnectionCannotBeObtained e) {
			layout = new GraphLayoutConnection(net);
		}
		HashMap<PetrinetGraph, Marking> markedNets = new HashMap<PetrinetGraph, Marking>();
		HashMap<PetrinetGraph, Collection<Marking>> finalMarkedNets = new HashMap<PetrinetGraph, Collection<Marking>>();
		markedNets.put(net, marking);
		finalMarkedNets.put(net, finalMarkings);

		Pnml pnml = new Pnml();
		FullPnmlElementFactory factory = new FullPnmlElementFactory();
		synchronized (factory) {
			pnml.setFactory(factory);
			pnml = pnml.convertFromNet(markedNets, finalMarkedNets, layout);
		}
		pnml.setType(type);
		updateName(context, pnml, net);
		String text = "<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>\n" + pnml.exportElement(pnml);

		BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(file)));
		bw.write(text);
		bw.close();
	}
//export the net to PNML file
export the net to PNML file
export the net to PNML file
private void exportPetriNetToPNMLOrEPNMLFile(PluginContext context, PetrinetGraph spg, File file,
			Pnml.PnmlType type) throws IOException {
		Marking marking = getInitialMarking(spg);
		Collection<Marking> finalMarkings = getFinalMarkings(spg);
		Petrinet net = (Petrinet) spg;
		GraphLayoutConnection layout;
		try {
			layout = context.getConnectionManager().getFirstConnection(GraphLayoutConnection.class, context, net);
		} catch (ConnectionCannotBeObtained e) {
			layout = new GraphLayoutConnection(net);
		}
		HashMap<PetrinetGraph, Marking> markedNets = new HashMap<PetrinetGraph, Marking>();
		HashMap<PetrinetGraph, Collection<Marking>> finalMarkedNets = new HashMap<PetrinetGraph, Collection<Marking>>();
		markedNets.put(net, marking);
		finalMarkedNets.put(net, finalMarkings);
		Pnml pnml = new Pnml();
		FullPnmlElementFactory factory = new FullPnmlElementFactory();
		synchronized (factory) {
			pnml.setFactory(factory);
			pnml = pnml.convertFromNet(markedNets, finalMarkedNets, layout);
		}
		pnml.setType(type);
		updateName(context, pnml, net);
		String text = "<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>\n" + pnml.exportElement(pnml);
		BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(file)));
		bw.write(text);
		bw.close();
	}
private void exportPetriNetToPNMLOrEPNMLFile ( PluginContext context , PetrinetGraph spg , File file , Pnml . PnmlType type ) throws IOException { Marking marking = getInitialMarking ( spg ) ; Collection < Marking > finalMarkings = getFinalMarkings ( spg ) ; Petrinet net = ( Petrinet ) spg ; GraphLayoutConnection layout ; try { layout = context . getConnectionManager ( ) . getFirstConnection ( GraphLayoutConnection . class , context , net ) ; } catch ( ConnectionCannotBeObtained e ) { layout = new GraphLayoutConnection ( net ) ; } HashMap < PetrinetGraph , Marking > markedNets = new HashMap < PetrinetGraph , Marking > ( ) ; HashMap < PetrinetGraph , Collection < Marking > > finalMarkedNets = new HashMap < PetrinetGraph , Collection < Marking > > ( ) ; markedNets . put ( net , marking ) ; finalMarkedNets . put ( net , finalMarkings ) ; Pnml pnml = new Pnml ( ) ; FullPnmlElementFactory factory = new FullPnmlElementFactory ( ) ; synchronized ( factory ) { pnml . setFactory ( factory ) ; pnml = pnml . convertFromNet ( markedNets , finalMarkedNets , layout ) ; } pnml . setType ( type ) ; updateName ( context , pnml , net ) ; String text = "<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>\n" + pnml . exportElement ( pnml ) ; BufferedWriter bw = new BufferedWriter ( new OutputStreamWriter ( new FileOutputStream ( file ) ) ) ; bw . write ( text ) ; bw . close ( ) ; }
export the net to PNML file
export the net to PNML file