Class BigraphUtil
java.lang.Object
org.bigraphs.framework.core.utils.BigraphUtil
A collection of useful bigraph-related operations and queries.
- Author:
- Dominik Grzelak
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic <S extends AbstractEcoreSignature<? extends Control<?,
?>>>
Bigraph<S>static EcoreBigraph
copy
(EcoreBigraph bigraph) static <S extends AbstractEcoreSignature<? extends Control<?,
?>>>
Bigraph<S>copyIfSame
(Bigraph<S> g, Bigraph<S> f) static String
Returns the unique id of an bigraph entity (a node, root, outer name, ...).static String
Returns the common label of an bigraph entity (a node, root, outer name, ...).static boolean
isBigraphElementaryLinking
(Bigraph<?> bigraph) static boolean
isBigraphElementaryPlacing
(Bigraph<?> bigraph) static boolean
isElementaryBigraph
(Bigraph<?> bigraph) Basic checking method for simple elementary bigraphs such as a merge or closure.static boolean
isSomeParentOfNode
(BigraphEntity<?> node, BigraphEntity<?> possibleParent, Bigraph<?> bigraph) static DefaultDynamicSignature
This method merges the two given signaturesleft
andright
.static Bigraph
reorderBigraphs
(List<Bigraph> discreteBigraphs, InstantiationMap instantiationMap) Each bigraph represents a "parameter" in a list.static void
setParentOfNode
(BigraphEntity<?> node, BigraphEntity<?> parent) static void
setParentOfNode
(org.eclipse.emf.ecore.EObject node, org.eclipse.emf.ecore.EObject parent) static PureBigraph
toBigraph
(EcoreBigraph.Stub<DefaultDynamicSignature> stub, DefaultDynamicSignature signature) static PureBigraph
toBigraph
(org.eclipse.emf.ecore.EPackage metaModel, org.eclipse.emf.ecore.EObject instanceModel, DefaultDynamicSignature signature)
-
Constructor Details
-
BigraphUtil
public BigraphUtil()
-
-
Method Details
-
copyIfSame
public static <S extends AbstractEcoreSignature<? extends Control<?,?>>> Bigraph<S> copyIfSame(Bigraph<S> g, Bigraph<S> f) -
copy
public static <S extends AbstractEcoreSignature<? extends Control<?,?>>> Bigraph<S> copy(Bigraph<S> f) -
copy
- Throws:
CloneNotSupportedException
-
toBigraph
public static PureBigraph toBigraph(EcoreBigraph.Stub<DefaultDynamicSignature> stub, DefaultDynamicSignature signature) -
toBigraph
public static PureBigraph toBigraph(org.eclipse.emf.ecore.EPackage metaModel, org.eclipse.emf.ecore.EObject instanceModel, DefaultDynamicSignature signature) -
setParentOfNode
-
setParentOfNode
public static void setParentOfNode(org.eclipse.emf.ecore.EObject node, org.eclipse.emf.ecore.EObject parent) -
isSomeParentOfNode
public static boolean isSomeParentOfNode(BigraphEntity<?> node, BigraphEntity<?> possibleParent, Bigraph<?> bigraph) -
getUniqueLabelOfBigraphEntity
Returns the common label of an bigraph entity (a node, root, outer name, ...). Interface elements are prefixed such as "s" for sites, and "r" for roots.Similar to
getUniqueIdOfBigraphEntity(BigraphEntity)
but here for a node the control label is used instead of its name id.- Parameters:
x
-- Returns:
-
getUniqueIdOfBigraphEntity
Returns the unique id of an bigraph entity (a node, root, outer name, ...). Interface elements are prefixed such as "s" for sites, and "r" for roots.Similar to
getUniqueLabelOfBigraphEntity(BigraphEntity)
but here for node the name id is used instead of the control label.- Parameters:
x
-- Returns:
-
reorderBigraphs
public static Bigraph reorderBigraphs(List<Bigraph> discreteBigraphs, InstantiationMap instantiationMap) throws IncompatibleSignatureException, IncompatibleInterfaceException Each bigraph represents a "parameter" in a list. The result of this method is the product of all parametersdiscreteBigraphs
but each parameter is getting a new root index due to the instantiation map. The instantiation map maps the position of the initial bigraphs to a new one in the list. The resulting bigraph has as many roots as parameters in the list.- Parameters:
discreteBigraphs
- list of bigraphs (parameters)instantiationMap
- an instantiation map- Returns:
- a bigraph containing all "parameters" in a new order. It has as many roots as the list size of
discreteBigraphs
. - Throws:
IncompatibleSignatureException
IncompatibleInterfaceException
-
mergeSignatures
public static DefaultDynamicSignature mergeSignatures(DefaultDynamicSignature left, DefaultDynamicSignature right) This method merges the two given signaturesleft
andright
. A completely new instance will be created with a new underlying Ecore signature meta-model.If either one of the given signatures is
null
, the other one is simply returned.- Parameters:
left
- a signatureright
- another signature to merge withleft
- Returns:
- a merged signature, or just
left
orright
, if the other one isnull
- Throws:
RuntimeException
- if the underlying meta-model is invalid that is created in the merging process.
-
isElementaryBigraph
Basic checking method for simple elementary bigraphs such as a merge or closure. This doesn't work for a Discrete Ion or a molecule, for instance.- Parameters:
bigraph
- the bigraph to check- Returns:
true
, if bigraph is a simple elementary one (except for a discrete ion, for example).
-
isBigraphElementaryLinking
-
isBigraphElementaryPlacing
-