## org.apache.myfaces.custom.tree.model
Class TreePath

    java.lang.Object
      org.apache.myfaces.custom.tree.model.TreePath

All Implemented Interfaces:
  java.io.Serializable

public final class TreePath
extends java.lang.Object
implements java.io.Serializable

Version:
  $Revision: 225368 $ $Date: 2005-07-26 14:14:51 -0400 (Tue, 26 Jul 2005) $
Author:
  Oliver Rossmueller
See Also:
  Serialized Form

Constructor Summary
`` `TreePath(java.lang.Object[] pathElements)` Construct a pathElements from an array of Objects
`protected` `TreePath(java.lang.Object[] pathElements, int length)` Construct a new TreePath from an array of objects.
`protected` `TreePath(TreePath parent, java.lang.Object lastElement)` Construct a new TreePath, which is the path identified by parent ending in lastElement.

Method Summary
`boolean` `equals(java.lang.Object o)` Test two TreePaths for equality by checking each element of the paths for equality.
`java.lang.Object` `getLastPathComponent()` Returns the last component of this path.
`TreePath` `getParentPath()` Return a path containing all the elements of this object, except the last path component.
`java.lang.Object[]` `getPath()` Return an array of Objects containing the components of this TreePath.
`java.lang.Object` `getPathComponent(int index)` Return the path component at the specified index.
`int` `getPathCount()` Return the number of elements in the path.
`int` `hashCode()` Return the hashCode for the object.
`boolean` `isDescendant(TreePath path)` Return true if `path` is a descendant of this TreePath.
`TreePath` `pathByAddingChild(java.lang.Object child)` Return a new path by appending child to this path.
`java.lang.String` `toString()` Return a string that displays and identifies this object's properties.

Methods inherited from class java.lang.Object
`clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

Constructor Detail

### TreePath

    public TreePath(java.lang.Object[] pathElements)

  Construct a pathElements from an array of Objects

Parameters:
  `pathElements` - an array of Objects representing the pathElements to a node

### TreePath

    protected TreePath(TreePath parent,
                       java.lang.Object lastElement)

  Construct a new TreePath, which is the path identified by parent ending in lastElement.

### TreePath

    protected TreePath(java.lang.Object[] pathElements,
                       int length)

  Construct a new TreePath from an array of objects.

Parameters:
  `pathElements` - path elements
  `length` - lenght of the new path

Method Detail

### getPath

    public java.lang.Object[] getPath()

  Return an array of Objects containing the components of this TreePath.

  Returns:
    an array of Objects representing the TreePath

### getLastPathComponent

    public java.lang.Object getLastPathComponent()

  Returns the last component of this path.

  Returns:
    the Object at the end of the path

### getPathCount

    public int getPathCount()

  Return the number of elements in the path.

  Returns:
    an int giving a count of items the path

### getPathComponent

    public java.lang.Object getPathComponent(int index)

  Return the path component at the specified index.

  Parameters:
    `index` - int specifying an index in the path
  Returns:
    the Object at that index location
  Throws:
    `java.lang.IllegalArgumentException` - if the index is beyond the length of the path

### equals

    public boolean equals(java.lang.Object o)

  Test two TreePaths for equality by checking each element of the paths for equality. Two paths are considered equal if they are of the same length and all element positions are equal.

  Parameters:
    `o` - the Object to compare

### hashCode

    public int hashCode()

  Return the hashCode for the object. The hash code of a TreePath is defined to be the hash code of the last component in the path.

  Returns:
    the hashCode for the object

### isDescendant

    public boolean isDescendant(TreePath path)

  Return true if `path` is a descendant of this TreePath. A TreePath P1 is a descendent of a TreePath P2 if P1 contains all of the components that make up P2's path. If P1 and P2 are equal P2 is not considered a descendant of P1.

  Returns:
    true if `path` is a descendant of this path

### pathByAddingChild

    public TreePath pathByAddingChild(java.lang.Object child)

  Return a new path by appending child to this path.

  Parameters:
    `child` - element to append
  Returns:
    new path
  Throws:
    `java.lang.NullPointerException` - if child is null

### getParentPath

    public TreePath getParentPath()

  Return a path containing all the elements of this object, except the last path component.

### toString

    public java.lang.String toString()

  Return a string that displays and identifies this object's properties.

  Returns:
    a String representation of this object