Constructor and Description |
---|
SingleAstSelect(AstNode node) |
Modifier and Type | Method and Description |
---|---|
AstSelect |
children()
Returns new selection, which contains children of this selection.
|
AstSelect |
children(AstNodeType... types)
Returns new selection, which contains children of a given types of this selection.
|
AstSelect |
children(AstNodeType type)
Returns new selection, which contains children of a given type of this selection.
|
AstSelect |
descendants(AstNodeType... types)
Returns new selection, which contains descendants of a given types of this selection.
|
AstSelect |
descendants(AstNodeType type)
Returns new selection, which contains descendants of a given type of this selection.
|
AstSelect |
filter(AstNodeType... types)
Returns new selection, which contains elements of this selection that have any one of the given types.
|
AstSelect |
filter(AstNodeType type)
Returns new selection, which contains elements of this selection that have given type.
|
AstSelect |
filter(com.google.common.base.Predicate<AstNode> predicate)
Returns new selection, which contains elements of this selection that satisfy a predicate.
|
AstSelect |
firstAncestor(AstNodeType... types)
Returns new selection, which contains first ancestor of one of the given types for each node from this selection.
|
AstSelect |
firstAncestor(AstNodeType type)
Returns new selection, which contains first ancestor of a given type for each node from this selection.
|
AstNode |
get(int index)
Returns the element at the specified position in this selection.
|
boolean |
isEmpty()
Returns true if this selection contains no elements.
|
boolean |
isNotEmpty()
Returns true if this selection contains elements.
|
Iterator<AstNode> |
iterator()
Returns an iterator over the elements in this selection.
|
AstSelect |
nextSibling()
Returns new selection, which contains next sibling for each node from this selection.
|
AstSelect |
parent()
Returns new selection, which contains parent for each node from this selection.
|
AstSelect |
previousSibling()
Returns new selection, which contains previous sibling for each node from this selection.
|
int |
size()
Returns the number of elements in this selection.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
forEach, spliterator
public SingleAstSelect(AstNode node)
public AstSelect children()
AstSelect
public AstSelect children(AstNodeType type)
AstSelect
In the following case, children("B")
would return "B2" and "B3":
A1 |__ C1 | |__ B1 |__ B2 |__ B3
public AstSelect children(AstNodeType... types)
AstSelect
children
in interface AstSelect
AstSelect.children(AstNodeType)
public AstSelect nextSibling()
AstSelect
In the following case, for selection "B1" nextSibling()
would return "B2":
A1 |__ B1 | |__ C1 |__ B2
nextSibling
in interface AstSelect
public AstSelect previousSibling()
AstSelect
In the following case, for selection "B2" previousSibling()
would return "B1":
A1 |__ B1 | |__ C1 |__ B2
previousSibling
in interface AstSelect
public AstSelect parent()
AstSelect
public AstSelect firstAncestor(AstNodeType type)
AstSelect
In the following case, for selection "B2" firstAncestor("A")
would return "A2":
A1 |__ A2 |__ B1 |__ B2
firstAncestor
in interface AstSelect
public AstSelect firstAncestor(AstNodeType... types)
AstSelect
firstAncestor
in interface AstSelect
AstSelect.firstAncestor(AstNodeType)
public AstSelect descendants(AstNodeType type)
AstSelect
AstSelect.children(AstNodeType)
when possible.
In the following case, getDescendants("B")
would return "B1", "B2" and "B3":
A1 |__ C1 | |__ B1 |__ B2 |__ D1 |__ B3
descendants
in interface AstSelect
public AstSelect descendants(AstNodeType... types)
AstSelect
descendants
in interface AstSelect
AstSelect.descendants(AstNodeType)
public boolean isEmpty()
AstSelect
public boolean isNotEmpty()
AstSelect
isNotEmpty
in interface AstSelect
public AstSelect filter(AstNodeType type)
AstSelect
public AstSelect filter(AstNodeType... types)
AstSelect
public AstSelect filter(com.google.common.base.Predicate<AstNode> predicate)
AstSelect
public int size()
AstSelect
public AstNode get(int index)
AstSelect
Copyright © 2009–2017 SonarSource. All rights reserved.