public List<PlanNode> findAllFirstNodesAtOrBelow( Type typeToFind ) {
        List<PlanNode> results = new LinkedList<PlanNode>();
        LinkedList<PlanNode> queue = new LinkedList<PlanNode>();
        queue.add(this);
        while (!queue.isEmpty()) {
            PlanNode aNode = queue.poll();
            if (aNode.getType() == Type.PROJECT) {
                results.add(aNode);
            } else {
                queue.addAll(0, aNode.getChildren());
            }
        }
        return results;
    }
public List < PlanNode > findAllFirstNodesAtOrBelow ( Type typeToFind ) { List < PlanNode > results = new LinkedList < PlanNode > ( ) ; LinkedList < PlanNode > queue = new LinkedList < PlanNode > ( ) ; queue . add ( this ) ; while ( ! queue . isEmpty ( ) ) { PlanNode aNode = queue . poll ( ) ; if ( aNode . getType ( ) == Type . PROJECT ) { results . add ( aNode ) ; } else { queue . addAll ( 0 , aNode . getChildren ( ) ) ; } } return results ; }
Look at nodes below this node, searching for nodes that have the supplied type. As soon as a node with a matching type is
found, then no other nodes below it are searched.

@param typeToFind the type of node to find; may not be null
@return the collection of nodes that are at or below this node that all have the supplied type; never null but possibly
empty