Class BigraphUtil

java.lang.Object
org.bigraphs.framework.core.utils.BigraphUtil

public class BigraphUtil extends Object
A collection of useful bigraph-related operations and queries.
Author:
Dominik Grzelak
  • 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

      public static EcoreBigraph copy(EcoreBigraph bigraph) throws CloneNotSupportedException
      Throws:
      CloneNotSupportedException
    • toBigraph

    • toBigraph

      public static PureBigraph toBigraph(org.eclipse.emf.ecore.EPackage metaModel, org.eclipse.emf.ecore.EObject instanceModel, DefaultDynamicSignature signature)
    • setParentOfNode

      public static void setParentOfNode(BigraphEntity<?> node, BigraphEntity<?> parent)
    • 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

      public static String getUniqueLabelOfBigraphEntity(BigraphEntity x)
      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

      public static String getUniqueIdOfBigraphEntity(BigraphEntity x)
      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 parameters discreteBigraphs 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 signatures left and right. 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 signature
      right - another signature to merge with left
      Returns:
      a merged signature, or just left or right, if the other one is null
      Throws:
      RuntimeException - if the underlying meta-model is invalid that is created in the merging process.
    • isElementaryBigraph

      public static boolean isElementaryBigraph(Bigraph<?> bigraph)
      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

      public static boolean isBigraphElementaryLinking(Bigraph<?> bigraph)
    • isBigraphElementaryPlacing

      public static boolean isBigraphElementaryPlacing(Bigraph<?> bigraph)