Class STNodePredicates

java.lang.Object
io.nosqlbench.nb.spectest.traversal.STNodePredicates
All Implemented Interfaces:
STDebug, Function<com.vladsch.flexmark.util.ast.Node,Optional<List<com.vladsch.flexmark.util.ast.Node>>>

public class STNodePredicates extends Object implements Function<com.vladsch.flexmark.util.ast.Node,Optional<List<com.vladsch.flexmark.util.ast.Node>>>, STDebug

STNodePredicates is a convenient wrapper around STNodePredicate evaluation so that creating a Node scanner is a one-liner. Any of the supported types for STNodePredicate are valid, in addition to numbers which reference previous positions in the argument list (zero-indexed.)

This allows for existing node matchers to be re-used by reference. For Example, a specification like

new NodePredicates("__\\w__",0,0)
represents a regular expression which would match "__a__" or "__b__" and then two more subsequent matches against similar content, for a total of 3 consecutive matching nodes.

  • Constructor Details

    • STNodePredicates

      public STNodePredicates(Object... predicateSpecs)
  • Method Details

    • apply

      public Optional<List<com.vladsch.flexmark.util.ast.Node>> apply(com.vladsch.flexmark.util.ast.Node node)
      Specified by:
      apply in interface Function<com.vladsch.flexmark.util.ast.Node,Optional<List<com.vladsch.flexmark.util.ast.Node>>>
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • applyDebugging

      public void applyDebugging(boolean enabled)
      Specified by:
      applyDebugging in interface STDebug