public class MoleculeArchiveTreeNode
extends java.lang.Object
Constructor and Description |
---|
MoleculeArchiveTreeNode(java.lang.String path) |
Modifier and Type | Method and Description |
---|---|
void |
add(MoleculeArchiveTreeNode child)
Adds a node as a child of this node.
|
MoleculeArchiveTreeNode |
addPath(java.lang.String path)
Adds a node at the specified full path and any parent nodes along the path,
if they do not already exist.
|
MoleculeArchiveTreeNode |
addPath(java.lang.String path,
java.util.function.Function<java.lang.String,MoleculeArchiveTreeNode> constructor)
Adds a node at the specified full path and any parent nodes along the path,
if they do not already exist.
|
java.util.List<MoleculeArchiveTreeNode> |
childrenList() |
static java.util.stream.Stream<MoleculeArchiveTreeNode> |
flattenTree(MoleculeArchiveTreeNode root) |
static void |
fromFlatList(MoleculeArchiveTreeNode root,
java.lang.String[] pathList,
java.lang.String groupSeparator)
Generates a tree based on the output of
MoleculeArchiveStorage.deepList(java.lang.String, java.util.function.Predicate<java.lang.String>) , returning the root node. |
static MoleculeArchiveTreeNode |
fromFlatList(java.lang.String base,
java.lang.String[] pathList,
java.lang.String groupSeparator)
Generates a tree based on the output of
MoleculeArchiveStorage.deepList(java.lang.String, java.util.function.Predicate<java.lang.String>) , returning the root node. |
java.util.Optional<MoleculeArchiveTreeNode> |
getDescendant(java.lang.String path) |
java.util.stream.Stream<MoleculeArchiveTreeNode> |
getDescendants(java.util.function.Predicate<MoleculeArchiveTreeNode> filter) |
java.lang.String |
getNodeName() |
java.lang.String |
getParentPath() |
java.lang.String |
getPath() |
java.lang.String |
printRecursive() |
void |
remove(MoleculeArchiveTreeNode child) |
void |
removeAllChildren() |
protected static java.lang.String |
removeLeadingSlash(java.lang.String pathName)
Removes the leading slash from a given path and returns the corrected path.
|
boolean |
structureEquals(MoleculeArchiveTreeNode other) |
java.lang.String |
toString() |
public static java.util.stream.Stream<MoleculeArchiveTreeNode> flattenTree(MoleculeArchiveTreeNode root)
public java.lang.String getNodeName()
public java.lang.String getParentPath()
public void add(MoleculeArchiveTreeNode child)
child
- the child nodepublic void remove(MoleculeArchiveTreeNode child)
public void removeAllChildren()
public java.util.List<MoleculeArchiveTreeNode> childrenList()
public java.util.Optional<MoleculeArchiveTreeNode> getDescendant(java.lang.String path)
public MoleculeArchiveTreeNode addPath(java.lang.String path)
path
- the full path to nodepublic MoleculeArchiveTreeNode addPath(java.lang.String path, java.util.function.Function<java.lang.String,MoleculeArchiveTreeNode> constructor)
path
- the full path to nodeconstructor
- function creating a node from a pathpublic java.util.stream.Stream<MoleculeArchiveTreeNode> getDescendants(java.util.function.Predicate<MoleculeArchiveTreeNode> filter)
public java.lang.String getPath()
public java.lang.String toString()
toString
in class java.lang.Object
public boolean structureEquals(MoleculeArchiveTreeNode other)
public java.lang.String printRecursive()
public static MoleculeArchiveTreeNode fromFlatList(java.lang.String base, java.lang.String[] pathList, java.lang.String groupSeparator)
MoleculeArchiveStorage.deepList(java.lang.String, java.util.function.Predicate<java.lang.String>)
, returning the root node.base
- the path used to call deepListpathList
- the output of deepListgroupSeparator
- the n5 group separatorpublic static void fromFlatList(MoleculeArchiveTreeNode root, java.lang.String[] pathList, java.lang.String groupSeparator)
MoleculeArchiveStorage.deepList(java.lang.String, java.util.function.Predicate<java.lang.String>)
, returning the root node.root
- the root node corresponding to the basepathList
- the output of deepListgroupSeparator
- the n5 group separatorprotected static java.lang.String removeLeadingSlash(java.lang.String pathName)
pathName
is treated
as UNC path on Windows, and Paths.get(pathName, ...)
fails with InvalidPathException
.pathName
- the path