/** * Creates a new postorder list generator. */ public PostorderNodeListGenerator() { visits = new Stack<Boolean>(); }
/** * Creates a new visitor that clones the visited nodes. */ public CloningDependencyVisitor() { parents = new Stack<DependencyNode>(); clones = new IdentityHashMap<DependencyNode, DependencyNode>( 256 ); }
/** * Creates a new visitor that delegates traversal of nodes matching the given filter to the specified visitor. * * @param visitor The visitor to delegate to, must not be {@code null}. * @param filter The filter to apply, may be {@code null} to not filter. */ public FilteringDependencyVisitor( DependencyVisitor visitor, DependencyFilter filter ) { if ( visitor == null ) { throw new IllegalArgumentException( "dependency visitor not specified" ); } this.visitor = visitor; this.filter = filter; this.accepts = new Stack<Boolean>(); this.parents = new Stack<DependencyNode>(); }
/** * Creates a new visitor that uses the specified filter to identify terminal nodes of interesting paths. * * @param filter The filter used to select terminal nodes of paths to record, may be {@code null} to match any node. * @param excludeChildrenOfMatches Flag controlling whether children of matched nodes should be excluded from the * traversal, thereby ignoring any potential paths to other matching nodes beneath a matching ancestor * node. If {@code true}, all recorded paths will have only one matching node (namely the terminal node), * if {@code false} a recorded path can consist of multiple matching nodes. */ public PathRecordingDependencyVisitor( DependencyFilter filter, boolean excludeChildrenOfMatches ) { this.filter = filter; this.excludeChildrenOfMatches = excludeChildrenOfMatches; paths = new ArrayList<List<DependencyNode>>(); parents = new Stack<DependencyNode>(); }
/** * Creates a new visitor that delegates to the specified visitor. * * @param visitor The visitor to delegate to, must not be {@code null}. */ public TreeDependencyVisitor( DependencyVisitor visitor ) { if ( visitor == null ) { throw new IllegalArgumentException( "no visitor delegate specified" ); } this.visitor = visitor; visitedNodes = new IdentityHashMap<DependencyNode, Object>( 512 ); visits = new Stack<Boolean>(); }