Class Graph

java.lang.Object
org.eclipse.jetty.deploy.graph.Graph
Direct Known Subclasses:
AppLifeCycle

public class Graph extends Object
Basic directed graph implementation
  • Constructor Details

    • Graph

      public Graph()
  • Method Details

    • addEdge

      public void addEdge(Edge edge)
    • addEdge

      public void addEdge(String from, String to)
    • addNode

      public void addNode(Node node)
    • insertNode

      public void insertNode(Edge edge, String nodeName)
      Convenience method for insertNode(Edge, Node)
      Parameters:
      edge - the edge to split and insert a node into
      nodeName - the name of the node to insert along the edge
    • insertNode

      public void insertNode(Edge edge, Node node)
      Insert an arbitrary node on an existing edge.
      Parameters:
      edge - the edge to split and insert a node into
      node - the node to insert along the edge
    • findEdges

      public Set<Edge> findEdges(Node node)
      Find all edges that are connected to the specific node, both as an outgoing Edge.getFrom() or incoming Edge.getTo() end point.
      Parameters:
      node - the node with potential end points
      Returns:
      the set of edges connected to the node
    • findEdgesFrom

      public Set<Edge> findEdgesFrom(Node from)
      Find all edges that are connected Edge.getFrom() the specific node.
      Parameters:
      from - the node with potential edges from it
      Returns:
      the set of edges from the node
    • getPath

      public Path getPath(String nodeNameOrigin, String nodeNameDest)
      Convenience method for getPath(Node, Node)
      Parameters:
      nodeNameOrigin - the name of the node to the path origin.
      nodeNameDest - the name of the node to the path destination.
      Returns:
      the path to take
    • getPath

      public Path getPath(Node from, Node to)
      Using BFS (Breadth First Search) return the path from a any arbitrary node to any other.
      Parameters:
      from - the node from
      to - the node to
      Returns:
      the path to take or null if there is no path.
    • getEdges

      public Set<Edge> getEdges()
    • getNodeByName

      public Node getNodeByName(String name)
      Get the Node by Name.
      Parameters:
      name - the name to lookup
      Returns:
      the node if found or null if not found.
    • getNodes

      public Set<Node> getNodes()
    • removeEdge

      public void removeEdge(Edge edge)
    • removeEdge

      public void removeEdge(String fromNodeName, String toNodeName)
    • removeNode

      public void removeNode(Node node)
    • setEdges

      public void setEdges(Set<Edge> edges)
    • setNodes

      public void setNodes(Set<Node> nodes)