Package org.eclipse.jetty.deploy.graph
Class Graph
- java.lang.Object
-
- org.eclipse.jetty.deploy.graph.Graph
-
- Direct Known Subclasses:
AppLifeCycle
public class Graph extends java.lang.Object
Basic directed graph implementation
-
-
Constructor Summary
Constructors Constructor Description Graph()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addEdge(java.lang.String from, java.lang.String to)
void
addEdge(Edge edge)
void
addNode(Node node)
java.util.Set<Edge>
findEdges(Node node)
Find all edges that are connected to the specific node, both as an outgoingEdge.getFrom()
or incomingEdge.getTo()
end point.java.util.Set<Edge>
findEdgesFrom(Node from)
Find all edges that are connectedEdge.getFrom()
the specific node.java.util.Set<Edge>
getEdges()
Node
getNodeByName(java.lang.String name)
Get the Node by Name.java.util.Set<Node>
getNodes()
Path
getPath(java.lang.String nodeNameOrigin, java.lang.String nodeNameDest)
Convenience method forgetPath(Node, Node)
Path
getPath(Node from, Node to)
Using BFS (Breadth First Search) return the path from a any arbitrary node to any other.void
insertNode(Edge edge, java.lang.String nodeName)
Convenience method forinsertNode(Edge, Node)
void
insertNode(Edge edge, Node node)
Insert an arbitrary node on an existing edge.void
removeEdge(java.lang.String fromNodeName, java.lang.String toNodeName)
void
removeEdge(Edge edge)
void
removeNode(Node node)
void
setEdges(java.util.Set<Edge> edges)
void
setNodes(java.util.Set<Node> nodes)
-
-
-
Method Detail
-
addEdge
public void addEdge(Edge edge)
-
addEdge
public void addEdge(java.lang.String from, java.lang.String to)
-
addNode
public void addNode(Node node)
-
insertNode
public void insertNode(Edge edge, java.lang.String nodeName)
Convenience method forinsertNode(Edge, Node)
- Parameters:
edge
- the edge to split and insert a node intonodeName
- 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 intonode
- the node to insert along the edge
-
findEdges
public java.util.Set<Edge> findEdges(Node node)
Find all edges that are connected to the specific node, both as an outgoingEdge.getFrom()
or incomingEdge.getTo()
end point.- Parameters:
node
- the node with potential end points- Returns:
- the set of edges connected to the node
-
findEdgesFrom
public java.util.Set<Edge> findEdgesFrom(Node from)
Find all edges that are connectedEdge.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(java.lang.String nodeNameOrigin, java.lang.String nodeNameDest)
Convenience method forgetPath(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 fromto
- the node to- Returns:
- the path to take or null if there is no path.
-
getEdges
public java.util.Set<Edge> getEdges()
-
getNodeByName
public Node getNodeByName(java.lang.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 java.util.Set<Node> getNodes()
-
removeEdge
public void removeEdge(Edge edge)
-
removeEdge
public void removeEdge(java.lang.String fromNodeName, java.lang.String toNodeName)
-
removeNode
public void removeNode(Node node)
-
setEdges
public void setEdges(java.util.Set<Edge> edges)
-
setNodes
public void setNodes(java.util.Set<Node> nodes)
-
-