Interface AstSelect

All Superinterfaces:
Iterable<AstNode>
All Known Implementing Classes:
EmptyAstSelect, ListAstSelect, SingleAstSelect

@Deprecated public interface AstSelect extends Iterable<AstNode>
Deprecated.
in 1.22
An immutable ordered collection of AST nodes with operations for selection. Use AstNode.select() to obtain an instance of this interface.

This interface is not intended to be implemented by clients.

Since:
1.18
  • Method Summary

    Modifier and Type
    Method
    Description
    Deprecated.
    Returns new selection, which contains children of this selection.
    Deprecated.
    Returns new selection, which contains children of a given type of this selection.
    Deprecated.
    Returns new selection, which contains children of a given types of this selection.
    Deprecated.
    Returns new selection, which contains descendants of a given type of this selection.
    Deprecated.
    Returns new selection, which contains descendants of a given types of this selection.
    Deprecated.
    Returns new selection, which contains elements of this selection that have given type.
    filter(AstNodeType... types)
    Deprecated.
    Returns new selection, which contains elements of this selection that have any one of the given types.
    filter(Predicate<AstNode> predicate)
    Deprecated.
    Returns new selection, which contains elements of this selection that satisfy a predicate.
    Deprecated.
    Returns new selection, which contains first ancestor of a given type for each node from this selection.
    Deprecated.
    Returns new selection, which contains first ancestor of one of the given types for each node from this selection.
    get(int index)
    Deprecated.
    Returns the element at the specified position in this selection.
    boolean
    Deprecated.
    Returns true if this selection contains no elements.
    boolean
    Deprecated.
    Returns true if this selection contains elements.
    Deprecated.
    Returns an iterator over the elements in this selection.
    Deprecated.
    Returns new selection, which contains next sibling for each node from this selection.
    Deprecated.
    Returns new selection, which contains parent for each node from this selection.
    Deprecated.
    Returns new selection, which contains previous sibling for each node from this selection.
    int
    Deprecated.
    Returns the number of elements in this selection.

    Methods inherited from interface java.lang.Iterable

    forEach, spliterator
  • Method Details

    • children

      AstSelect children()
      Deprecated.
      Returns new selection, which contains children of this selection.
    • children

      AstSelect children(AstNodeType type)
      Deprecated.
      Returns new selection, which contains children of a given type of this selection.

      In the following case, children("B") would return "B2" and "B3":

       A1
        |__ C1
        |    |__ B1
        |__ B2
        |__ B3
       
    • children

      AstSelect children(AstNodeType... types)
      Deprecated.
      Returns new selection, which contains children of a given types of this selection.
      See Also:
    • nextSibling

      AstSelect nextSibling()
      Deprecated.
      Returns new selection, which contains next sibling for each node from this selection.

      In the following case, for selection "B1" nextSibling() would return "B2":

       A1
        |__ B1
        |    |__ C1
        |__ B2
       
    • previousSibling

      AstSelect previousSibling()
      Deprecated.
      Returns new selection, which contains previous sibling for each node from this selection.

      In the following case, for selection "B2" previousSibling() would return "B1":

       A1
        |__ B1
        |    |__ C1
        |__ B2
       
    • parent

      AstSelect parent()
      Deprecated.
      Returns new selection, which contains parent for each node from this selection.
    • firstAncestor

      AstSelect firstAncestor(AstNodeType type)
      Deprecated.
      Returns new selection, which contains first ancestor of a given type for each node from this selection.

      In the following case, for selection "B2" firstAncestor("A") would return "A2":

       A1
        |__ A2
             |__ B1
             |__ B2
       
    • firstAncestor

      AstSelect firstAncestor(AstNodeType... types)
      Deprecated.
      Returns new selection, which contains first ancestor of one of the given types for each node from this selection.
      See Also:
    • descendants

      AstSelect descendants(AstNodeType type)
      Deprecated.
      Returns new selection, which contains descendants of a given type of this selection. Be careful, this method searches among all descendants whatever is their depth, so favor children(AstNodeType) when possible.

      In the following case, getDescendants("B") would return "B1", "B2" and "B3":

       A1
        |__ C1
        |    |__ B1
        |__ B2
        |__ D1
        |__ B3
       
    • descendants

      AstSelect descendants(AstNodeType... types)
      Deprecated.
      Returns new selection, which contains descendants of a given types of this selection.
      See Also:
    • isEmpty

      boolean isEmpty()
      Deprecated.
      Returns true if this selection contains no elements.
      Returns:
      true if this selection contains no elements
    • isNotEmpty

      boolean isNotEmpty()
      Deprecated.
      Returns true if this selection contains elements.
      Returns:
      true if this selection contains elements
    • filter

      AstSelect filter(AstNodeType type)
      Deprecated.
      Returns new selection, which contains elements of this selection that have given type.
    • filter

      AstSelect filter(AstNodeType... types)
      Deprecated.
      Returns new selection, which contains elements of this selection that have any one of the given types.
    • filter

      AstSelect filter(Predicate<AstNode> predicate)
      Deprecated.
      Returns new selection, which contains elements of this selection that satisfy a predicate.
    • size

      int size()
      Deprecated.
      Returns the number of elements in this selection.
      Returns:
      the number of elements in this selection
    • get

      AstNode get(int index)
      Deprecated.
      Returns the element at the specified position in this selection.
      Parameters:
      index - index of the element to return
      Returns:
      the element at the specified position in this selection
      Throws:
      IndexOutOfBoundsException - if the index is out of range (index < 0 || index >= size())
    • iterator

      Iterator<AstNode> iterator()
      Deprecated.
      Returns an iterator over the elements in this selection.
      Specified by:
      iterator in interface Iterable<AstNode>
      Returns:
      an iterator over the elements in this selection