E
- the common super type of all elements in the forestpublic interface ElementForest<E extends Element<E>>
Modifier and Type | Interface and Description |
---|---|
static interface |
ElementForest.Visitor<E extends Element<E>>
A visitor of the element forest.
|
Modifier and Type | Method and Description |
---|---|
static <E extends Element<E>> |
empty(API api) |
API |
getApi() |
SortedSet<E> |
getRoots()
A sorted set of all root elements of the forest.
|
default <T extends Element<T>> |
iterateOverElements(Class<T> resultType,
boolean recurse,
Filter<? super T> filter,
Element<T> searchRoot)
Deprecated.
use the more versatile
stream(Class, boolean, Element) |
default <T extends Element<T>> |
search(Class<T> resultType,
boolean recurse,
Filter<? super T> filter,
Element<T> searchRoot)
Deprecated.
in favor of more versatile
stream(Class, boolean, Element) |
default <T extends Element<E>> |
stream(Class<T> resultType,
boolean recurse,
Element<E> searchRoot) |
<T extends Element<E>> |
stream(Class<T> resultType,
boolean recurse,
TreeFilter<E> filter,
Element<E> root)
Walks through the forest and returns a stream of elements that match the provided filter.
|
static <E extends Element<E>> |
walk(E root,
ElementForest.Visitor<E> visitor) |
static <E extends Element<E>> |
walk(ElementForest<E> forest,
ElementForest.Visitor<E> visitor) |
static <E extends Element<E>> void walk(ElementForest<E> forest, ElementForest.Visitor<E> visitor)
static <E extends Element<E>> void walk(E root, ElementForest.Visitor<E> visitor)
static <E extends Element<E>> ElementForest<E> empty(API api)
API getApi()
SortedSet<E> getRoots()
@Deprecated @Nonnull default <T extends Element<T>> List<T> search(@Nonnull Class<T> resultType, boolean recurse, @Nullable Filter<? super T> filter, @Nullable Element<T> searchRoot)
stream(Class, boolean, Element)
If the searchRoot
is not null, this is technically equivalent to calling the
Element.searchChildren(java.lang.Class, boolean, org.revapi.query.Filter)
on the
searchRoot
.
T
- the type of the elements to look forresultType
- the type of the elements to be contained in the resultsrecurse
- false to only search direct children, true for searching recursivelyfilter
- the optional filtersearchRoot
- optional element from which to conduct the search@Deprecated @Nonnull default <T extends Element<T>> Iterator<T> iterateOverElements(@Nonnull Class<T> resultType, boolean recurse, @Nullable Filter<? super T> filter, @Nullable Element<T> searchRoot)
stream(Class, boolean, Element)
@Nonnull default <T extends Element<E>> java.util.stream.Stream<T> stream(@Nonnull Class<T> resultType, boolean recurse, @Nullable Element<E> searchRoot)
<T extends Element<E>> java.util.stream.Stream<T> stream(Class<T> resultType, boolean recurse, TreeFilter<E> filter, @Nullable Element<E> root)
T
- the expected type of resultsresultType
- the expected type of resultsrecurse
- whether to recursively descend into children. If false, only the direct children of the
root are searched.filter
- the filter to use when looking for matching childrenroot
- the search root. If null, the whole element forest is searchedCopyright © 2014-2021 Lukas Krejci. All Rights Reserved.