org.eclipse.swtbot.swt.finder.utils
Class TreePath

java.lang.Object
  extended by org.eclipse.swtbot.swt.finder.utils.TreePath

public final class TreePath
extends Object


Field Summary
static TreePath EMPTY
          Constant for representing an empty tree path.
 
Constructor Summary
TreePath(Object... segments)
          Constructs a path identifying a leaf node in a tree.
 
Method Summary
 boolean equals(Object obj)
           
 Object getLastSegment()
          Returns the last element in this path, or null if this path has no segments.
 TreePath getParentPath()
          Returns a copy of this tree path with one segment removed from the end, or null if this tree path has no segments.
 Object getSegment(int index)
          Returns the element at the specified index in this path.
 int getSegmentCount()
          Returns the number of elements in this path.
 int hashCode()
           
 Object pop()
          Removes the last path component from the tree and returns it.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

EMPTY

public static final TreePath EMPTY
Constant for representing an empty tree path.

Constructor Detail

TreePath

public TreePath(Object... segments)
Constructs a path identifying a leaf node in a tree.

Parameters:
segments - path of elements to a leaf node in a tree, starting with the root element
Method Detail

getSegment

public Object getSegment(int index)
Returns the element at the specified index in this path.

Parameters:
index - index of element to return
Returns:
element at the specified index

getSegmentCount

public int getSegmentCount()
Returns the number of elements in this path.

Returns:
the number of elements in this path

getLastSegment

public Object getLastSegment()
Returns the last element in this path, or null if this path has no segments.

Returns:
the last element in this path

hashCode

public int hashCode()
Overrides:
hashCode in class Object

equals

public boolean equals(Object obj)
Overrides:
equals in class Object

getParentPath

public TreePath getParentPath()
Returns a copy of this tree path with one segment removed from the end, or null if this tree path has no segments.

Returns:
a tree path

pop

public Object pop()
Removes the last path component from the tree and returns it.

Returns:
the last path component after removing it from the tree.