public final class TreePath extends Object
Clients may instantiate this class. Not intended to be subclassed.
Modifier and Type | Field and Description |
---|---|
static TreePath |
EMPTY
Constant for representing an empty tree path.
|
Constructor and Description |
---|
TreePath(Object[] segments)
Constructs a path identifying a leaf node in a tree.
|
Modifier and Type | Method and Description |
---|---|
TreePath |
createChildPath(Object newSegment)
Returns a copy of this tree path with the given segment added at the end.
|
boolean |
equals(Object other) |
boolean |
equals(TreePath otherPath,
IElementComparer comparer)
Returns whether this path is equivalent to the given path using the
specified comparer to compare individual elements.
|
Object |
getFirstSegment()
Returns the first element in this path, or
null if this
path has no segments. |
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() |
int |
hashCode(IElementComparer comparer)
Returns a hash code computed from the hash codes of the segments, using
the given comparer to compute the hash codes of the segments.
|
boolean |
startsWith(TreePath treePath,
IElementComparer comparer)
Returns whether this path starts with the same segments as the given
path, using the given comparer to compare segments.
|
public static final TreePath EMPTY
public TreePath(Object[] segments)
segments
- path of elements to a leaf node in a tree, starting with the
root elementpublic Object getSegment(int index)
index
- index of element to returnpublic int getSegmentCount()
public Object getFirstSegment()
null
if this
path has no segments.public Object getLastSegment()
null
if this
path has no segments.public int hashCode(IElementComparer comparer)
comparer
- comparer to use or null
if the segments' hash
codes should be computed by calling their hashCode() methods.public boolean equals(TreePath otherPath, IElementComparer comparer)
otherPath
- tree path to compare tocomparer
- comparator to use or null
if segments should be
compared using equals()public boolean startsWith(TreePath treePath, IElementComparer comparer)
treePath
- path to compare tocomparer
- the comparer to use, or null
if equals() should
be used to compare segmentspublic TreePath getParentPath()
null
if this tree path has no segments.
Copyright (c) 2000, 2014 Eclipse Contributors and others. All rights reserved.Guidelines for using Eclipse APIs.