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.Stringname(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 intcompareTo(NamedNode b)java.util.Optional<NamedNode>find(java.lang.String path)Find a path from this node down.(package private) Hierarchy.Nodefind(java.lang.String[] parts, int i)(package private) abstract voidgetPath(java.lang.StringBuilder app)java.lang.Stringname()The name of this node.java.util.Optional<? extends Hierarchy.Folder>parent()Return the parent of this node.java.lang.Stringpath()The path of this node in the hierarchy.FolderNoderoot()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:NamedNodeThe name of this node. This name is always without a '/'.
-
path
public java.lang.String path()
Description copied from interface:NamedNodeThe 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:
compareToin 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:NamedNodeReturn 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:NamedNodeAnswer the root node
-
find
public java.util.Optional<NamedNode> find(java.lang.String path)
Description copied from interface:NamedNodeFind a path from this node down. The `..` and '.' are supported, meaning parent and this.
-
find
Hierarchy.Node find(java.lang.String[] parts, int i)
-
-