Decompose/PetriNet4.java
private Object[] importNet(PluginContext context, String filename) throws FileNotFoundException, Exception {
		File file = new File(filename);
		PnmlImportUtils utils = new PnmlImportUtils();
		Pnml pnml = utils.importPnmlFromStream(context, new FileInputStream(file), filename, file.length());
		if (pnml == null) {
			/*
			 * No PNML found in file. Fail.
			 */
			return null;
		}
		/*
		 * PNML file has been imported. Now we need to convert the contents to a
		 * regular Petri net.
		 */
		PetrinetGraph net = PetrinetFactory.newPetrinet(pnml.getLabel());

		/*
		 * Create fresh marking(s) and layout.
		 */
		Marking marking = new Marking();
		Collection<Marking> finalMarkings = new HashSet<Marking>();
		GraphLayoutConnection layout = new GraphLayoutConnection(net);

		/*
		 * Initialize the Petri net, marking(s), and layout from the PNML
		 * element.
		 */
		pnml.convertToNet(net, marking, finalMarkings, layout);

		/*
		 * Add a connection from the Petri net to the marking(s) and layout.
		 */
		context.addConnection(new InitialMarkingConnection(net, marking));
		for (Marking finalMarking : finalMarkings) {
			context.addConnection(new FinalMarkingConnection(net, finalMarking));
		}
		context.addConnection(layout);

		/*
		 * Return the net and the marking.
		 */
		Object[] objects = new Object[2];
		objects[0] = net;
		objects[1] = marking;
		return objects;
	}
// to import a PNML to PetrinetGraph
to import a PNML to PetrinetGraph
to import a PNML to PetrinetGraph
private Object[] importNet(PluginContext context, String filename) throws FileNotFoundException, Exception {
		File file = new File(filename);
		PnmlImportUtils utils = new PnmlImportUtils();
		Pnml pnml = utils.importPnmlFromStream(context, new FileInputStream(file), filename, file.length());
		if (pnml == null) {
			/*
			 * No PNML found in file. Fail.
			 */
			return null;
		}
		/*
		 * PNML file has been imported. Now we need to convert the contents to a
		 * regular Petri net.
		 */
		PetrinetGraph net = PetrinetFactory.newPetrinet(pnml.getLabel());
		/*
		 * Create fresh marking(s) and layout.
		 */
		Marking marking = new Marking();
		Collection<Marking> finalMarkings = new HashSet<Marking>();
		GraphLayoutConnection layout = new GraphLayoutConnection(net);
		/*
		 * Initialize the Petri net, marking(s), and layout from the PNML
		 * element.
		 */
		pnml.convertToNet(net, marking, finalMarkings, layout);
		/*
		 * Add a connection from the Petri net to the marking(s) and layout.
		 */
		context.addConnection(new InitialMarkingConnection(net, marking));
		for (Marking finalMarking : finalMarkings) {
			context.addConnection(new FinalMarkingConnection(net, finalMarking));
		}
		context.addConnection(layout);
		/*
		 * Return the net and the marking.
		 */
		Object[] objects = new Object[2];
		objects[0] = net;
		objects[1] = marking;
		return objects;
	}
private Object [ ] importNet ( PluginContext context , String filename ) throws FileNotFoundException , Exception { File file = new File ( filename ) ; PnmlImportUtils utils = new PnmlImportUtils ( ) ; Pnml pnml = utils . importPnmlFromStream ( context , new FileInputStream ( file ) , filename , file . length ( ) ) ; if ( pnml == null ) { /*
			 * No PNML found in file. Fail.
			 */ return null ; } /*
		 * PNML file has been imported. Now we need to convert the contents to a
		 * regular Petri net.
		 */ PetrinetGraph net = PetrinetFactory . newPetrinet ( pnml . getLabel ( ) ) ; /*
		 * Create fresh marking(s) and layout.
		 */ Marking marking = new Marking ( ) ; Collection < Marking > finalMarkings = new HashSet < Marking > ( ) ; GraphLayoutConnection layout = new GraphLayoutConnection ( net ) ; /*
		 * Initialize the Petri net, marking(s), and layout from the PNML
		 * element.
		 */ pnml . convertToNet ( net , marking , finalMarkings , layout ) ; /*
		 * Add a connection from the Petri net to the marking(s) and layout.
		 */ context . addConnection ( new InitialMarkingConnection ( net , marking ) ) ; for ( Marking finalMarking : finalMarkings ) { context . addConnection ( new FinalMarkingConnection ( net , finalMarking ) ) ; } context . addConnection ( layout ) ; /*
		 * Return the net and the marking.
		 */ Object [ ] objects = new Object [ 2 ] ; objects [ 0 ] = net ; objects [ 1 ] = marking ; return objects ; }
to import a PNML to PetrinetGraph
to import a PNML to PetrinetGraph