public final class Trees
extends java.lang.Object
trees
.Modifier and Type | Method and Description |
---|---|
static @NotNull java.util.Set<Tree> |
children(@NotNull Tree tree)
Collect all the children of the given
tree and add them to the given result . |
static @NotNull java.util.Set<Tree> |
collect(@NotNull Tree tree)
Collect all the relatives to the given
tree (including the tree itself). |
static @NotNull java.util.List<Tree> |
flatChildren(@NotNull Tree tree)
Return an ordered list containing the children of the given
tree alongside
with newly created trees that fills the gaps between the children of the given
tree . |
static int |
line(@NotNull Tree tree)
Get the line of the given
tree on its document. |
static int |
positionInLine(@NotNull Tree tree)
Return the position of the given
tree on its line. |
static @NotNull java.lang.CharSequence |
read(@NotNull Tree tree)
Read the source-code of the given
tree . |
static @Nullable java.lang.CharSequence |
readLine(@NotNull Tree tree)
Read the whole line that the given
tree is at on its document. |
static @NotNull Tree |
root(@NotNull Tree tree)
Return the root tree of the given
tree . |
static @NotNull Tree[] |
toArray(@NotNull Tree tree)
Return an array containing the current children of the given
tree . |
@NotNull @Contract(value="_->new", pure=true) public static @NotNull java.util.Set<Tree> children(@NotNull @NotNull Tree tree)
tree
and add them to the given result
.tree
- the tree to get its children.tree
.java.lang.NullPointerException
- if the given tree
is null.@NotNull @Contract(value="_->new", pure=true) public static @NotNull java.util.Set<Tree> collect(@NotNull @NotNull Tree tree)
tree
(including the tree itself).tree
- the tree to collect its relatives.tree
.java.lang.NullPointerException
- if the given tree
is null.@NotNull @Contract(value="_->new", pure=true) public static @NotNull java.util.List<Tree> flatChildren(@NotNull @NotNull Tree tree)
tree
alongside
with newly created trees that fills the gaps between the children of the given
tree
.tree
- the tree.tree
.java.lang.NullPointerException
- if the given tree
is null.@Contract(pure=true) public static int line(@NotNull @NotNull Tree tree)
tree
on its document.tree
- the tree to get its line.tree
.java.lang.NullPointerException
- if the given tree
is null.java.io.IOError
- if any I/O error occurred while reading.DocumentNotFoundError
- if the document of the given tree
is
unavailable.@Contract(pure=true) public static int positionInLine(@NotNull @NotNull Tree tree)
tree
on its line.tree
- the tree to get its position in its line.tree
on its line.java.lang.NullPointerException
- if the given tree
is null.java.io.IOError
- if any I/O error occurred while reading.DocumentNotFoundError
- if the document of the given tree
is
unavailable.@NotNull @Contract(pure=true) public static @NotNull java.lang.CharSequence read(@NotNull @NotNull Tree tree)
tree
.tree
- the tree to read its source-code.tree
.java.lang.NullPointerException
- if the given tree
is null.java.io.IOError
- if any I/O error occurred while reading.DocumentNotFoundError
- if the document of the given tree
is
unavailable.@Nullable @Contract(pure=true) public static @Nullable java.lang.CharSequence readLine(@NotNull @NotNull Tree tree)
tree
is at on its document.tree
- the tree to read the line it is in.tree
is at.java.lang.NullPointerException
- if the given tree
is null.java.io.IOError
- if any I/O error occurred while reading.DocumentNotFoundError
- if the document of the given tree
is
unavailable.@NotNull @Contract(pure=true) public static @NotNull Tree root(@NotNull @NotNull Tree tree)
tree
.tree
- the tree to get its root tree.tree
.java.lang.NullPointerException
- if the given tree
is null.@NotNull @Contract(value="_->new", pure=true) public static @NotNull Tree[] toArray(@NotNull @NotNull Tree tree)
tree
.tree
- the tree to get an array containing its current children.tree
.java.lang.NullPointerException
- if the given tree
is null.