Class DependencyGraph<ECS_TYPE>

java.lang.Object
com.hypixel.hytale.component.dependency.DependencyGraph<ECS_TYPE>
Type Parameters:
ECS_TYPE - The type of the ECS the dependency graph is for.

public class DependencyGraph<ECS_TYPE> extends Object
A directed graph representing system dependencies within an ECS.
  • Constructor Details

    • DependencyGraph

      public DependencyGraph(@Nonnull ISystem<ECS_TYPE>[] systems)
      Default Constructor for a DependencyGraph instance.
      Parameters:
      systems - The array of systems in the ECS.
  • Method Details

    • getSystems

      @Nonnull public ISystem<ECS_TYPE>[] getSystems()
    • resolveEdges

      public void resolveEdges(@Nonnull ComponentRegistry<ECS_TYPE> registry)
      Called to resolve the edges in the dependency graph.
      Parameters:
      registry - The component registry to resolve dependencies against.
    • addEdgeFromRoot

      public void addEdgeFromRoot(@Nonnull ISystem<ECS_TYPE> afterSystem, int priority)
      Called to add an edge from the root to the dependency graph.
      Parameters:
      afterSystem - The system the edge points to.
      priority - The priority of the edge.
    • addEdge

      public void addEdge(@Nonnull ISystem<ECS_TYPE> beforeSystem, @Nonnull ISystem<ECS_TYPE> afterSystem, int priority)
      Called to add an edge to the dependency graph.
      Parameters:
      beforeSystem - The system the edge points from.
      afterSystem - The system the edge points to.
      priority - The priority of the edge.
    • addEdge

      public void addEdge(@Nonnull com.hypixel.hytale.component.dependency.DependencyGraph.Edge<ECS_TYPE> edge)
      Called to add an edge to the dependency graph.
      Parameters:
      edge - The edge to add.
    • sort

      public void sort(@Nonnull ISystem<ECS_TYPE>[] sortedSystems)
      Called to sort the systems in the dependency graph.
      Parameters:
      sortedSystems - The array to store the sorted systems in.
    • toString

      @Nonnull public String toString()
      Overrides:
      toString in class Object