Class SequenceForwardOrder

java.lang.Object
deepboof.graph.SequenceForwardOrder

public class SequenceForwardOrder
extends java.lang.Object
Orders an unsorted list of nodes so that they can be processed in sequence and have all of their dependencies meet prior to being invoked. The graph must not have islands or cycles. Some sanity checking is done to ensure that these preconditions are meet, but not all situations are currently caught.
 Assumptions:
 - One input node
 - One output node
 - No islands
 - No cycles
 
  • Nested Class Summary

    Nested Classes 
    Modifier and Type Class Description
    static class  SequenceForwardOrder.NodeData  
  • Constructor Summary

    Constructors 
    Constructor Description
    SequenceForwardOrder​(java.util.List<Node<?,​?>> list)
    Constructor
  • Method Summary

    Modifier and Type Method Description
    protected void assignDepth()
    Assigns a depth from the input node for all the elements in the graph.
    protected SequenceForwardOrder.NodeData findInput()
    Finds the input node.
    java.util.List<Node<?,​?>> putIntoForwardOrder()
    Orders list to ensure sequential forward ordering of nodes.

    Methods inherited from class java.lang.Object

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

    • SequenceForwardOrder

      public SequenceForwardOrder​(java.util.List<Node<?,​?>> list)
      Constructor
      Parameters:
      list - Input list, not modified.
  • Method Details

    • putIntoForwardOrder

      public java.util.List<Node<?,​?>> putIntoForwardOrder()
      Orders list to ensure sequential forward ordering of nodes.
      Returns:
      Ordered list of nodes.
    • assignDepth

      protected void assignDepth()
      Assigns a depth from the input node for all the elements in the graph. Depth is defined as the distance of the longest path to the node.
    • findInput

      protected SequenceForwardOrder.NodeData findInput()
      Finds the input node. Throws an error if there isn't one and only one input node
      Returns:
      Input node