Package aQute.lib.hierarchy
Class Hierarchy.Node
- java.lang.Object
-
- aQute.lib.hierarchy.Hierarchy.Node
-
- Direct Known Subclasses:
Hierarchy.Folder
,Hierarchy.Leaf
,Hierarchy.OrphanNode
- Enclosing class:
- Hierarchy
abstract static class Hierarchy.Node extends java.lang.Object implements NamedNode
-
-
Field Summary
Fields Modifier and Type Field Description (package private) java.lang.String
name
(package private) java.util.Optional<Hierarchy.Folder>
parent
-
Constructor Summary
Constructors Constructor Description Node(java.util.Optional<Hierarchy.Folder> parent, java.lang.String name)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description int
compareTo(NamedNode b)
java.util.Optional<NamedNode>
find(java.lang.String path)
Find a path from this node down.(package private) Hierarchy.Node
find(java.lang.String[] parts, int i)
(package private) abstract void
getPath(java.lang.StringBuilder app)
java.lang.String
name()
The name of this node.java.util.Optional<? extends Hierarchy.Folder>
parent()
Return the parent of this node.java.lang.String
path()
The path of this node in the hierarchy.FolderNode
root()
Answer the root node
-
-
-
Field Detail
-
parent
final java.util.Optional<Hierarchy.Folder> parent
-
name
final java.lang.String name
-
-
Constructor Detail
-
Node
Node(java.util.Optional<Hierarchy.Folder> parent, java.lang.String name)
-
-
Method Detail
-
name
public java.lang.String name()
Description copied from interface:NamedNode
The name of this node. This name is always without a '/'.
-
path
public java.lang.String path()
Description copied from interface:NamedNode
The path of this node in the hierarchy. This path never starts with a '/'. If it is a folder, the path must end with a '/'.This path, when used with
Hierarchy.find(String)
must return the this node.
-
compareTo
public int compareTo(NamedNode b)
- Specified by:
compareTo
in interfacejava.lang.Comparable<NamedNode>
-
getPath
abstract void getPath(java.lang.StringBuilder app)
-
parent
public java.util.Optional<? extends Hierarchy.Folder> parent()
Description copied from interface:NamedNode
Return the parent of this node. Only the root will return an emptyOptional
. Each hierarchy has a single root.
-
root
public FolderNode root()
Description copied from interface:NamedNode
Answer the root node
-
find
public java.util.Optional<NamedNode> find(java.lang.String path)
Description copied from interface:NamedNode
Find a path from this node down. The `..` and '.' are supported, meaning parent and this.
-
find
Hierarchy.Node find(java.lang.String[] parts, int i)
-
-