Class BaseElementForest<E extends Element<E>>

  • Type Parameters:
    E - the base type of all the elements produced by some API analyzer
    All Implemented Interfaces:
    ElementForest<E>

    public class BaseElementForest<E extends Element<E>>
    extends Object
    implements ElementForest<E>
    A convenience base class for element forest implementations.
    • Constructor Detail

      • BaseElementForest

        public BaseElementForest​(API api)
    • Method Detail

      • getRoots

        public SortedSet<E> getRoots()
        Description copied from interface: ElementForest
        A sorted set of all root elements of the forest. The set uses the natural order of the element implementations.
        Specified by:
        getRoots in interface ElementForest<E extends Element<E>>
        Returns:
        the roots elements of the forest.
      • stream

        public <T extends Element<E>> Stream<T> stream​(Class<T> resultType,
                                                       boolean recurse,
                                                       TreeFilter<E> filter,
                                                       Element<E> root)
        Description copied from interface: ElementForest
        Walks through the forest and returns a stream of elements that match the provided filter.
        Specified by:
        stream in interface ElementForest<E extends Element<E>>
        Type Parameters:
        T - the expected type of results
        Parameters:
        resultType - the expected type of results
        recurse - 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 children
        root - the search root. If null, the whole element forest is searched
        Returns:
        the stream of the matching elements
      • newRootsInstance

        protected SortedSet<E> newRootsInstance()