Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.apache.cocoon.forms.formmodel.tree
Class TreePath

    java.lang.Object
      org.apache.cocoon.forms.formmodel.tree.TreePath

public class TreePath
extends Object

A path in a `TreeModel`.

Version:
  $Id: TreePath.java 587759 2007-10-24 03:00:37Z vgritsenko $

Field Summary
`static TreePath` | `ROOT_PATH`

Constructor Summary
`TreePath(String key)` Constructs a TreePath containing only a single element.
`TreePath(TreePath parent, String key)` Constructs a new TreePath, which is the path identified by `parent` ending in `lastElement`.

Method Summary
`boolean` | `equals(Object obj)` Tests if two paths are equal.
`String` | `getLastKey()` Returns the key of last element of this path.
`Object` | `getLastPathObject(TreeModel model)` Returns the last component of this path.
`Object` | `getObject(TreeModel model)`
`Object[]` | `getObjectPath(TreeModel model)` Returns an ordered array of Objects containing the components of this TreePath.
`TreePath` | `getParentPath()` Returns a path containing all the elements of this object, except the last path component.
`int` | `getPathCount()` Returns the number of elements in the path.
`int` | `hashCode()`
`boolean` | `isDescendant(TreePath aTreePath)` Returns true if `aTreePath` is a descendant of this TreePath.
`String` | `toString()` Returns a string that displays and identifies this object's properties.
`static TreePath` | `valueOf(String s)` Returns the `TreePath` represented by a given String.

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

Field Detail

### ROOT_PATH

    public static final TreePath ROOT_PATH

Constructor Detail

### TreePath

    public TreePath(String key)

  Constructs a TreePath containing only a single element. This is usually used to construct a TreePath for the the root of the TreeModel.

### TreePath

    public TreePath(TreePath parent,
                    String key)

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

Method Detail

### getObjectPath

    public Object[] getObjectPath(TreeModel model)

  Returns an ordered array of Objects containing the components of this TreePath. The first element (index 0) is the root.

  Returns:
    an array of Objects representing the TreePath
  See Also:
    `#TreePath()`

### getLastPathObject

    public Object getLastPathObject(TreeModel model)

  Returns the last component of this path. For a path returned by DefaultTreeModel this will return an instance of TreeNode.

  Returns:
    the Object at the end of the path
  See Also:
    `#TreePath()`

### getPathCount

    public int getPathCount()

  Returns the number of elements in the path.

  Returns:
    an int giving a count of items the path

### equals

    public boolean equals(Object obj)

  Tests if two paths are equal. Two paths are considered equal if they are of same length and contain the same keys.

  Parameters:
    `obj` - the object ot compare

### hashCode

    public int hashCode()

### isDescendant

    public boolean isDescendant(TreePath aTreePath)

  Returns true if `aTreePath` 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. For example, if this object has the path [a, b], and `aTreePath` has the path [a, b, c], then `aTreePath` is a descendant of this object. However, if `aTreePath` has the path [a], then it is not a descendant of this object.

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

### getParentPath

    public TreePath getParentPath()

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

### getLastKey

    public String getLastKey()

  Returns the key of last element of this path.

### toString

    public String toString()

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

  Returns:
    a String representation of this object

### valueOf

    public static TreePath valueOf(String s)

  Returns the `TreePath` represented by a given String.

  Parameters:
    `s` - the string representation of the path
  Returns:
    a path object
  See Also:
    `toString()`

### getObject

    public Object getObject(TreeModel model)

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 1999-2008 The Apache Software Foundation. All Rights Reserved.