Modifier and Type | Field and Description |
---|---|
private TreeIndexPathComponent<E> |
lastPathComponent
Last path component.
|
private IndexTreePath<E> |
parentPath
Path representing the parent, null if lastPathComponent represents the
root.
|
Modifier | Constructor and Description |
---|---|
protected |
IndexTreePath(IndexTreePath<E> parent,
TreeIndexPathComponent<E> lastElement)
Constructs a new IndexPath, which is the path identified by
parent ending in lastElement . |
|
IndexTreePath(List<TreeIndexPathComponent<E>> path)
Constructs a path from a list of path components, uniquely identifying the
path from the root of the index to a specific node.
|
protected |
IndexTreePath(List<TreeIndexPathComponent<E>> path,
int length)
Constructs a new IndexPath with the identified path components of length
length . |
|
IndexTreePath(TreeIndexPathComponent<E> singlePath)
Constructs a IndexPath containing only a single element.
|
Modifier and Type | Method and Description |
---|---|
boolean |
equals(Object o)
Returns
true if this == o has the value
true or o is not null and o is of the same class as this
instance and the two index paths are of the same length, and contain the
same components (.equals ), false otherwise. |
TreeIndexPathComponent<E> |
getLastPathComponent()
Returns the last component of this path.
|
IndexTreePath<E> |
getParentPath()
Returns a path containing all the elements of this object, except the last
path component.
|
List<TreeIndexPathComponent<E>> |
getPath()
Returns an ordered list of IndexPathComponents containing the components of
this IndexPath.
|
TreeIndexPathComponent<E> |
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 hash code for this index path.
|
boolean |
isDescendant(IndexTreePath<E> aIndexPath)
Returns true if
aIndexPath is a descendant of this IndexPath. |
IndexTreePath<E> |
pathByAddingChild(TreeIndexPathComponent<E> child)
Returns a new path containing all the elements of this object plus
child . |
String |
toString()
Returns a string that displays the components of this index path.
|
private IndexTreePath<E extends Entry> parentPath
private TreeIndexPathComponent<E extends Entry> lastPathComponent
public IndexTreePath(List<TreeIndexPathComponent<E>> path)
path
- a list of IndexPathComponents representing the path to a nodepublic IndexTreePath(TreeIndexPathComponent<E> singlePath)
singlePath
- a IndexPathComponent representing the path to a nodeprotected IndexTreePath(IndexTreePath<E> parent, TreeIndexPathComponent<E> lastElement)
parent
ending in lastElement
.parent
- the parent pathlastElement
- the last path componentprotected IndexTreePath(List<TreeIndexPathComponent<E>> path, int length)
length
.path
- the whole pathlength
- the length of the newly created index pathpublic List<TreeIndexPathComponent<E>> getPath()
public TreeIndexPathComponent<E> getLastPathComponent()
public int getPathCount()
public TreeIndexPathComponent<E> getPathComponent(int element)
element
- an int specifying an element in the path, where 0 is the
first element in the pathIllegalArgumentException
- if the index is beyond the length of the
pathpublic boolean equals(Object o)
true
if this == o
has the value
true
or o is not null and o is of the same class as this
instance and the two index paths are of the same length, and contain the
same components (.equals
), false
otherwise.equals
in class Object
TreeIndexPathComponent.equals(Object)
public int hashCode()
public boolean isDescendant(IndexTreePath<E> aIndexPath)
aIndexPath
is a descendant of this IndexPath.
A IndexPath P1 is a descendent of a IndexPath 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 aIndexPath
has the path [a, b, c], then
aIndexPath
is a descendant of this object. However, if
aIndexPath
has the path [a], then it is not a descendant of
this object.aIndexPath
- the index path to be testedaIndexPath
is a descendant of this pathpublic IndexTreePath<E> pathByAddingChild(TreeIndexPathComponent<E> child)
child
. child
will be the last element of the
newly created IndexPath. This will throw a NullPointerException if child is
null.child
- the last element of the newly created IndexPathchild
public IndexTreePath<E> getParentPath()