org.eclipse.jetty.deploy.graph
Class Graph

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

public class Graph
extends Object

Basic directed graph implementation


Constructor Summary
Graph()
           
 
Method Summary
 void addEdge(Edge edge)
           
 void addEdge(String from, String to)
           
 void addNode(Node node)
           
 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.
 Set<Edge> findEdgesFrom(Node from)
          Find all edges that are connected Edge.getFrom() the specific node.
 Set<Edge> getEdges()
           
 Node getNodeByName(String name)
          Get the Node by Name.
 Set<Node> getNodes()
           
 Path getPath(Node from, Node to)
          Using BFS (Breadth First Search) return the path from a any arbitrary node to any other.
 Path getPath(String nodeNameOrigin, String nodeNameDest)
          Convenience method for getPath(Node, Node)
 void insertNode(Edge edge, Node node)
          Insert an arbitrary node on an existing edge.
 void insertNode(Edge edge, String nodeName)
          Convenience method for insertNode(Edge, Node)
 void removeEdge(Edge edge)
           
 void removeEdge(String fromNodeName, String toNodeName)
           
 void removeNode(Node node)
           
 void setEdges(Set<Edge> edges)
           
 void setNodes(Set<Node> nodes)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Graph

public Graph()
Method Detail

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)


Copyright © 1995-2011 Mort Bay Consulting. All Rights Reserved.