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 givenpathtothisone.intbooleanintget(int index) Return the child index at the given index (child level).inthashCode()intlength()Return the path length, which is the level of the childthispath points to.static Tree.Pathof(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 childthispath 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 givenpathtothisone.- Parameters:
path- the path to append- Returns:
- a new
Pathwith the givenpathappended - Throws:
NullPointerException- if the givenpathisnull
-
compareTo
- Specified by:
compareToin 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
-