Class GetAttrSelector

All Implemented Interfaces:
Comparable<Item>, Iterable<Item>, Debug, Display

public final class GetAttrSelector extends Selector
  • Constructor Details

    • GetAttrSelector

      public GetAttrSelector(Text key, Selector then)
  • Method Details

    • accessor

      public Text accessor()
    • then

      public Selector then()
      Description copied from class: Selector
      Returns the Selector that this Selector uses to match sub-selections.
      Specified by:
      then in class Selector
    • forSelected

      public <T> T forSelected(Interpreter interpreter, Selectee<T> callback)
      Description copied from class: Selector
      Evaluates callback.selected against the Items that match this Selector's selection criteria. That is, it pushes such Items to interpreter, then invokes callback against it. To support chained Selectors, this is a recursive procedure that invokes forSelected through this.then wherever it exists (which it always does outside of IdentitySelector); we define "subselection" to be such an invocation.
      Specified by:
      forSelected in class Selector
      Returns:
      the result of executing callback from the context of the last Selector in the chain formed by Selector then fields.
    • mapSelected

      public Item mapSelected(Interpreter interpreter, Selectee<Item> transform)
      Specified by:
      mapSelected in class Selector
    • substitute

      public Item substitute(Interpreter interpreter)
      Overrides:
      substitute in class Item
    • andThen

      public Selector andThen(Selector then)
      Description copied from class: Selector
      The means to chain Selectors. By intention, this is NOT a strict functional composition: for two Selectors s1 and s2, s1.andThen(s2) DOES NOT NECESSARILY return a new Selector s3 such that s3.evaluate(args) is equivalent to s2.evaluate(s1.evaluate(args)).

      The reason for this is that for Selectors like ChildrenSelector that yield (logical) collections, we wish to invoke the next Selector, say a GetSelector, against every result. Under strict functional rules, ChildrenSelector.andThen(someGetSelector).evaluate(args) would instead return at most one defined value regardless of the number of children.

      Specified by:
      andThen in class Selector
    • typeOrder

      public int typeOrder()
      Description copied from class: Item
      Returns the heterogeneous sort order of this Item. Used to impose a total order on the set of all items. When comparing two items of different types, the items order according to their typeOrder.
      Specified by:
      typeOrder in class Item
    • compareTo

      protected int compareTo(Selector that)
      Specified by:
      compareTo in class Selector
    • equals

      public boolean equals(Object other)
      Specified by:
      equals in class Item
    • hashCode

      public int hashCode()
      Specified by:
      hashCode in class Item
    • debugThen

      public <T> Output<T> debugThen(Output<T> output)
      Specified by:
      debugThen in class Selector