T - The precise type of tree objectspublic final class QuadTreeI<T> extends Object implements QuadTreeIType<T>
QuadTreeIType interface.| Modifier and Type | Class and Description |
|---|---|
protected class |
QuadTreeI.Quadrant |
| Modifier and Type | Method and Description |
|---|---|
com.io7m.jregions.core.unparameterized.areas.AreaI |
areaFor(T item) |
com.io7m.jregions.core.unparameterized.areas.AreaI |
bounds() |
void |
clear()
Remove all objects from the tree.
|
void |
containedBy(com.io7m.jregions.core.unparameterized.areas.AreaI area,
Set<T> items)
Returns all objects in the tree that are completely contained within
area, saving the results to items. |
boolean |
contains(T item)
Determine whether or not the object has already been inserted into the
tree.
|
static <T> QuadTreeIType<T> |
create(QuadTreeConfigurationI config)
Create a new empty tree with the given bounds.
|
boolean |
equals(Object o) |
int |
hashCode() |
boolean |
insert(T item,
com.io7m.jregions.core.unparameterized.areas.AreaI item_bounds)
Insert the object
item into the quadtree. |
<C> void |
iterateQuadrants(C context,
QuadTreeQuadrantIterationIType<T,C> f)
Iterate over all quadrants within the tree.
|
<U> QuadTreeIType<U> |
map(BiFunction<T,com.io7m.jregions.core.unparameterized.areas.AreaI,U> f)
Apply
f to each element of the tree. |
void |
overlappedBy(com.io7m.jregions.core.unparameterized.areas.AreaI area,
Set<T> items)
Returns all objects in the tree that are overlapped
area, saving the results to items. |
void |
raycast(Ray2D ray,
SortedSet<QuadTreeRaycastResultI<T>> items)
Returns all objects that are intersected by the given ray.
|
boolean |
remove(T item)
Remove the object
item from the quadtree. |
long |
size() |
void |
trim()
Trim all empty quadrants from the tree.
|
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, waitisEmptypublic static <T> QuadTreeIType<T> create(QuadTreeConfigurationI config)
T - The type of objects contained within the treeconfig - The tree configurationpublic void trim()
QuadTreeITypetrim in interface QuadTreeIType<T>public long size()
size in interface QuadTreeReadableTypepublic com.io7m.jregions.core.unparameterized.areas.AreaI bounds()
bounds in interface QuadTreeReadableIType<T>public boolean insert(T item, com.io7m.jregions.core.unparameterized.areas.AreaI item_bounds)
QuadTreeITypeInsert the object item into the quadtree.
The function returns false if the object could not be
inserted for any reason (perhaps due to being too large).
If the object is already in the tree, it is replaced. This can be used to update the bounds of an object within the tree.
insert in interface QuadTreeIType<T>item - The object to insertitem_bounds - The object's boundstrue if the object was insertedpublic boolean contains(T item)
QuadTreeReadableITypecontains in interface QuadTreeReadableIType<T>item - The objecttrue iff the object is in the treepublic boolean remove(T item)
QuadTreeITypeRemove the object item from the quadtree.
The function returns false if the object could not be
removed for any reason (perhaps due to not being in the tree in the first
place).
remove in interface QuadTreeIType<T>item - The object to removetrue if the object was removedpublic void clear()
QuadTreeITypeclear in interface QuadTreeIType<T>public <U> QuadTreeIType<U> map(BiFunction<T,com.io7m.jregions.core.unparameterized.areas.AreaI,U> f)
QuadTreeITypef to each element of the tree.map in interface QuadTreeIType<T>map in interface QuadTreeReadableIType<T>U - The type of result elementsf - A mapping functionpublic <C> void iterateQuadrants(C context,
QuadTreeQuadrantIterationIType<T,C> f)
QuadTreeReadableITypeiterateQuadrants in interface QuadTreeReadableIType<T>C - The type of context valuescontext - A contextual value passed to ff - An iteration functionpublic com.io7m.jregions.core.unparameterized.areas.AreaI areaFor(T item)
areaFor in interface QuadTreeReadableIType<T>item - The itemitempublic void containedBy(com.io7m.jregions.core.unparameterized.areas.AreaI area,
Set<T> items)
QuadTreeReadableITypearea, saving the results to items.containedBy in interface QuadTreeReadableIType<T>area - The area to examineitems - The returned itemspublic void overlappedBy(com.io7m.jregions.core.unparameterized.areas.AreaI area,
Set<T> items)
QuadTreeReadableITypearea, saving the results to items.overlappedBy in interface QuadTreeReadableIType<T>area - The area to examineitems - The returned itemspublic void raycast(Ray2D ray, SortedSet<QuadTreeRaycastResultI<T>> items)
QuadTreeReadableITyperaycast in interface QuadTreeReadableIType<T>ray - The rayitems - The intersected itemsCopyright © 2017 <code@io7m.com> http://io7m.com