Class DependencyGraph<V>

java.lang.Object
com.atlassian.plugin.webresource.graph.DependencyGraph<V>
Type Parameters:
V - The vertex type.

public class DependencyGraph<V> extends Object
Maps the dependencies between items of a given type, where the vertex is the item and the edge is their dependency relation.
  • Constructor Details

    • DependencyGraph

      public DependencyGraph(@Nonnull Class<V> verticeClazz)
    • DependencyGraph

      public DependencyGraph(@Nonnull Class<V> verticeClazz, @Nonnull org.jgrapht.Graph<V,DependencyEdge> resourceGraph)
  • Method Details

    • builder

      @Nonnull public static DependencyGraphBuilder builder()
    • equals

      public boolean equals(@Nullable Object other)
      Overrides:
      equals in class Object
    • findCyclicSubGraphByVertex

      @Nonnull public DependencyGraph<V> findCyclicSubGraphByVertex(@Nonnull V sourceKey)
      Identify all the cycles contained inside the graph.
      Parameters:
      sourceKey - The source requestable resource key used as start point.
      Returns:
      A map where the key is the requestable and the value is the subgraph for
    • findDependantsSubGraphByKey

      @Nonnull public DependencyGraph<V> findDependantsSubGraphByKey(@Nonnull V sourceKey)
      Retrieve a sub graph of dependants based on a certain source requestable key.
      Parameters:
      sourceKey - The source requestable resource key used as start point.
      Returns:
      The dependency graph.
    • findDependencySubGraphByRequestableKey

      @Nonnull public DependencyGraph<V> findDependencySubGraphByRequestableKey(@Nonnull V sourceKey)
      Retrieve a sub graph of dependency based on a certain source requestable key.
      Parameters:
      sourceKey - The source requestable key used as start point.
      Returns:
      The dependency graph.
    • findIntersectionSubGraph

      @Nonnull public DependencyGraph<V> findIntersectionSubGraph(@Nonnull V sourceKey, @Nonnull V targetKey)
      Find the intersection between two sub-graphs generated based on a source requestable key and target requestable key.
      Parameters:
      sourceKey - The source requestable key used as start point for the first sub-graph to compare.
      targetKey - The target requestable key used start point for the second sub-graph to compare.
      Returns:
      The dependency graph representing the intersection between both graphs.
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • getEdges

      public Collection<DependencyEdge> getEdges()
    • hasDependency

      public boolean hasDependency(V key)