Interface Selector


public interface Selector
Matches a set of shapes using a selector expression.
  • Field Details

    • IDENTITY

      static final Selector IDENTITY
      A selector that always returns all provided values.
  • Method Details

    • parse

      static Selector parse(String expression)
      Parses a selector expression.
      Parameters:
      expression - Expression to parse.
      Returns:
      Returns the parsed Selector.
    • fromNode

      static Selector fromNode(Node node)
      Creates a Selector from a Node.
      Parameters:
      node - Node to parse.
      Returns:
      Returns the created selector.
      Throws:
      SourceException - on error.
    • select

      default Set<Shape> select(Model model)
      Matches a selector to a model.
      Parameters:
      model - Model used to resolve shapes with.
      Returns:
      Returns the matching shapes.
    • consumeMatches

      default void consumeMatches(Model model, Consumer<Selector.ShapeMatch> shapeMatchConsumer)
      Matches a selector to a set of shapes and receives each matched shape with the variables that were set when the shape was matched.
      Parameters:
      model - Model to select shapes from.
      shapeMatchConsumer - Receives each matched shape and the vars available when the shape was matched.
    • shapes

      Stream<Shape> shapes(Model model)
      Returns a stream of shapes in a model that match the selector.
      Parameters:
      model - Model to match the selector against.
      Returns:
      Returns a stream of matching shapes.
    • matches

      Stream<Selector.ShapeMatch> matches(Model model)
      Returns a stream of Selector.ShapeMatch objects for each match found in a model.
      Parameters:
      model - Model to match the selector against.
      Returns:
      Returns a stream of ShapeMatch objects.
    • runner

      @Deprecated default Selector.Runner runner()
      Deprecated.
      Creates a Selector Runner, used to customize how a selector is executed.
      Returns:
      Returns the created runner.