add annotations to QuadTree
This commit is contained in:
@@ -31,6 +31,7 @@ import com.seibel.distanthorizons.core.util.gridList.MovableGridRingList;
|
||||
import it.unimi.dsi.fastutil.longs.LongArrayFIFOQueue;
|
||||
import it.unimi.dsi.fastutil.longs.LongIterator;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.function.Consumer;
|
||||
@@ -96,8 +97,10 @@ public class QuadTree<T>
|
||||
//=====================//
|
||||
|
||||
/** @return the node at the given section position */
|
||||
@Nullable
|
||||
public final QuadNode<T> getNode(long pos) throws IndexOutOfBoundsException { return this.getOrSetNode(pos, false, null, true); }
|
||||
/** @return the value at the given section position */
|
||||
@Nullable
|
||||
public final T getValue(long pos) throws IndexOutOfBoundsException
|
||||
{
|
||||
QuadNode<T> node = this.getNode(pos);
|
||||
@@ -109,6 +112,7 @@ public class QuadTree<T>
|
||||
}
|
||||
|
||||
/** @return the value that was previously in the given position, null if nothing */
|
||||
@Nullable
|
||||
public final T setValue(long pos, T value) throws IndexOutOfBoundsException
|
||||
{
|
||||
T previousValue = this.getValue(pos);
|
||||
@@ -117,6 +121,7 @@ public class QuadTree<T>
|
||||
}
|
||||
|
||||
/** @param runBoundaryChecks should only ever be set to true internally for removing out of bound nodes */
|
||||
@Nullable
|
||||
protected final QuadNode<T> getOrSetNode(long pos, boolean setNewValue, T newValue, boolean runBoundaryChecks) throws IndexOutOfBoundsException
|
||||
{
|
||||
if (runBoundaryChecks && !this.isSectionPosInBounds(pos))
|
||||
|
||||
Reference in New Issue
Block a user