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

## echopointng.tree
Class TreePath

    java.lang.Object
      echopointng.tree.TreePath

All Implemented Interfaces:
  java.io.Serializable

    public class TreePath

extends java.lang.Object
implements java.io.Serializable

Represents a path to a node. A `TreePath` is an array of Objects that are vended from a `TreeModel`. The elements of the array are ordered such that the root is always the first element (index 0) of the array. `TreePath` is Serializable, but if any components of the path are not serializable, it will not be written out.

See Also:
  Serialized Form

Constructor Summary
`protected` | `TreePath()` Primarily provided for subclasses that don't wish to use the path ivar.
`` | `TreePath(java.lang.Object singlePath)` Constructs a TreePath when there is only item in the path.
`` | `TreePath(java.lang.Object[] path)` Constructs a path from an array of Objects, uniquely identifying the path from the root of the tree to a specific node, as returned by the tree's data model.
`protected` | `TreePath(java.lang.Object[] path, int length)`
`` | `TreePath(TreePath parent, java.lang.Object lastElement)` Constructs a TreePath this is the combination of all the path elements in `parent` with a last path component of `lastElement`.

Method Summary
`boolean` | `equals(java.lang.Object o)` Tests 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()` Returns a path containing all the elements of the receiver, accept the last path component.
`java.lang.Object[]` | `getPath()` Returns an array of Objects containing the components of this TreePath.
`java.lang.Object` | `getPathComponent(int element)` Returns the path component at the specified index.
`int` | `getPathCount()` Returns the number of elements in the path.
`int` | `hashCode()` Returns the hashCode for the object.
`boolean` | `isDescendant(TreePath aTreePath)` Returns true if the specified node is a descendant of this TreePath.
`TreePath` | `pathByAddingChild(java.lang.Object child)` Returns a new path containing all the elements of this receiver plus `child`.
`java.lang.String` | `toString()` Returns 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

    protected TreePath()

  Primarily provided for subclasses that don't wish to use the path ivar. If a subclass uses this, it should also subclass getPath(), getPathCount(), getPathComponent() and possibly equals.

### TreePath

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

  Constructs a path from an array of Objects, uniquely identifying the path from the root of the tree to a specific node, as returned by the tree's data model.

  The model is free to return an array of any Objects it needs to represent the path. The DefaultTreeModel returns an array of TreeNode objects. The first TreeNode in the path is the root of the tree, the last TreeNode is the node identified by the path.

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

### TreePath

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

### TreePath

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

  Constructs a TreePath this is the combination of all the path elements in `parent` with a last path component of `lastElement`.

### TreePath

    public TreePath(java.lang.Object singlePath)

  Constructs a TreePath when there is only item in the path.

Method Detail

### equals

    public boolean equals(java.lang.Object o)

  Tests two TreePaths for equality by checking each element of the paths for equality.

  Overrides:
    `equals` in class `java.lang.Object`
  Parameters:
    `o` - the Object to compare

### getLastPathComponent

    public java.lang.Object getLastPathComponent()

  Returns the last component of this path. For a path returned by the DefaultTreeModel, that is the TreeNode object for the node specified by the path.

  Returns:
    the Object at the end of the path

### getParentPath

    public TreePath getParentPath()

  Returns a path containing all the elements of the receiver, accept the last path component.

### getPath

    public java.lang.Object[] getPath()

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

  Returns:
    an array of Objects representing the TreePath

### getPathComponent

    public java.lang.Object getPathComponent(int element)

  Returns the path component at the specified index.

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

### getPathCount

    public int getPathCount()

  Returns the number of elements in the path.

  Returns:
    an int giving a count of items the path

### hashCode

    public int hashCode()

  Returns 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.

  Overrides:
    `hashCode` in class `java.lang.Object`
  Returns:
    the hashCode for the object

### isDescendant

    public boolean isDescendant(TreePath aTreePath)

  Returns true if the specified node is a descendant of this TreePath. A TreePath, child, is a descendent of another TreePath, parent, if child contains all of the components that make up parent's path.

  Returns:
    true if aTreePath is a descendant of the receiver.

### pathByAddingChild

    public TreePath pathByAddingChild(java.lang.Object child)

  Returns a new path containing all the elements of this receiver plus `child`. This will throw a NullPointerException if child is null.

### toString

    public java.lang.String toString()

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

  Overrides:
    `toString` in class `java.lang.Object`
  Returns:
    a String representation of this object

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