Class BpmnModel

java.lang.Object
org.tweetyproject.logics.bpm.syntax.BpmnModel
All Implemented Interfaces:
Iterable<BpmnNode>, BeliefBase, GeneralGraph<BpmnNode>, Graph<BpmnNode>

public class BpmnModel extends Object implements Graph<BpmnNode>, BeliefBase
A class to represent a BPMN Model
Author:
Benedikt Knopp
  • Constructor Details

    • BpmnModel

      public BpmnModel()
  • Method Details

    • getMinimalSignature

      public Signature getMinimalSignature()
      Description copied from interface: BeliefBase
      Returns the signature of the language of this knowledge base.
      Specified by:
      getMinimalSignature in interface BeliefBase
      Returns:
      the signature of the language of this knowledge base.
    • add

      public boolean add(BpmnNode node)
      Description copied from interface: Graph
      Adds the given node to this graph.
      Specified by:
      add in interface Graph<BpmnNode>
      Parameters:
      node - some node.
      Returns:
      "true" iff the edge has been added successfully.
    • add

      public boolean add(GeneralEdge<BpmnNode> edge)
      Description copied from interface: Graph
      Adds the given edge to this graph. If at least one of the nodes the given edge connects is not in the graph, an illegal argument exception is thrown.
      Specified by:
      add in interface Graph<BpmnNode>
      Parameters:
      edge - some edge.
      Returns:
      "true" iff the edge has been added successfully.
    • add

      public boolean add(Process process)
    • getNodes

      public Set<BpmnNode> getNodes()
      Description copied from interface: Graph
      Returns the nodes of this graph.
      Specified by:
      getNodes in interface GeneralGraph<BpmnNode>
      Specified by:
      getNodes in interface Graph<BpmnNode>
      Returns:
      the nodes of this graph.
    • getNumberOfNodes

      public int getNumberOfNodes()
      Description copied from interface: Graph
      Returns the number of nodes in this graph.
      Specified by:
      getNumberOfNodes in interface Graph<BpmnNode>
      Returns:
      the number of nodes in this graph.
    • areAdjacent

      public boolean areAdjacent(BpmnNode a, BpmnNode b)
      Description copied from interface: Graph
      Returns "true" iff the two nodes are connected by a directed edge from a to b or an undirected edge.
      Specified by:
      areAdjacent in interface Graph<BpmnNode>
      Parameters:
      a - some node
      b - some node
      Returns:
      "true" iff the two nodes are connected by a directed edge from a to b or an undirected edge.
    • getEdge

      public Edge<BpmnNode> getEdge(BpmnNode a, BpmnNode b)
      Description copied from interface: Graph
      Returns the corresponding edge (a,b) if a and b are adjacent. Otherwise it returns null.
      Specified by:
      getEdge in interface Graph<BpmnNode>
      Parameters:
      a - some node
      b - some node
      Returns:
      the edge (a,b) or null.
    • getEdges

      public Set<Edge<BpmnNode>> getEdges()
      Description copied from interface: Graph
      Returns the edges of this graph.
      Specified by:
      getEdges in interface GeneralGraph<BpmnNode>
      Specified by:
      getEdges in interface Graph<BpmnNode>
      Returns:
      the edges of this graph.
    • iterator

      public Iterator<BpmnNode> iterator()
      Specified by:
      iterator in interface Graph<BpmnNode>
      Specified by:
      iterator in interface Iterable<BpmnNode>
    • contains

      public boolean contains(Object obj)
      Description copied from interface: Graph
      Returns "true" when this graph contains the given node or edge.
      Specified by:
      contains in interface Graph<BpmnNode>
      Parameters:
      obj - an object
      Returns:
      "true" if this graph contains the given node or edge.
    • getChildren

      public Collection<BpmnNode> getChildren(Node node)
      Description copied from interface: Graph
      Returns the set of children (node connected via an undirected edge or a directed edge where the given node is the parent) of the given node.
      Specified by:
      getChildren in interface Graph<BpmnNode>
      Parameters:
      node - some node (must be in the graph).
      Returns:
      the set of children of the given node.
    • getParents

      public Collection<BpmnNode> getParents(Node node)
      Description copied from interface: Graph
      Returns the set of parents (node connected via an undirected edge or a directed edge where the given node is the child) of the given node.
      Specified by:
      getParents in interface Graph<BpmnNode>
      Parameters:
      node - some node (must be in the graph).
      Returns:
      the set of parents of the given node.
    • existsDirectedPath

      public boolean existsDirectedPath(BpmnNode node1, BpmnNode node2)
      Description copied from interface: Graph
      Checks whether there is a (directed) path from node1 to node2.
      Specified by:
      existsDirectedPath in interface Graph<BpmnNode>
      Parameters:
      node1 - some node.
      node2 - some node.
      Returns:
      "true" if there is a directed path from node1 to node2.
    • getNeighbors

      public Collection<BpmnNode> getNeighbors(BpmnNode node)
      Description copied from interface: Graph
      Returns the set of neighbors of the given node.
      Specified by:
      getNeighbors in interface Graph<BpmnNode>
      Parameters:
      node - some node (must be in the graph).
      Returns:
      the set of neighbors of the given node.
    • getAdjacencyMatrix

      public Matrix getAdjacencyMatrix()
      Description copied from interface: Graph
      Returns the adjacency matrix of this graph (the order of the nodes is the same as returned by "iterator()").
      Specified by:
      getAdjacencyMatrix in interface Graph<BpmnNode>
      Returns:
      the adjacency matrix of this graph
    • getComplementGraph

      public Graph<BpmnNode> getComplementGraph(int selfloops)
      Description copied from interface: Graph
      Returns the complement graph of this graph, i.e. the graph on the same set of vertices as this graph that connects two vertices v and w with an edge if and only if v and w are not connected in this graph.
      Specified by:
      getComplementGraph in interface Graph<BpmnNode>
      Parameters:
      selfloops - Indicates how to deal with selfloops:
      IGNORE_SELFLOOPS - ignore self loops (don't add and don't remove)
      INVERT_SELFLOOPS - deal with self loops like ordinary edges (add if not present and remove if present)
      REMOVE_SELFLOOPS - simple remove self loops, but don't add new ones.
      Returns:
      the complement graph of this graph.
    • getStronglyConnectedComponents

      public Collection<Collection<BpmnNode>> getStronglyConnectedComponents()
      Description copied from interface: Graph
      Returns the strongly connected components of this graph. A set of nodes is strongly connected, if there is a path from each node to each other. A set of nodes is called strongly connected component if it is strongly connected and maximal with respect to set inclusion.
      Specified by:
      getStronglyConnectedComponents in interface Graph<BpmnNode>
      Returns:
      the strongly connected components of this graph.
    • getSubgraphs

      public Collection<Graph<BpmnNode>> getSubgraphs()
      Description copied from interface: Graph
      Returns the set of sub graphs of this graph.
      Specified by:
      getSubgraphs in interface Graph<BpmnNode>
      Returns:
      the set of sub graphs of this graph.
    • getRestriction

      public Graph<BpmnNode> getRestriction(Collection<BpmnNode> nodes)
      Description copied from interface: GeneralGraph
      Returns copy of this graph consisting only of the given nodes and all corresponding edges.
      Specified by:
      getRestriction in interface GeneralGraph<BpmnNode>
      Parameters:
      nodes - a set of nodes
      Returns:
      a graph.
    • hasSelfLoops

      public boolean hasSelfLoops()
      Description copied from interface: Graph
      Returns "true" iff the graph has a self loop (an edge from a node to itself).
      Specified by:
      hasSelfLoops in interface Graph<BpmnNode>
      Returns:
      "true" iff the graph has a self loop (an edge from a node to itself).
    • isWeightedGraph

      public boolean isWeightedGraph()
      Description copied from interface: Graph
      Checks whether this graph only contains weighted edges.
      Specified by:
      isWeightedGraph in interface Graph<BpmnNode>
      Returns:
      "true" if all edges are weighted in this graph.
    • getActivities

      public Set<Activity> getActivities()
      retrieve all nodes in this BPMN model that are Activities
      Returns:
      the model's Activities
    • getSequenceFlows

      public Set<SequenceFlow> getSequenceFlows()
      retrieve all edges in this BPMN model that are Sequence Flows
      Returns:
      the model's Sequence Flows
    • getNodesOfType

      public Set<BpmnNode> getNodesOfType(Class<?> c)
      Retrieve all nodes in this model that are instances of a certain class
      Parameters:
      c - the class of interest
      Returns:
      the nodes that are instances of class c
    • getSequenceFlowSuccessors

      public Set<BpmnNode> getSequenceFlowSuccessors(BpmnNode node)
      For one particular nodes, retrieve all successors in the sequence flow of the BPMN model
      Parameters:
      node - the node of interest
      Returns:
      the sequence flow successors
    • getSortedNodes

      public Map<BpmnModel.BpmnNodeType,Set<BpmnNode>> getSortedNodes()
      Returns:
      getSortedNodes