net.sf.statcvs.model

## Class Directory

- java.lang.Object
- - net.sf.statcvs.model.Directory

- All Implemented Interfaces:
    java.lang.Comparable

      public abstract class Directory
      extends java.lang.Object
      implements java.lang.Comparable

  Represents a directory in the `Repository`, a container for `VersionedFile`s and sub`Directory`s. A new root directory is created by `createRoot()`. The `createSubdirectory(java.lang.String)` method creates new subdirectories. TODO: Rename getCurrentLOC to getCurrentLines or getCurrentLineCount
  Version:
    $Id: Directory.java,v 1.11 2008/04/02 11:22:16 benoitx Exp $
  Author:
    Richard Cyganiak

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `Directory()`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `int` | `compareTo(java.lang.Object o)` Compares this directory to another one, based on their full names.
    `static Directory` | `createRoot()` Factory method for creating a new root directory.
    `Directory` | `createSubdirectory(java.lang.String name)` Factory method for creating a new subdirectory.
    `int` | `getCurrentFileCount()` Returns the number of files in this directory.
    `int` | `getCurrentLOC()` Returns the number of lines in this directory.
    `abstract int` | `getDepth()` Returns the level of this directory in the direcotry tree.
    `java.util.SortedSet` | `getFiles()` Returns all `VersionedFile` objects in this directory, ordered by filename.
    `abstract java.lang.String` | `getName()` Returns the directory's name without full path or any slashes, for example "src".
    `abstract Directory` | `getParent()` Returns the directory's parent directory or `null` if it is the root
    `abstract java.lang.String` | `getPath()` Returns the directory's full path with trailing slash, for example "src/net/sf/statcvs/".
    `java.util.SortedSet` | `getRevisions()` Returns all `Revision`s to files in this directory, in order from oldest to most recent.
    `java.util.SortedSet` | `getSubdirectories()` Returns a `SortedSet` of all immediate subdirectories, ordered by name.
    `java.util.SortedSet` | `getSubdirectoriesRecursive()` Returns a list of all subdirectories, including their subdirectories and this directory itself.
    `boolean` | `isEmpty()` Returns `true` if all files in this directory and its subdirectories are deleted, or if it doesn't have any files and subdirectories at all.
    `abstract boolean` | `isRoot()` Returns `true` if this is the root of the directory tree.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### Directory

          public Directory()

  - ### Method Detail

    - #### createRoot

          public static Directory createRoot()

      Factory method for creating a new root directory.
      Returns:
        a new root directory

    - #### createSubdirectory

          public Directory createSubdirectory(java.lang.String name)

      Factory method for creating a new subdirectory.
      Parameters:
        `name` - the subdirectory's name
      Returns:
        the subdirectory instance

    - #### getName

          public abstract java.lang.String getName()

      Returns the directory's name without full path or any slashes, for example "src".
      Returns:
        the directory's name

    - #### getPath

          public abstract java.lang.String getPath()

      Returns the directory's full path with trailing slash, for example "src/net/sf/statcvs/".
      Returns:
        the directory's path

    - #### getParent

          public abstract Directory getParent()

      Returns the directory's parent directory or `null` if it is the root
      Returns:
        the directory's parent.

    - #### isRoot

          public abstract boolean isRoot()

      Returns `true` if this is the root of the directory tree.
      Returns:
        `true` if this is the root of the directory tree

    - #### getDepth

          public abstract int getDepth()

      Returns the level of this directory in the direcotry tree. The root has level 0, its subdirectories have level 1, and so forth.
      Returns:
        the level of this directory in the directory tree

    - #### getFiles

          public java.util.SortedSet getFiles()

      Returns all `VersionedFile` objects in this directory, ordered by filename. Files in subdirectories are not included.
      Returns:
        the files in this directory

    - #### getRevisions

          public java.util.SortedSet getRevisions()

      Returns all `Revision`s to files in this directory, in order from oldest to most recent.
      Returns:
        list of `Revision`s for this directory

    - #### getSubdirectories

          public java.util.SortedSet getSubdirectories()

      Returns a `SortedSet` of all immediate subdirectories, ordered by name.
      Returns:
        `SortedSet` of `Directory` objects

    - #### getSubdirectoriesRecursive

          public java.util.SortedSet getSubdirectoriesRecursive()

      Returns a list of all subdirectories, including their subdirectories and this directory itself. The list is preordered, beginning with this directory itself.
      Returns:
        `SortedSet` of `Directory` objects

    - #### getCurrentLOC

          public int getCurrentLOC()

      Returns the number of lines in this directory. The returned number will be for the current revisions of all files.
      Returns:
        lines in this directory

    - #### getCurrentFileCount

          public int getCurrentFileCount()

      Returns the number of files in this directory. Deleted files are not counted.
      Returns:
        number of files in this directory

    - #### isEmpty

          public boolean isEmpty()

      Returns `true` if all files in this directory and its subdirectories are deleted, or if it doesn't have any files and subdirectories at all.
      Returns:
        `true` if the directory is currently empty

    - #### compareTo

          public int compareTo(java.lang.Object o)

      Compares this directory to another one, based on their full names.
      Specified by:
        `compareTo` in interface `java.lang.Comparable`
      See Also:
        `Comparable.compareTo(java.lang.Object)`