Class BigraphUtil
- Author:
- Dominik Grzelak
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic Optional<DefaultDynamicSignature>
composeSignatures
(List<DefaultDynamicSignature> signatures) static DefaultDynamicSignature
This method composes the two given signaturesleft
andright
.static <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 Optional<DefaultDynamicSignature>
leftMergeSignatures
(List<DefaultDynamicSignature> signatures) static DefaultDynamicSignature
This method merges the two given signaturesleft
andright
.static DefaultDynamicSignature
mergeSignatures
(DefaultDynamicSignature left, DefaultDynamicSignature right, int leftOrRight) 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 metamodel.If either one of the given signatures is
null
, the other one is simply returned.Merging signatures does not require the two signatures to be consistent. If both do not contain the same control labels, then merge is just like composition.
For same control labels, the left signature overrides the right one.
- 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 metamodel is invalid, that is created in the merging process.
-
mergeSignatures
public static DefaultDynamicSignature mergeSignatures(DefaultDynamicSignature left, DefaultDynamicSignature right, int leftOrRight) This method merges the two given signaturesleft
andright
. A completely new instance will be created with a new underlying Ecore signature metamodel.If either one of the given signatures is
null
, the other one is simply returned.Merging signatures does not require the two signatures to be consistent. If both do not contain the same control labels, then merge is just like composition.
For same control labels, the argument
leftOrRight
specifies whether the left signature overrides the right one: 0 means the left signature has precedence, and 1 means the right signature has precedence.- Parameters:
left
- the first signatureright
- the second signature to merge with the first oneleftOrRight
- whether to use the left or right signature if same controls found in both- Returns:
- the new merge signature
-
composeSignatures
public static DefaultDynamicSignature composeSignatures(DefaultDynamicSignature left, DefaultDynamicSignature right) This method composes the two given signaturesleft
andright
. A completely new instance will be created with a new underlying Ecore signature metamodel.If either one of the given signatures is
null
, the other one is simply returned.Signatures are required to be consistent, i.e., both signatures have either different control labels, or if they contain the same label, they must agree on the arity and status.
- Parameters:
left
- a signatureright
- another signature to compose withleft
- Returns:
- a composed signature, or just
left
orright
, if the other one isnull
- Throws:
RuntimeException
- if the signatures are not consistent
-
composeSignatures
public static Optional<DefaultDynamicSignature> composeSignatures(List<DefaultDynamicSignature> signatures) -
leftMergeSignatures
public static Optional<DefaultDynamicSignature> leftMergeSignatures(List<DefaultDynamicSignature> signatures) -
zip
-
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
-