Class BigraphUtil
- Author:
- Dominik Grzelak
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic BinaryOperator<Bigraph<DynamicSignature>> static BinaryOperator<Bigraph<DynamicSignature>> -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic Optional<DynamicSignature> composeSignatures(List<DynamicSignature> signatures) static DynamicSignaturecomposeSignatures(DynamicSignature left, DynamicSignature right) This method composes the two given signaturesleftandright.static <S extends AbstractEcoreSignature<? extends Control<?,?>>>
Bigraph<S> static EcoreBigraphcopy(EcoreBigraph bigraph) static <S extends AbstractEcoreSignature<? extends Control<?,?>>>
Bigraph<S> copyIfSame(Bigraph<S> g, Bigraph<S> f) static StringReturns the unique id of an bigraph entity (a node, root, outer name, ...).static StringReturns the common label of an bigraph entity (a node, root, outer name, ...).static booleanisBigraphElementaryLinking(Bigraph<?> bigraph) static booleanisBigraphElementaryPlacing(Bigraph<?> bigraph) static booleanisElementaryBigraph(Bigraph<?> bigraph) Basic checking method for simple elementary bigraphs such as a merge or closure.static booleanisSomeParentOfNode(BigraphEntity<?> node, BigraphEntity<?> possibleParent, Bigraph<?> bigraph) static Optional<DynamicSignature> leftMergeSignatures(List<DynamicSignature> signatures) static DynamicSignaturemergeSignatures(DynamicSignature left, DynamicSignature right) This method merges the two given signaturesleftandright.static DynamicSignaturemergeSignatures(DynamicSignature left, DynamicSignature right, int leftOrRight) This method merges the two given signaturesleftandright.static BigraphreorderBigraphs(List<Bigraph> discreteBigraphs, InstantiationMap instantiationMap) Each bigraph represents a "parameter" in a list.static voidsetParentOfNode(BigraphEntity<?> node, BigraphEntity<?> parent) static voidsetParentOfNode(org.eclipse.emf.ecore.EObject node, org.eclipse.emf.ecore.EObject parent) static PureBigraphtoBigraph(EcoreBigraph.Stub<DynamicSignature> stub, DynamicSignature signature) static PureBigraphtoBigraph(org.eclipse.emf.ecore.EPackage metaModel, org.eclipse.emf.ecore.EObject instanceModel, DynamicSignature signature)
-
Field Details
-
ACCUMULATOR_PARALLEL_PRODUCT
-
ACCUMULATOR_MERGE_PRODUCT
-
-
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<DynamicSignature> stub, DynamicSignature signature) -
toBigraph
public static PureBigraph toBigraph(org.eclipse.emf.ecore.EPackage metaModel, org.eclipse.emf.ecore.EObject instanceModel, DynamicSignature 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 parametersdiscreteBigraphsbut 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:
IncompatibleSignatureExceptionIncompatibleInterfaceException
-
mergeSignatures
This method merges the two given signaturesleftandright. 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
leftorright, if the other one isnull - Throws:
RuntimeException- if the underlying metamodel is invalid, that is created in the merging process.
-
mergeSignatures
public static DynamicSignature mergeSignatures(DynamicSignature left, DynamicSignature right, int leftOrRight) This method merges the two given signaturesleftandright. 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
leftOrRightspecifies 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
This method composes the two given signaturesleftandright. 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
leftorright, if the other one isnull - Throws:
RuntimeException- if the signatures are not consistent
-
composeSignatures
-
leftMergeSignatures
-
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
-