public FilteratorImpl<T> filter(Predicate<T> matchCondition) { return new FilteratorImpl<T>(this, matchCondition); }
/** * Expose a filtered view of this FlowScanner's output. * @param filterCondition Filterator only returns {@link FlowNode}s matching this predicate. * @return A {@link Filterator} against this FlowScanner, which can be filtered in additional ways. */ @Override @Nonnull public Filterator<FlowNode> filter(@Nonnull Predicate<FlowNode> filterCondition) { return new FilteratorImpl<FlowNode>(this, filterCondition); }
/** * Returns all {@link BlockStartNode}s enclosing the given FlowNode, starting from the inside out. * This is useful if we want to obtain information about its scope, such as the workspace, parallel branch, or label. * Warning: while this is efficient for one node, batch operations are far more efficient when handling many nodes. * <p>Deprecated, prefer {@link FlowNode#iterateEnclosingBlocks()} instead, possibly using {@link FilteratorImpl#FilteratorImpl(Iterator, Predicate)} * or Guava or Java 8 APIs if filtering needed. * @param f {@link FlowNode} to start from. * @return Iterator that returns all enclosing BlockStartNodes from the inside out. */ @Nonnull @Deprecated public static Filterator<FlowNode> fetchEnclosingBlocks(@Nonnull FlowNode f) { return new FilteratorImpl<>((Iterator)(f.iterateEnclosingBlocks().iterator()), Predicates.<FlowNode>alwaysTrue()); } }