Class Hierarchy.Node

    • 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)  
    • Field Detail

      • 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 '/'.
        Specified by:
        name in interface NamedNode
        Returns:
        the name
      • 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.

        Specified by:
        path in interface NamedNode
        Returns:
        the name
      • compareTo

        public int compareTo​(NamedNode b)
        Specified by:
        compareTo in interface java.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 empty Optional. Each hierarchy has a single root.
        Specified by:
        parent in interface NamedNode
        Returns:
        the parent or an empty Optional in the case of 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.
        Specified by:
        find in interface NamedNode
        Parameters:
        path - the path
        Returns:
        an optional node if found