Class DirectoryNode


  • public class DirectoryNode
    extends java.lang.Object
    • Constructor Summary

      Constructors 
      Constructor Description
      DirectoryNode​(java.lang.String name, java.io.File absPathToNode, java.util.ArrayList<DirectoryNode> childNodes, DirectoryNode parent)
      Create a new instance of DirectoryNode.
      DirectoryNode​(java.lang.String name, java.io.File absPathToNode, DirectoryNode parent)
      Create a new instance of DirectoryNode.
      DirectoryNode​(java.lang.String name, java.lang.String absPathToNode, DirectoryNode parent)
      Create a new instance of DirectoryNode.
    • Constructor Detail

      • DirectoryNode

        public DirectoryNode​(java.lang.String name,
                             java.lang.String absPathToNode,
                             DirectoryNode parent)
        Create a new instance of DirectoryNode.
        Parameters:
        name - Name representing this node.
        absPathToNode - Absolute path to this node given as a String.
        parent - The parent node.
      • DirectoryNode

        public DirectoryNode​(java.lang.String name,
                             java.io.File absPathToNode,
                             DirectoryNode parent)
        Create a new instance of DirectoryNode.
        Parameters:
        name - Name representing this node.
        absPathToNode - Absolute path to this node as a File.
        parent - The parent node.
      • DirectoryNode

        public DirectoryNode​(java.lang.String name,
                             java.io.File absPathToNode,
                             java.util.ArrayList<DirectoryNode> childNodes,
                             DirectoryNode parent)
        Create a new instance of DirectoryNode.
        Parameters:
        name - Name representing this node.
        absPathToNode - Absolute path to this node given as a File.
        childNodes - List of children nodes.
        parent - The parent node.
    • Method Detail

      • addChild

        public void addChild​(DirectoryNode node)
        Append the given node to the list of child nodes.
        Parameters:
        node - Node to be appended.
      • removeChild

        public boolean removeChild​(DirectoryNode node)
        Removes the node specified.
        Parameters:
        node - Node to be removed from the list of children
        Returns:
        true if this list of children contained the specified element
      • getName

        public java.lang.String getName()
        Retrieve the name of this node.
        Returns:
        Name of this node.
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • getFile

        public java.io.File getFile()
        Retrieve the file associated with this node.
        Returns:
        File that is associated with this node.
      • getParent

        public DirectoryNode getParent()
        Retrieve the parent node.
        Returns:
        DirectoryNode representing the parent of the current node.
      • getChildren

        public java.util.ArrayList<DirectoryNode> getChildren()
        Retrieves the list of child nodes.
        Returns:
        ArrayList of type DirectoryNode containing all the child nodes.
      • isDir

        public boolean isDir()
        Check if this node is a directory.
        Returns:
        True if node is directory.
      • getInfoFile

        public java.io.File getInfoFile()