Class IndexedForest
Object
IndexedForest
Forest-based indexes for common operations like getting parents, children, subtree or siblings.
Thread-unsafe.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionIntIteratorchildren(int idx) Returns an iterator that provides indexes of all direct children at index idx.LongListchildrenRows(int idx) Returns a list of children rows at index idx.intdepth(int idx) intfirstChild(int idx) Returns the index of the first child under [idx].intnextSibling(int idx) intparent(int idx) introot(int idx) IntIteratorroots()longrow(int idx) LongIteratorrows(IntIterator indices) intsize()intsubtreeEnd(int idx)
-
Constructor Details
-
IndexedForest
-
-
Method Details
-
subtreeEnd
public int subtreeEnd(int idx) -
parent
public int parent(int idx) -
children
@NotNull public IntIterator children(int idx) Returns an iterator that provides indexes of all direct children at index idx. If idx is -1, returns roots. -
roots
@NotNull public IntIterator roots() -
childrenRows
public LongList childrenRows(int idx) Returns a list of children rows at index idx. If idx = -1, returns a list of roots. -
firstChild
public int firstChild(int idx) Returns the index of the first child under [idx]. If idx is equal to -1, returns the index of the first root (0). -
nextSibling
public int nextSibling(int idx) -
depth
public int depth(int idx) -
row
public long row(int idx) -
rows
public LongIterator rows(IntIterator indices) -
size
public int size() -
getForest
-
root
public int root(int idx)
-