Package org.testng.internal
Class DynamicGraph<T>
- java.lang.Object
-
- org.testng.internal.DynamicGraph<T>
-
public class DynamicGraph<T> extends java.lang.Object
Representation of the graph of methods.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description (package private) static class
DynamicGraph.Edge<T>
static class
DynamicGraph.Status
-
Field Summary
Fields Modifier and Type Field Description private ListMultiMap<T,DynamicGraph.Edge<T>>
m_allEdges
private ListMultiMap<T,DynamicGraph.Edge<T>>
m_edges
private java.util.Collection<T>
m_nodesFinished
private java.util.Collection<T>
m_nodesReady
private java.util.Collection<T>
m_nodesRunning
-
Constructor Summary
Constructors Constructor Description DynamicGraph()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addEdge(int weight, T from, java.lang.Iterable<T> tos)
Add an edge between two nodes.void
addEdge(int weight, T from, T to)
void
addEdge(int weight, T from, T... tos)
Add an edge between two nodes.private void
addEdges(java.util.List<DynamicGraph.Edge<T>> edges)
boolean
addNode(T node)
Add a node to the graph.ListMultiMap<T,DynamicGraph.Edge<T>>
getEdges()
java.util.List<T>
getFreeNodes()
private int
getLowestEdgePriority(java.util.Collection<T> nodes)
private java.lang.String
getName(T t)
private static <T> DynamicGraph.Edge<T>
getNode(ListMultiMap<T,DynamicGraph.Edge<T>> edges, DynamicGraph.Edge<T> edge)
int
getNodeCount()
int
getNodeCountWithStatus(DynamicGraph.Status status)
private java.util.Collection<? extends T>
getUnfinishedNodes(T node)
private static <T> boolean
hasAllEdgesWithLevel(java.util.List<DynamicGraph.Edge<T>> edges, int level)
void
setStatus(java.util.Collection<T> nodes, DynamicGraph.Status status)
Set the status for a set of nodes.void
setStatus(T node, DynamicGraph.Status status)
Set the status for a node.java.lang.String
toDot()
java.lang.String
toString()
-
-
-
Field Detail
-
m_nodesReady
private final java.util.Collection<T> m_nodesReady
-
m_nodesRunning
private final java.util.Collection<T> m_nodesRunning
-
m_nodesFinished
private final java.util.Collection<T> m_nodesFinished
-
m_edges
private final ListMultiMap<T,DynamicGraph.Edge<T>> m_edges
-
m_allEdges
private final ListMultiMap<T,DynamicGraph.Edge<T>> m_allEdges
-
-
Method Detail
-
addNode
public boolean addNode(T node)
Add a node to the graph.
-
addEdge
public void addEdge(int weight, T from, T to)
- Parameters:
weight
- - Represents one ofTestRunner.PriorityWeight
ordinals indicating the weightage of a particular node in the graphfrom
- - Represents the edge that depends on another edge.to
- - Represents the edge on which another edge depends upon.
-
addEdge
public void addEdge(int weight, T from, java.lang.Iterable<T> tos)
Add an edge between two nodes.
-
addEdges
private void addEdges(java.util.List<DynamicGraph.Edge<T>> edges)
-
getNode
private static <T> DynamicGraph.Edge<T> getNode(ListMultiMap<T,DynamicGraph.Edge<T>> edges, DynamicGraph.Edge<T> edge)
-
getFreeNodes
public java.util.List<T> getFreeNodes()
- Returns:
- a set of all the nodes that don't depend on any other nodes.
-
getLowestEdgePriority
private int getLowestEdgePriority(java.util.Collection<T> nodes)
-
hasAllEdgesWithLevel
private static <T> boolean hasAllEdgesWithLevel(java.util.List<DynamicGraph.Edge<T>> edges, int level)
-
getUnfinishedNodes
private java.util.Collection<? extends T> getUnfinishedNodes(T node)
- Returns:
- a list of all the nodes that have a status other than FINISHED.
-
setStatus
public void setStatus(java.util.Collection<T> nodes, DynamicGraph.Status status)
Set the status for a set of nodes.
-
setStatus
public void setStatus(T node, DynamicGraph.Status status)
Set the status for a node.
-
getNodeCount
public int getNodeCount()
- Returns:
- the number of nodes in this graph.
-
getNodeCountWithStatus
public int getNodeCountWithStatus(DynamicGraph.Status status)
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
getName
private java.lang.String getName(T t)
-
toDot
public java.lang.String toDot()
- Returns:
- a .dot file (GraphViz) version of this graph.
-
getEdges
public ListMultiMap<T,DynamicGraph.Edge<T>> getEdges()
-
-