java.lang.Object
io.jenetics.ext.util.Tree.Path
- All Implemented Interfaces:
Serializable
,Comparable<Tree.Path>
This class represents the path to child within a given tree. It allows
pointing (and fetch) a tree child.
- Since:
- 4.4
- Version:
- 7.2
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionAppends the givenpath
tothis
one.int
boolean
int
get
(int index) Return the child index at the given index (child level).int
hashCode()
int
length()
Return the path length, which is the level of the childthis
path points to.static Tree.Path
of
(int... path) Create a new path object from the given child indexes.int[]
toArray()
Return the path asint[]
array.toString()
-
Method Details
-
length
Return the path length, which is the level of the childthis
path points to.- Returns:
- the path length
-
get
Return the child index at the given index (child level).- Parameters:
index
- the path index- Returns:
- the child index at the given child level
- Throws:
IndexOutOfBoundsException
- if the index is not with the range[0, length())
-
toArray
Return the path asint[]
array.- Returns:
- the path as
int[]
array
-
append
Appends the givenpath
tothis
one.- Parameters:
path
- the path to append- Returns:
- a new
Path
with the givenpath
appended - Throws:
NullPointerException
- if the givenpath
isnull
-
compareTo
- Specified by:
compareTo
in interfaceComparable<Tree.Path>
-
hashCode
-
equals
-
toString
-
of
Create a new path object from the given child indexes.- Parameters:
path
- the child indexes- Returns:
- a new tree path
- Throws:
IllegalArgumentException
- if one of the path elements is smaller than zero
-