com.link_intersystems.graph.tree.TreeModel Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of lis-commons-graph Show documentation
Show all versions of lis-commons-graph Show documentation
Link Intersystems Commons Graph (lis-commons-graph) is a collection of reusable software components
that provide support for graph and tree related programming tasks, such as models and search algorithms.
package com.link_intersystems.graph.tree;
import java.util.stream.Stream;
/**
* A {@link TreeModel} describes a tree structure on objects.
*
* @author René Link {@literal }
*/
public interface TreeModel {
/**
* An object that can be used as a root object in case you don't have one.
*/
public static final Object DEFAULT_ROOT = new Object();
Stream extends T> getChildren(T parent);
default boolean hasChildren(P parent) {
return getChildren(parent).findFirst().isPresent();
}
}