Package jetbrains.buildServer.util.graph
Class VcsDAGs
- java.lang.Object
-
- jetbrains.buildServer.util.graph.VcsDAGs
-
public class VcsDAGs extends Object
- Author:
- dmitry.neverov
-
-
Field Summary
Fields Modifier and Type Field Description static String
VCS_DAG_CHUNK_SIZE
-
Constructor Summary
Constructors Constructor Description VcsDAGs()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static BaseModificationDAG
addEdges(DAG<Long> dag, Collection<? extends Pair<Long,Long>> edges)
static BaseModificationDAG
addEdges(DAG<Long> dag, Collection<? extends Pair<Long,Long>> edges, AdditionalNodesSupplier nodesSupplier)
Returns DAG that contains edges from given DAG and specified additional edges.static LinearDag
addNodes(DAG<Long> dag, List<Long> nodes)
Adds nodes to the given linear dag.static void
childrenFirstSearch(DAG<Long> dag, BFSVisitor<Long> visitor, Set<Long> starts)
Runs children-first search on the given dag with specified visitor and start nodes.static BaseModificationDAG
createFromEdges(Collection<? extends Pair<Long,Long>> edges)
static BaseModificationDAG
createFromEdges(Collection<? extends Pair<Long,Long>> edges, AdditionalNodesSupplier nodesSupplier)
Returns DAG created from collection of edgesstatic LinearDag
createLinearDag(List<Long> nodes)
Returns linear DAG created from given nodesstatic ReachabilityPredicate
createReachabilityPredicate(DAG<Long> dag)
Returns a reachability predicate for the given VCS dag (dag where children have higher ids than parents)static DAG<Long>
emptyDAG()
-
-
-
Field Detail
-
VCS_DAG_CHUNK_SIZE
public static final String VCS_DAG_CHUNK_SIZE
- See Also:
- Constant Field Values
-
-
Method Detail
-
createFromEdges
@NotNull public static BaseModificationDAG createFromEdges(@NotNull Collection<? extends Pair<Long,Long>> edges, @Nullable AdditionalNodesSupplier nodesSupplier)
Returns DAG created from collection of edges- Parameters:
edges
- edges of DAG- Returns:
- see above
-
createFromEdges
@NotNull public static BaseModificationDAG createFromEdges(@NotNull Collection<? extends Pair<Long,Long>> edges)
-
createLinearDag
public static LinearDag createLinearDag(@NotNull List<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 BaseModificationDAG addEdges(@NotNull DAG<Long> dag, @NotNull Collection<? extends Pair<Long,Long>> edges, @Nullable AdditionalNodesSupplier nodesSupplier)
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 DAGedges
- additional edges- Returns:
- see above
-
addEdges
@NotNull public static BaseModificationDAG addEdges(@NotNull DAG<Long> dag, @NotNull Collection<? extends Pair<Long,Long>> edges)
-
addNodes
public static LinearDag addNodes(@NotNull DAG<Long> dag, @NotNull List<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 addednodes
- nodes to add- Returns:
- see above
-
childrenFirstSearch
public static void childrenFirstSearch(@NotNull DAG<Long> dag, @NotNull BFSVisitor<Long> visitor, @NotNull Set<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 traversvisitor
- visitor to usestarts
- node where traversal should begin
-
createReachabilityPredicate
@NotNull public static ReachabilityPredicate createReachabilityPredicate(@NotNull DAG<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
-
-