Class IntervalTree<V extends Interval>
java.lang.Object
net.buildtheearth.terraminusminus.util.interval.IntervalTree<V>
Implementation of a segment tree along a single axis of a series of 2-dimensional line segments.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprotected static final classIntervalTree.Node<V extends Interval>A node in the segment tree (either a leaf or internal node). -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected static final io.netty.util.concurrent.FastThreadLocal<List<?>> protected static final intThe number of values that must be present in a node in order for it to become eligible for splitting.protected final IntervalTree.Node<V> protected final int -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected static <V extends Interval>
IntervalTree.Node<V>[]createNodeArray(int length) voidRuns the given function on every value in the tree.voidforEachIntersecting(double point, @NonNull Consumer<V> callback) Runs the given function on every value that contains the given point.getAllIntersecting(double point) Gets aListcontaining every value that contains the given point.intsize()toString()
-
Field Details
-
LIST_CACHE
-
NODE_SPLIT_CAPACITY
protected static final int NODE_SPLIT_CAPACITYThe number of values that must be present in a node in order for it to become eligible for splitting. -
root
-
size
protected final int size
-
-
Constructor Details
-
IntervalTree
-
-
Method Details
-
createNodeArray
-
getAllIntersecting
Gets aListcontaining every value that contains the given point.- Parameters:
point- the interval that values must contain- Returns:
- the values
-
forEachIntersecting
Runs the given function on every value that contains the given point.- Parameters:
point- the interval that values must containcallback- the callback function to run
-
forEach
Runs the given function on every value in the tree.- Parameters:
callback- the callback function to run
-
toString
-
size
public int size()
-