Skip to content

Commit 528a259

Browse files
authored
Update README.md
1 parent 79370e8 commit 528a259

File tree

1 file changed

+26
-1
lines changed

1 file changed

+26
-1
lines changed

README.md

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,34 @@ See https://jitpack.io/#beamline/simple-pnml for further details (e.g., using it
3232
### Importing a Petri net from a PNML file
3333

3434
To import a Petri net from a PNML file you can use the following code:
35+
3536
```java
3637
Object[] i = PnmlImportNet.importFromStream(new FileInputStream(new File("file.pnml")));
38+
39+
Petrinet net = (Petrinet) i[0];
40+
Marking marking = (Marking) i[1];
41+
```
42+
43+
### Importing a Petri net from a TPN file
44+
45+
To import a Petri net from a TPN file you can use the following code:
46+
47+
```java
48+
Object[] i = TpnImport.importFromStream(new FileInputStream(new File("file.tpn")));
49+
3750
Petrinet net = (Petrinet) i[0];
38-
Marking m = (Marking) i[1];
51+
Marking marking = (Marking) i[1];
52+
```
53+
54+
55+
### Exporting a Petri net into a PNML file
56+
57+
To export a Petri net into a PNML file you can use the following code:
58+
59+
```java
60+
Petrinet net = ...;
61+
Marking marking = ...;
62+
63+
PnmlExportNetToPNML.exportPetriNetToPNMLFile(net, marking, new File("file.pnml"));
3964
```
4065

0 commit comments

Comments
 (0)