Class DynamicGraph<T>

  • All Implemented Interfaces:
    IDynamicGraph<T>

    public class DynamicGraph<T>
    extends java.lang.Object
    implements IDynamicGraph<T>
    Representation of the graph of methods.
    • Field Detail

      • m_nodesReady

        private final java.util.Set<T> m_nodesReady
      • m_nodesRunning

        private final java.util.Set<T> m_nodesRunning
      • m_nodesFinished

        private final java.util.Set<T> m_nodesFinished
    • Constructor Detail

      • DynamicGraph

        public DynamicGraph()
    • Method Detail

      • addNode

        public boolean addNode​(T node)
        Add a node to the graph.
        Specified by:
        addNode in interface IDynamicGraph<T>
      • addEdge

        public void addEdge​(int weight,
                            T from,
                            T to)
        Specified by:
        addEdge in interface IDynamicGraph<T>
        Parameters:
        weight - - Represents one of TestRunner.PriorityWeight ordinals indicating the weightage of a particular node in the graph
        from - - Represents the edge that depends on another edge.
        to - - Represents the edge on which another edge depends upon.
      • addEdges

        public void addEdges​(int weight,
                             T from,
                             java.lang.Iterable<T> tos)
        Add an edge between two nodes.
        Specified by:
        addEdges in interface IDynamicGraph<T>
      • getFreeNodes

        public java.util.List<T> getFreeNodes()
        Specified by:
        getFreeNodes in interface IDynamicGraph<T>
        Returns:
        a set of all the nodes that don't depend on any other nodes.
      • dependencies

        private java.util.List<T> dependencies​(java.util.Map<T,​java.lang.Integer> dependencies)
      • getNodeCount

        public int getNodeCount()
        Specified by:
        getNodeCount in interface IDynamicGraph<T>
        Returns:
        the number of nodes in this graph.
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • dotShortName

        private static <T> java.lang.String dotShortName​(T t)
      • toDot

        public java.lang.String toDot()
        Specified by:
        toDot in interface IDynamicGraph<T>
        Returns:
        a .dot file (GraphViz) version of this graph.
      • getEdges

        java.util.Map<T,​java.util.Map<T,​java.lang.Integer>> getEdges()
        For tests only