Class EmptyAstSelect
- java.lang.Object
-
- org.sonar.sslr.internal.ast.select.EmptyAstSelect
-
-
Constructor Summary
Constructors Constructor Description EmptyAstSelect()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description AstSelectchildren()Returns new selection, which contains children of this selection.AstSelectchildren(AstNodeType type)Returns new selection, which contains children of a given type of this selection.AstSelectchildren(AstNodeType... types)Returns new selection, which contains children of a given types of this selection.AstSelectdescendants(AstNodeType type)Returns new selection, which contains descendants of a given type of this selection.AstSelectdescendants(AstNodeType... types)Returns new selection, which contains descendants of a given types of this selection.AstSelectfilter(AstNodeType type)Returns new selection, which contains elements of this selection that have given type.AstSelectfilter(AstNodeType... types)Returns new selection, which contains elements of this selection that have any one of the given types.AstSelectfilter(Predicate<AstNode> predicate)Returns new selection, which contains elements of this selection that satisfy a predicate.AstSelectfirstAncestor(AstNodeType type)Returns new selection, which contains first ancestor of a given type for each node from this selection.AstSelectfirstAncestor(AstNodeType... types)Returns new selection, which contains first ancestor of one of the given types for each node from this selection.AstNodeget(int index)Returns the element at the specified position in this selection.booleanisEmpty()Returns true if this selection contains no elements.booleanisNotEmpty()Returns true if this selection contains elements.Iterator<AstNode>iterator()Returns an iterator over the elements in this selection.AstSelectnextSibling()Returns new selection, which contains next sibling for each node from this selection.AstSelectparent()Returns new selection, which contains parent for each node from this selection.AstSelectpreviousSibling()Returns new selection, which contains previous sibling for each node from this selection.intsize()Returns the number of elements in this selection.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
-
-
-
Method Detail
-
children
public AstSelect children()
Description copied from interface:AstSelectReturns new selection, which contains children of this selection.
-
children
public AstSelect children(AstNodeType type)
Description copied from interface:AstSelectReturns 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
public AstSelect children(AstNodeType... types)
Description copied from interface:AstSelectReturns new selection, which contains children of a given types of this selection.- Specified by:
childrenin interfaceAstSelect- See Also:
AstSelect.children(AstNodeType)
-
nextSibling
public AstSelect nextSibling()
Description copied from interface:AstSelectReturns 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
- Specified by:
nextSiblingin interfaceAstSelect
-
previousSibling
public AstSelect previousSibling()
Description copied from interface:AstSelectReturns 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
- Specified by:
previousSiblingin interfaceAstSelect
-
parent
public AstSelect parent()
Description copied from interface:AstSelectReturns new selection, which contains parent for each node from this selection.
-
firstAncestor
public AstSelect firstAncestor(AstNodeType type)
Description copied from interface:AstSelectReturns 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- Specified by:
firstAncestorin interfaceAstSelect
-
firstAncestor
public AstSelect firstAncestor(AstNodeType... types)
Description copied from interface:AstSelectReturns new selection, which contains first ancestor of one of the given types for each node from this selection.- Specified by:
firstAncestorin interfaceAstSelect- See Also:
AstSelect.firstAncestor(AstNodeType)
-
descendants
public AstSelect descendants(AstNodeType type)
Description copied from interface:AstSelectReturns 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 favorAstSelect.children(AstNodeType)when possible.In the following case,
getDescendants("B")would return "B1", "B2" and "B3":A1 |__ C1 | |__ B1 |__ B2 |__ D1 |__ B3
- Specified by:
descendantsin interfaceAstSelect
-
descendants
public AstSelect descendants(AstNodeType... types)
Description copied from interface:AstSelectReturns new selection, which contains descendants of a given types of this selection.- Specified by:
descendantsin interfaceAstSelect- See Also:
AstSelect.descendants(AstNodeType)
-
isEmpty
public boolean isEmpty()
Description copied from interface:AstSelectReturns true if this selection contains no elements.
-
isNotEmpty
public boolean isNotEmpty()
Description copied from interface:AstSelectReturns true if this selection contains elements.- Specified by:
isNotEmptyin interfaceAstSelect- Returns:
- true if this selection contains elements
-
filter
public AstSelect filter(AstNodeType type)
Description copied from interface:AstSelectReturns new selection, which contains elements of this selection that have given type.
-
filter
public AstSelect filter(AstNodeType... types)
Description copied from interface:AstSelectReturns new selection, which contains elements of this selection that have any one of the given types.
-
filter
public AstSelect filter(Predicate<AstNode> predicate)
Description copied from interface:AstSelectReturns new selection, which contains elements of this selection that satisfy a predicate.
-
size
public int size()
Description copied from interface:AstSelectReturns the number of elements in this selection.
-
get
public AstNode get(int index)
Description copied from interface:AstSelectReturns the element at the specified position in this selection.
-
-