Atavism Version 2018.1AGIS API

atavism.server.engine
Class QuadTreeNode<ElementType extends QuadTreeElement<ElementType>>

java.lang.Object
  extended by atavism.server.engine.QuadTreeNode<ElementType>
Type Parameters:
ElementType -

public class QuadTreeNode<ElementType extends QuadTreeElement<ElementType>>
extends java.lang.Object

A node on the Quad Tree that can contain either a collection of elements or is split up into 4 child nodes if the number of elements exceeds the max size. Also contains a set of perceivers that can currently see this node (and as such the actions of the elements in this node).

Author:
Andrew Harrison

Nested Class Summary
static class QuadTreeNode.NodeType
           
 
Field Summary
 java.util.concurrent.locks.Lock lock
           
protected static boolean logPath
           
 
Method Summary
 void addPerceiverExtentObject(ElementType elem, Point loc, int radius)
          adds the elem to the ancilliary list of perceivable objects for all subnodes.
 void addRegion(Region region)
          Add region to QuadTreeNode's children.
 boolean containsPoint(Point loc)
          Returns whether the passed in location is within the current node (including its children).
 boolean containsPointWithHysteresis(Point loc)
           
 QuadTreeNode<ElementType> getChild(int i)
           
 QuadTreeNode<ElementType> getChild(Point p)
           
 java.util.ArrayList<QuadTreeNode<ElementType>> getChildren()
           
 java.util.Set<ElementType> getElementsBetween(Point loc1, Point loc2)
           
 Geometry getGeometry()
          returns a copied geometry
 QuadTreeNode.NodeType getNodeType()
           
 java.util.Set<ElementType> getPerceiverExtentObjects()
          Gets the set of objects that are not in this node, but are perceivable from it.
 java.util.List<Region> getRegionByLoc(Point loc)
          Get regions that contain point 'loc'.
 java.util.ArrayList<Region> getRegions()
          Get regions intersecting with this QuadTreeNode.
 QuadTree<ElementType> getTree()
           
 void removePerceiverExtentObject(ElementType elem)
          adds the elem to the ancilliary list of perceivable objects for all subnodes.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

lock

public transient java.util.concurrent.locks.Lock lock

logPath

protected static boolean logPath
Method Detail

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

containsPoint

public boolean containsPoint(Point loc)
Returns whether the passed in location is within the current node (including its children).


containsPointWithHysteresis

public boolean containsPointWithHysteresis(Point loc)

getTree

public QuadTree<ElementType> getTree()

getElementsBetween

public java.util.Set<ElementType> getElementsBetween(Point loc1,
                                                     Point loc2)

addPerceiverExtentObject

public void addPerceiverExtentObject(ElementType elem,
                                     Point loc,
                                     int radius)
adds the elem to the ancilliary list of perceivable objects for all subnodes. By definition, the containing node has the extent-based element on its list.


removePerceiverExtentObject

public void removePerceiverExtentObject(ElementType elem)
adds the elem to the ancilliary list of perceivable objects for all subnodes. By definition, the containing node has the extent-based element on its list.


getChildren

public java.util.ArrayList<QuadTreeNode<ElementType>> getChildren()

getChild

public QuadTreeNode<ElementType> getChild(int i)

getChild

public QuadTreeNode<ElementType> getChild(Point p)

getRegions

public java.util.ArrayList<Region> getRegions()
Get regions intersecting with this QuadTreeNode. Only leaf nodes have regions.


addRegion

public void addRegion(Region region)
Add region to QuadTreeNode's children. Region is only added to intersecting leaf nodes.


getRegionByLoc

public java.util.List<Region> getRegionByLoc(Point loc)
Get regions that contain point 'loc'. Only the node's regions are considered. 'loc' should be inside the node.


getGeometry

public Geometry getGeometry()
returns a copied geometry


getNodeType

public QuadTreeNode.NodeType getNodeType()

getPerceiverExtentObjects

public java.util.Set<ElementType> getPerceiverExtentObjects()
Gets the set of objects that are not in this node, but are perceivable from it.

Returns:


Copyright © 2018 Dragonsan Studios Sp. z o.o.