Class AntPatternTreeMatcher


  • public class AntPatternTreeMatcher
    extends Object
    • Constructor Detail

      • AntPatternTreeMatcher

        public AntPatternTreeMatcher()
    • Method Detail

      • scan

        public static <T extends PathNode<T>> Collection<T> scan​(@NotNull
                                                                 T node,
                                                                 @NotNull
                                                                 Collection<String> includeRules,
                                                                 @NotNull
                                                                 Collection<String> excludeRules,
                                                                 AntPatternTreeMatcher.ScanOption... options)
        Searches for necessary elements within the tree node using supplied collections of include and exclude rules.
        Exclude rules are applied first.
        Type Parameters:
        T - an implementation of PathNode
        Parameters:
        node - root node
        includeRules - set of include rules (without leading +:)
        excludeRules - set of exclude rules (without leading -:)
        options - set of options from AntPatternTreeMatcher.ScanOption
        Returns:
        matching elements
      • scan

        public static <T extends PathNode<T>> Collection<T> scan​(@NotNull
                                                                 T node,
                                                                 @NotNull
                                                                 Collection<String> mixedRules,
                                                                 AntPatternTreeMatcher.ScanOption... options)
        Searches for necessary elements within the tree node using supplied collection of search rules. All rules are considered to be include by default and applied in the provided order.
        To specify an exclude rule use the -: prefix
        Type Parameters:
        T - an implementation of PathNode
        Parameters:
        node - root node
        mixedRules - set of rules
        options - set of options from AntPatternTreeMatcher.ScanOption
        Returns:
        matching elements
      • scanWithCallback

        public static <T extends PathNode<T>> Collection<T> scanWithCallback​(@NotNull
                                                                             T node,
                                                                             @NotNull
                                                                             Collection<String> mixedRules,
                                                                             @Nullable
                                                                             AntPatternTreeMatcher.SearchCallback<T> callback,
                                                                             AntPatternTreeMatcher.ScanOption... options)
        Searches for necessary elements within the tree node using supplied collection of search rules. When element matches the search criteria, a callback function SearchCallback#nodeMatched(PathNode) is called and depending on its value, it either continues search, or stops. All rules are considered to be include by default and applied in the provided order.
        To specify an exclude rule use the -: prefix
        Type Parameters:
        T - an implementation of PathNode
        Parameters:
        node - root node
        mixedRules - set of rules
        callback - callback to call, when matching node is found.
        options - set of options from AntPatternTreeMatcher.ScanOption
        Returns:
        matching elements