Package io.jenetics.ext.util
Class Tree.Path
- java.lang.Object
-
- io.jenetics.ext.util.Tree.Path
-
- All Implemented Interfaces:
Serializable
public static final class Tree.Path extends Object implements Serializable
This class represents the path to child within a given tree. It allows to point (and fetch) a tree child.- Since:
- 4.4
- Version:
- 6.0
- See Also:
Tree.childAtPath(Path), Serialized Form
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description Tree.Pathappend(Tree.Path path)Appends the givenpathtothisone.booleanequals(Object obj)intget(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.StringtoString()
-
-
-
Method Detail
-
length
public int length()
Return the path length, which is the level of the childthispath points to.- Returns:
- the path length
-
get
public int get(int index)
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
public int[] toArray()
Return the path asint[]array.- Returns:
- the path as
int[]array
-
append
public Tree.Path append(Tree.Path path)
Appends the givenpathtothisone.- Parameters:
path- the path to append- Returns:
- a new
Pathwith the givenpathappended - Throws:
NullPointerException- if the givenpathisnull
-
of
public static Tree.Path of(int... path)
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
-
-