/** * {@inheritDoc} * @param heads Nodes to start iterating backward from by visiting their parents. <strong>Do not pass multiple heads.</strong> */ @Override public List<FlowNode> filteredNodes(Collection<FlowNode> heads, Collection<FlowNode> blackList, Predicate<FlowNode> matchCondition) { return super.filteredNodes(heads, blackList, matchCondition); }
/** * {@inheritDoc} * @param heads Head nodes to start walking from. <strong>Do not pass multiple heads.</strong> */ @Override public FlowNode findFirstMatch(Collection<FlowNode> heads, Collection<FlowNode> blackListNodes, Predicate<FlowNode> matchCondition) { return super.findFirstMatch(heads, blackListNodes, matchCondition); }
@Override public FlowNode next() { currentType = nextType; FlowNode output = super.next(); return output; }
/** * Set up for iteration/analysis on a graph of nodes, initializing the internal state * Includes null-checking on arguments to allow directly calling with unchecked inputs (simplifies use). * @param heads The head nodes we start walking from (the most recently executed nodes, * i.e. FlowExecution.getCurrentHeads() * @param blackList Nodes that we cannot visit or walk past (useful to limit scanning to only nodes after a specific point) * @return True if we can have nodes to work with, otherwise false */ public boolean setup(@CheckForNull Collection<FlowNode> heads, @CheckForNull Collection<FlowNode> blackList) { if (heads == null || heads.size() == 0) { return false; } Collection<FlowNode> fastEndNodes = convertToFastCheckable(blackList); LinkedHashSet<FlowNode> filteredHeads = new LinkedHashSet<FlowNode>(heads); filteredHeads.removeAll(fastEndNodes); if (filteredHeads.size() == 0) { return false; } reset(); myBlackList = fastEndNodes; setHeads(filteredHeads); return true; }
/** * {@inheritDoc} * @deprecated prefer {@link #setup(FlowNode)} */ @Deprecated @Override public boolean setup(Collection<FlowNode> heads) { return super.setup(heads); }
/** * {@inheritDoc} * @param heads <strong>Do not pass multiple heads.</strong> */ @Override public void visitAll(Collection<FlowNode> heads, FlowNodeVisitor visitor) { super.visitAll(heads, visitor); }
/** Convenience method to get the list of all {@link FlowNode}s for the execution, in iterator order. */ @Nonnull public List<FlowNode> allNodes(@CheckForNull FlowExecution exec) { return (exec == null) ? Collections.EMPTY_LIST : allNodes(exec.getCurrentHeads()); }
/** * Helper: version of {@link #setup(Collection, Collection)} where we don't have any nodes to blacklist */ public boolean setup(@CheckForNull Collection<FlowNode> heads) { if (heads == null) { return false; } return setup(heads, Collections.EMPTY_SET); }
/** * {@inheritDoc} * @param heads Nodes to start walking the DAG backwards from. <strong>Do not pass multiple heads.</strong> */ @Override public void visitAll(Collection<FlowNode> heads, Collection<FlowNode> blackList, FlowNodeVisitor visitor) { super.visitAll(heads, blackList, visitor); }
/** * {@inheritDoc} * @deprecated prefer {@link #setup(FlowNode, Collection)} */ @Deprecated @Override public boolean setup(Collection<FlowNode> heads, Collection<FlowNode> blackList) { return super.setup(heads, blackList); }
/** * {@inheritDoc} * @deprecated prefer {@link #findFirstMatch(FlowNode, Predicate)} */ @Deprecated @Override public FlowNode findFirstMatch(Collection<FlowNode> heads, Predicate<FlowNode> matchPredicate) { return super.findFirstMatch(heads, matchPredicate); }
/** * {@inheritDoc} * @deprecated prefer {@link #filteredNodes(FlowNode, Predicate)} */ @Deprecated @Override public List<FlowNode> filteredNodes(Collection<FlowNode> heads, Predicate<FlowNode> matchPredicate) { return super.filteredNodes(heads, matchPredicate); }
/** Syntactic sugar for {@link #visitAll(Collection, FlowNodeVisitor)} where we don't blacklist any nodes */ public void visitAll(@CheckForNull Collection<FlowNode> heads, @Nonnull FlowNodeVisitor visitor) { visitAll(heads, null, visitor); } }
@Override public FlowNode next() { if (myNext == null) { throw new NoSuchElementException(); } myCurrent = myNext; myNext = next(myCurrent, myBlackList); return myCurrent; }
/** * Helper: version of {@link #setup(Collection, Collection)} where we don't have any nodes to blacklist and have just a single head */ public boolean setup(@CheckForNull FlowNode head) { if (head == null) { return false; } return setup(Collections.singleton(head), Collections.EMPTY_SET); }
/** * {@inheritDoc} * @deprecated unsafe to call */ @Deprecated @Override public FlowNode findFirstMatch(FlowExecution exec, Predicate<FlowNode> matchPredicate) { return super.findFirstMatch(exec, matchPredicate); }
/** Syntactic sugar for {@link #filteredNodes(Collection, Collection, Predicate)} with no blackList nodes */ @Nonnull public List<FlowNode> filteredNodes(@CheckForNull Collection<FlowNode> heads, @Nonnull Predicate<FlowNode> matchPredicate) { return this.filteredNodes(heads, null, matchPredicate); }
/** * Helper: version of {@link #setup(Collection, Collection)} where we don't have any nodes to blacklist, and have just a single head */ public boolean setup(@CheckForNull FlowNode head, @CheckForNull Collection<FlowNode> blackList) { if (head == null) { return false; } return setup(Collections.singleton(head), blackList); }
/** Syntactic sugar for {@link #findFirstMatch(Collection, Collection, Predicate)} where there is no blackList */ @CheckForNull public FlowNode findFirstMatch(@CheckForNull Collection<FlowNode> heads, @Nonnull Predicate<FlowNode> matchPredicate) { return this.findFirstMatch(heads, null, matchPredicate); }
/** Syntactic sugar for {@link #filteredNodes(Collection, Collection, Predicate)} with a single head and no blackList nodes */ @Nonnull public List<FlowNode> filteredNodes(@CheckForNull FlowNode head, @Nonnull Predicate<FlowNode> matchPredicate) { return this.filteredNodes(Collections.singleton(head), null, matchPredicate); }