public class N5TreeNode extends Object
N5Metadata, and child nodes if any exist.| Constructor and Description |
|---|
N5TreeNode(String path) |
| Modifier and Type | Method and Description |
|---|---|
void |
add(N5TreeNode child)
Adds a node as a child of this node.
|
N5TreeNode |
addPath(String path)
Adds a node at the specified full path and any parent nodes along the path,
if they do not already exist.
|
N5TreeNode |
addPath(String path,
Function<String,N5TreeNode> constructor)
Adds a node at the specified full path and any parent nodes along the path,
if they do not already exist.
|
Optional<N5TreeNode> |
child(String name) |
List<N5TreeNode> |
childrenList() |
static Stream<N5TreeNode> |
flattenN5Tree(N5TreeNode root) |
static void |
fromFlatList(N5TreeNode root,
String[] pathList,
String groupSeparator)
Generates a tree based on the output of
N5Reader.deepList(java.lang.String, java.util.function.Predicate<java.lang.String>), returning
the root node. |
static N5TreeNode |
fromFlatList(String base,
String[] pathList,
String groupSeparator)
Generates a tree based on the output of
N5Reader.deepList(java.lang.String, java.util.function.Predicate<java.lang.String>), returning
the root node. |
Optional<N5TreeNode> |
getDescendant(String path) |
Stream<N5TreeNode> |
getDescendants(Predicate<N5TreeNode> filter) |
N5Metadata |
getMetadata() |
String |
getNodeName() |
String |
getParentPath() |
String |
getPath() |
boolean |
isDataset() |
String |
printRecursive() |
void |
remove(N5TreeNode child) |
void |
removeAllChildren() |
protected static String |
removeLeadingSlash(String pathName)
Removes the leading slash from a given path and returns the corrected path.
|
void |
setMetadata(N5Metadata metadata) |
boolean |
structureEquals(N5TreeNode other) |
String |
toString() |
public N5TreeNode(String path)
public static Stream<N5TreeNode> flattenN5Tree(N5TreeNode root)
public String getNodeName()
public String getParentPath()
public void add(N5TreeNode child)
child - the child nodepublic void remove(N5TreeNode child)
public void removeAllChildren()
public List<N5TreeNode> childrenList()
public Optional<N5TreeNode> child(String name)
public Optional<N5TreeNode> getDescendant(String path)
public N5TreeNode addPath(String path)
path - the full path to nodepublic N5TreeNode addPath(String path, Function<String,N5TreeNode> constructor)
path - the full path to nodeconstructor - function creating a node from a pathpublic Stream<N5TreeNode> getDescendants(Predicate<N5TreeNode> filter)
public boolean isDataset()
public void setMetadata(N5Metadata metadata)
public N5Metadata getMetadata()
public String getPath()
public boolean structureEquals(N5TreeNode other)
public String printRecursive()
public static N5TreeNode fromFlatList(String base, String[] pathList, String groupSeparator)
N5Reader.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(N5TreeNode root, String[] pathList, String groupSeparator)
N5Reader.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 String removeLeadingSlash(String pathName)
pathName
is treated as UNC path on Windows, and Paths.get(pathName, ...) fails
with InvalidPathException.pathName - the pathCopyright © 2021–2026 Saalfeld Lab. All rights reserved.