Class Graph


  • public class Graph
    extends Object
    Represents a directed acyclic graph (DAG) of Nodes.
    • Constructor Detail

      • Graph

        public Graph​(String id)
        Constructs an empty graph with the given id.
        Parameters:
        id - the id of the graph
    • Method Detail

      • getId

        public String getId()
        Gets the graph's id
        Returns:
        the id of the graph
      • getVersion

        public String getVersion()
        Gets the graph's version
        Returns:
        the version of the graph
      • getHeader

        public Header getHeader()
        Gets the graph's header
        Returns:
        the header of the graph
      • getNodeCount

        public int getNodeCount()
        Gets the number nodes contained by this graph.
        Returns:
        the number nodes
      • addNode

        public void addNode​(Node node)
        Adds a Node to the graph
        Parameters:
        node - a node
        Throws:
        IllegalArgumentException - if the id of the given node is already in use
      • removeNode

        public boolean removeNode​(String id)
        Removes the Node with the given id from this graph if present.
        Parameters:
        id - the id of the Node to be removed
        Returns:
        true if the graph contains a Node with the given id. Else false.
      • getNode

        public Node getNode​(int index)
        Gets the Node at the given index.
        Parameters:
        index - the index
        Returns:
        the node at the given index
      • getNode

        public Node getNode​(String id)
        Returns the Node with the given id or null if the graph contains no respective Node.
        Parameters:
        id - the id of the Node to be removed
        Returns:
        true if the graph contains a Node with the given id. Else false.
      • getNodes

        public Node[] getNodes()
        Returns an array containing all nodes in this graph.
        Returns:
        an array of all nodes
      • getApplicationData

        public com.thoughtworks.xstream.io.xml.xppdom.XppDom getApplicationData​(String appId)
        Returns the Application data for the given application ID or null, if for this id no application is available.
        Parameters:
        appId - the application ID
        Returns:
        the application data as an XppDom
      • setAppData

        public void setAppData​(String id,
                               com.thoughtworks.xstream.io.xml.xppdom.XppDom data)
        Sets the application data for the given ID
        Parameters:
        id - The application ID.
        data - The application data as XppDom.