public class PathTree<P extends Path,T>
extends java.lang.Object
implements java.io.Serializable
Modifier and Type | Class and Description |
---|---|
protected class |
PathTree.TreeNode |
Constructor and Description |
---|
PathTree() |
Modifier and Type | Method and Description |
---|---|
java.util.List<T> |
browse(P path)
Essentially an alias for getChildren(path), though wraps the results in a list.
|
void |
clear()
Clears the entire tree.
|
T |
computeIfAbsent(P path,
java.util.function.Function<P,T> supplier) |
protected PathTree.TreeNode |
findNode(P path,
boolean create)
Locates the node at the given path.
|
T |
get(P path)
Returns the value at the given path.
|
java.util.List<java.lang.String> |
getBranches(P path)
Returns the keys for the branches beneath the given point.
|
java.util.List<java.lang.String> |
getBranches(P path,
boolean foldersOnly)
Returns the keys for the branches beneath the given point.
|
<R extends T> |
getChildren(P path)
Returns the children under a given path.
|
protected PathTree.TreeNode |
getRoot() |
protected PathTree.TreeNode |
instantiateNode(PathTree.TreeNode parent,
P path,
int pos) |
boolean |
isCaseSensitive() |
boolean |
put(P path,
T value)
Inserts the value at the given path.
|
T |
remove(P path)
Removes the given path, and returns the value that was associated with the path, if applicable.
|
void |
setCaseSensitive(boolean value)
If set to true (value is false by default), the branches of the tree will be different based on case.
|
int |
size()
Calculates the size of this tag tree.
|
protected PathTree.TreeNode getRoot()
protected PathTree.TreeNode instantiateNode(PathTree.TreeNode parent, P path, int pos)
public boolean isCaseSensitive()
public void setCaseSensitive(boolean value)
public int size()
public java.util.List<T> browse(P path)
public <R extends T> java.util.Collection<R> getChildren(P path)
public java.util.List<java.lang.String> getBranches(P path)
public java.util.List<java.lang.String> getBranches(P path, boolean foldersOnly)
public boolean put(P path, T value)
public T get(P path)
public T remove(P path)
public void clear()
protected PathTree.TreeNode findNode(P path, boolean create)