Class VcsDAGs


  • public class VcsDAGs
    extends java.lang.Object
    Author:
    dmitry.neverov
    • Constructor Summary

      Constructors 
      Constructor Description
      VcsDAGs()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static jetbrains.buildServer.util.graph.DAG<java.lang.Long> addEdges​(jetbrains.buildServer.util.graph.DAG<java.lang.Long> dag, java.util.Collection<? extends com.intellij.openapi.util.Pair<java.lang.Long,​java.lang.Long>> edges)
      Returns DAG that contains edges from given DAG and specified additional edges.
      static jetbrains.buildServer.util.graph.DAG<java.lang.Long> addNodes​(jetbrains.buildServer.util.graph.DAG<java.lang.Long> dag, java.util.List<java.lang.Long> nodes)
      Adds nodes to the given linear dag.
      static void childrenFirstSearch​(jetbrains.buildServer.util.graph.DAG<java.lang.Long> dag, jetbrains.buildServer.util.graph.BFSVisitor<java.lang.Long> visitor, java.util.Set<java.lang.Long> starts)
      Runs children-first search on the given dag with specified visitor and start nodes.
      static jetbrains.buildServer.util.graph.DAG<java.lang.Long> createFromEdges​(java.util.Collection<? extends com.intellij.openapi.util.Pair<java.lang.Long,​java.lang.Long>> edges)
      Returns DAG created from collection of edges
      static jetbrains.buildServer.util.graph.DAG<java.lang.Long> createLinearDag​(java.util.List<java.lang.Long> nodes)
      Returns linear DAG created from given nodes
      static ReachabilityPredicate createReachabilityPredicate​(jetbrains.buildServer.util.graph.DAG<java.lang.Long> dag)
      Returns a reachability predicate for the given VCS dag (dag where children have higher ids than parents)
      static jetbrains.buildServer.util.graph.DAG<java.lang.Long> emptyDAG()  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • VcsDAGs

        public VcsDAGs()
    • Method Detail

      • emptyDAG

        @NotNull
        public static jetbrains.buildServer.util.graph.DAG<java.lang.Long> emptyDAG()
      • createFromEdges

        @NotNull
        public static jetbrains.buildServer.util.graph.DAG<java.lang.Long> createFromEdges​(@NotNull
                                                                                           java.util.Collection<? extends com.intellij.openapi.util.Pair<java.lang.Long,​java.lang.Long>> edges)
        Returns DAG created from collection of edges
        Parameters:
        edges - edges of DAG
        Returns:
        see above
      • createLinearDag

        public static jetbrains.buildServer.util.graph.DAG<java.lang.Long> createLinearDag​(@NotNull
                                                                                           java.util.List<java.lang.Long> nodes)
        Returns linear DAG created from given nodes
        Parameters:
        nodes - nodes for dag, children nodes should come first
        Returns:
        see above
      • addEdges

        @NotNull
        public static jetbrains.buildServer.util.graph.DAG<java.lang.Long> addEdges​(@NotNull
                                                                                    jetbrains.buildServer.util.graph.DAG<java.lang.Long> dag,
                                                                                    @NotNull
                                                                                    java.util.Collection<? extends com.intellij.openapi.util.Pair<java.lang.Long,​java.lang.Long>> edges)
        Returns DAG that contains edges from given DAG and specified additional edges. Method assumes (but doesn't check) that new edges do not add parents to nodes in given dag, they should add only children.
        Parameters:
        dag - initial DAG
        edges - additional edges
        Returns:
        see above
      • addNodes

        public static jetbrains.buildServer.util.graph.DAG<java.lang.Long> addNodes​(@NotNull
                                                                                    jetbrains.buildServer.util.graph.DAG<java.lang.Long> dag,
                                                                                    @NotNull
                                                                                    java.util.List<java.lang.Long> nodes)
        Adds nodes to the given linear dag. Dag must implement LinearDag interface. Nodes must be sorted in descending order (caller must ensure a correct order). Returns a dag with added nodes.
        Parameters:
        dag - dag where nodes should be added
        nodes - nodes to add
        Returns:
        see above
      • childrenFirstSearch

        public static void childrenFirstSearch​(@NotNull
                                               jetbrains.buildServer.util.graph.DAG<java.lang.Long> dag,
                                               @NotNull
                                               jetbrains.buildServer.util.graph.BFSVisitor<java.lang.Long> visitor,
                                               @NotNull
                                               java.util.Set<java.lang.Long> starts)
        Runs children-first search on the given dag with specified visitor and start nodes. Children-first search is similar to BFS, but guarantees no parent is visited before its children.
        Parameters:
        dag - dag to travers
        visitor - visitor to use
        starts - node where traversal should begin
      • createReachabilityPredicate

        @NotNull
        public static ReachabilityPredicate createReachabilityPredicate​(@NotNull
                                                                        jetbrains.buildServer.util.graph.DAG<java.lang.Long> dag)
        Returns a reachability predicate for the given VCS dag (dag where children have higher ids than parents)
        Parameters:
        dag - VCS dag of interest
        Returns:
        see above