src/main/java/org/g_node/nix/Source.java
/**
     * Get all descendant sources of the source recursively.
     * <p>
     * This method traverses the sub-tree of all child sources of the source. The traversal
     * is accomplished via breadth first and can be limited in depth. On each node or
     * source a filter is applied. If the filter returns true the respective source
     * will be added to the result list.
     *
     * @param filter   A filter function.
     * @param maxDepth The maximum depth of traversal.
     * @return A list containing the matching descendant sources.
     */
Get all descendant sources of the source recursively.

This method traverses the sub-tree of all child sources of the source. The traversal
is accomplished via breadth first and can be limited in depth. On each node or
source a filter is applied. If the filter returns true the respective source
will be added to the result list.

@param filter   A filter function.
@param maxDepth The maximum depth of traversal.
@return A list containing the matching descendant sources.
Get all descendant sources of the source recursively . This method traverses the sub - tree of all child sources of the source . The traversal is accomplished via breadth first and can be limited in depth . On each node or source a filter is applied . If the filter returns true the respective source will be added to the result list . @param filter A filter function . @param maxDepth The maximum depth of traversal . @return A list containing the matching descendant sources .
public List<Source> findSources(Predicate<Source> filter, int maxDepth) {
        List<Source> results = new ArrayList<>();
        Queue<SourceCont> todo = new LinkedList<>();
        int level = 0;
        todo.add(new SourceCont(this, level));
        while (todo.size() > 0) {
            SourceCont current = todo.remove();
            if (filter.test(current.entity)) {
                results.add(current.entity);
            }
            if (current.depth < maxDepth) {
                List<Source> children = current.entity.getSources();
                int next_depth = current.depth + 1;
                for (Source child : children) {
                    todo.add(new SourceCont(child, next_depth));
                }
            }
        }
        return results;
    }
public List < Source > findSources ( Predicate < Source > filter , int maxDepth ) { List < Source > results = new ArrayList < > ( ) ; Queue < SourceCont > todo = new LinkedList < > ( ) ; int level = 0 ; todo . add ( new SourceCont ( this , level ) ) ; while ( todo . size ( ) > 0 ) { SourceCont current = todo . remove ( ) ; if ( filter . test ( current . entity ) ) { results . add ( current . entity ) ; } if ( current . depth < maxDepth ) { List < Source > children = current . entity . getSources ( ) ; int next_depth = current . depth + 1 ; for ( Source child : children ) { todo . add ( new SourceCont ( child , next_depth ) ) ; } } } return results ; }
Get all descendant sources of the source recursively.
Get all descendant sources of the source recursively .