net.sf.fstreem
Class FileSystemTreeNode

java.lang.Object
  extended bynet.sf.fstreem.FileSystemTreeNode

public abstract class FileSystemTreeNode
extends java.lang.Object

A tree node that is based on the underlying file system.


Field Summary
protected  java.io.File location
           
 
Method Summary
static FileSystemTreeNode create(java.io.File location)
          Public factory for creating FileSystemTreeNodes.
 boolean equals(java.lang.Object obj)
          Two nodes are equal if their underlying File instances are equal.
abstract  FileSystemTreeNode getChildAt(int index)
          Returns the node at the specified index.
abstract  int getChildCount()
          Returns the number of child File instances under this node.
 java.io.File getFile()
          Returns the File instance behind this node.
 int hashCode()
           
abstract  boolean isFile()
           
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

location

protected final java.io.File location
Method Detail

getFile

public java.io.File getFile()
Returns the File instance behind this node.

Returns:
The {#link File File} instance behind this node.

getChildCount

public abstract int getChildCount()
                           throws NotAFolderException
Returns the number of child File instances under this node.

Returns:
The number of child folders and files under this node.
Throws:
NotAFolderException - If this node returns true for isFile().

getChildAt

public abstract FileSystemTreeNode getChildAt(int index)
                                       throws NotAFolderException
Returns the node at the specified index.

The child File instances are returned in order, according to FileComparator.

Parameters:
index - Must be 0 <= index <= getChildCount() - 1
Returns:
A FileSystemTreeNode instance representing the node at the specified index.
Throws:
NotAFolderException - If this node returns true for isFile().

isFile

public abstract boolean isFile()

hashCode

public int hashCode()

equals

public boolean equals(java.lang.Object obj)
Two nodes are equal if their underlying File instances are equal.

Parameters:
obj -
Returns:
true if the two nodes represent the same file system location, false otherwise.

toString

public java.lang.String toString()

create

public static FileSystemTreeNode create(java.io.File location)
Public factory for creating FileSystemTreeNodes.

Parameters:
location - The file system location to which the node should be attached.
Returns:
A FileSystemTreeNode instance.