public final class PNMLUtils extends Object
PnmlExport}
Modifier and Type | Method and Description |
---|---|
static void |
checkIsPnmlFile(File pFile)
Checks the basic external expected characteristics of a PNML document
(i.e. regular XML file).
|
static String |
createDocumentWorkspace(String workspaceId)
Creates a new model (PetriNetDoc) workspace in PNML Framework
ModelRepository , with no PetriNetDoc associated (as
HLAPIRootClass ). |
static void |
createDocumentWorkspace(String workspaceId,
org.eclipse.emf.ecore.EObject petriNetDoc)
Same as
createDocumentWorkspace(String, HLAPIRootClass) , but
this time with the root PetriNetDoc object typed as an EMF's EObject
(native). |
static String |
createDocumentWorkspace(String workspaceId,
HLAPIRootClass petriNetDoc)
Creates a new model (PetriNetDoc) workspace in PNML Framework
ModelRepository , with a PetriNetDoc associated, as
HLAPIRootClass . |
static PNType |
determinePNType(HLAPIRootClass imported)
Determines the imported Petri Net Document type (a type of
PetriNetDocHLAPI from one of the PN type libraries).
|
static String |
exportPetriNetDocToPNML(org.eclipse.emf.ecore.EObject object,
String filepath)
Same as
exportPetriNetDocToPNML(HLAPIRootClass, String) , but
this time with the PetriNetDoc type as an EMF's EObject (native). |
static String |
exportPetriNetDocToPNML(HLAPIRootClass object,
String filepath)
Creates a PNML file and store in that file the contents from a
PetriNetDocHLAPI object.
|
static HLAPIRootClass |
importPnmlDocument(File file,
boolean fallback)
Imports a PNML document using PNML Framework.
|
static boolean |
isCoreModelDocument(HLAPIRootClass imported)
Determine if the imported Petri Net Document type (a type of
PetriNetDocHLAPI from one of the PN type libraries) is Core Model.
|
static boolean |
isHLPNDocument(HLAPIRootClass imported)
Determine if the imported Petri Net Document type (a type of
PetriNetDocHLAPI from one of the PN type libraries) is High-level Petri
Net.
|
static boolean |
isPTHLPNDocument(HLAPIRootClass imported)
Determine if the imported Petri Net Document type (a type of
PetriNetDocHLAPI from one of the PN type libraries) is P/T Net in
high-level notation (P/T as HLPN Graph).
|
static boolean |
isPTNetDocument(HLAPIRootClass imported)
Determine if the imported Petri Net Document type (a type of
PetriNetDocHLAPI from one of the PN type libraries) is Place/Transition
Net.
|
static boolean |
isSymNetDocument(HLAPIRootClass imported)
Determine if the imported Petri Net Document type (a type of
PetriNetDocHLAPI from one of the PN type libraries) is Symmetric Net.
|
public static final HLAPIRootClass importPnmlDocument(File file, boolean fallback) throws ImportException, InvalidIDException
ModelRepository.getCurrentDocWSId()
.file
- the PNML filefallback
- shall the fallback mechanism of PNML Framework used? (i.e.
fall back to a compatible standardized type if the discovered
one is unknown, in a best effort strategy).InvalidIDException
- invalid id for the document workspaceImportException
- some errors occurred during the import processpublic static final PNType determinePNType(HLAPIRootClass imported)
imported
- the root class of the imported Petri Net Documentpublic static final boolean isCoreModelDocument(HLAPIRootClass imported)
imported
- the root class of the imported Petri Net Documentpublic static final boolean isPTNetDocument(HLAPIRootClass imported)
imported
- the root class of the imported Petri Net Documentpublic static final boolean isPTHLPNDocument(HLAPIRootClass imported)
imported
- the root class of the imported Petri Net Documentpublic static final boolean isHLPNDocument(HLAPIRootClass imported)
imported
- the root class of the imported Petri Net Documentpublic static final boolean isSymNetDocument(HLAPIRootClass imported)
imported
- the root class of the imported Petri Net Documentpublic static final String exportPetriNetDocToPNML(HLAPIRootClass object, String filepath) throws UnhandledNetType, OCLValidationFailed, IOException, ValidationFailedException, BadFileFormatException, OtherException, InvalidIDException
ModelRepository
pretty printing status (default is true).
This is the recommended method to use to export your PetriNetDoc in a PNML file.
object
- filepath
- ModelRepository
(in memory) before the
export, so that you can continue using it for later reference in
your program. It you have imported the same Petri Net and modified
it in memory, you will get a different ID. So the originally imported
ID will be different from this one.UnhandledNetType
OCLValidationFailed
IOException
ValidationFailedException
BadFileFormatException
OtherException
InvalidIDException
#exportPetriNetDocToPNML(EObject, String)}
public static final String exportPetriNetDocToPNML(org.eclipse.emf.ecore.EObject object, String filepath) throws UnhandledNetType, OCLValidationFailed, IOException, ValidationFailedException, BadFileFormatException, OtherException, InvalidIDException, InvocationFailedException
exportPetriNetDocToPNML(HLAPIRootClass, String)
, but
this time with the PetriNetDoc type as an EMF's EObject (native).object
- filepath
- ModelRepository
(in memory) before the
export, so that you can continue using it for later reference in
your program.UnhandledNetType
OCLValidationFailed
IOException
ValidationFailedException
BadFileFormatException
OtherException
InvalidIDException
InvocationFailedException
public static final String createDocumentWorkspace(String workspaceId) throws InvalidIDException
ModelRepository
, with no PetriNetDoc associated (as
HLAPIRootClass
). This workspace becomes the current one, if
parallel property is not set on the ModelRepository
instance.InvalidIDException
- something went wrong during workspace creation.public static final String createDocumentWorkspace(String workspaceId, HLAPIRootClass petriNetDoc) throws InvalidIDException
ModelRepository
, with a PetriNetDoc associated, as
HLAPIRootClass
.
This model (and its workspace) becomes the current active one in the
model repository, if parallel property is not set on the
ModelRepository
instance.
workspaceId
- user-provided workspace idpetriNetDoc
- the root PetriNetDoc class, encapsulated in its corresponding
high-level PetriNetDocHLAPI class.InvalidIDException
public static final void createDocumentWorkspace(String workspaceId, org.eclipse.emf.ecore.EObject petriNetDoc) throws InvalidIDException
createDocumentWorkspace(String, HLAPIRootClass)
, but
this time with the root PetriNetDoc object typed as an EMF's EObject
(native).workspaceId
- petriNetDoc
- InvalidIDException
public static final void checkIsPnmlFile(File pFile) throws InvalidFileTypeException, InvalidFileException, InternalException
Checks the basic external expected characteristics of a PNML document (i.e. regular XML file). It does not return any boolean, because all kinds of handled errors will be output via the exceptions.
If you program continues after this invocation, then it means that every check went fine.
filePath
- the path of the PNML document.InvalidFileException
- document has formating errors or is not a regular file.InvalidFileTypeException
- document is not of the correct expected type (XML)InternalException
- some internal problemCopyright © 2009–2016 Univ. Paris Ouest, and Univ. Pierre et Marie Curie / CNRS UMR 7606 (LIP6). All rights reserved.