public static List < ExecutableNode > sortExecutableNodes ( final ExecutableFlow flow ) { final List < ExecutableNode > sortedNodes = new ArrayList <> ( ) ; if ( flow != null ) { final List < String > startNodeIds = flow . getStartNodes ( ) ; String nextNodeId = startNodeIds . isEmpty ( ) ? null : startNodeIds . get ( 0 ) ; while ( nextNodeId != null ) { final ExecutableNode node = flow . getExecutableNode ( nextNodeId ) ; sortedNodes . add ( node ) ; final Set < String > outNodes = node . getOutNodes ( ) ; nextNodeId = outNodes . isEmpty ( ) ? null : outNodes . iterator ( ) . next ( ) ; } } return sortedNodes ; }
Returns a list of the executable nodes in the specified flow in execution order . Assumes that the flow is linear .