public abstract class

QuadTree

extends Object
implements IBounds
java.lang.Object
   ↳ org.andengine.util.adt.spatial.quadtree.QuadTree<B extends org.andengine.util.adt.bounds.IBounds, T extends org.andengine.util.adt.spatial.ISpatialItem<B>>
Known Direct Subclasses

Class Overview

TODO Make all methods non-synchronized and add a SynchronizedXZYQuadTree subclasses. (c) Zynga 2011

Summary

Nested Classes
class QuadTree.QuadTreeNode  
Constants
int LEVEL_MAX_DEFAULT
int LEVEL_ROOT
Fields
protected final B extends IBounds mBounds
protected final int mMaxLevel
protected final QuadTreeNode mRoot
Public Constructors
QuadTree(B pBounds)
Protected Constructors
QuadTree(B pBounds, int pMaxLevel)
Public Methods
synchronized void add(T pItem)
synchronized void add(T pItem, B pBounds)
synchronized void addAll(ArrayList<T> pItems)
synchronized void addAll(T... pItems)
synchronized void addAll(Collection<T> pItems)
synchronized void callItems(ParameterCallable<T> pParameterCallable)
synchronized void callNodes(ParameterCallable<QuadTreeNode> pParameterCallable)
synchronized void clear()
synchronized boolean containsAny(B pBounds)
synchronized boolean containsAny(B pBounds, IMatcher<T> pMatcher)
B getBounds()
synchronized int getItemCount()
int getMaxLevel()
synchronized boolean isEmpty()
synchronized void move(T pItem, B pOldBounds, B pNewBounds)
Shorthand for remove(pItem, pOldBounds) followed by a add(pItem, pNewBounds).
synchronized void move(T pItem, B pBounds)
Shorthand for remove(pItem, pBounds) followed by a add(pItem).
synchronized ArrayList<T> query(B pBounds)
synchronized ArrayList<T> query(B pBounds, IMatcher<T> pMatcher)
synchronized <L extends List<T>> L query(B pBounds, IMatcher<T> pMatcher, L pResult)
synchronized <L extends List<T>> L query(B pBounds, L pResult)
synchronized <L extends List<S extends T>, S> L queryForSubclass(B pBounds, IMatcher<T> pMatcher, L pResult)
@return
synchronized boolean remove(T pItem, B pBounds)
synchronized boolean remove(T pItem)
String toString()
Protected Methods
abstract QuadTreeNode getRoot()
abstract QuadTreeNode initRoot(B pBounds)
[Expand]
Inherited Methods
From class java.lang.Object

Constants

protected static final int LEVEL_MAX_DEFAULT

Constant Value: 8 (0x00000008)

protected static final int LEVEL_ROOT

Constant Value: 0 (0x00000000)

Fields

protected final B extends IBounds mBounds

protected final int mMaxLevel

protected final QuadTreeNode mRoot

Public Constructors

public QuadTree (B pBounds)

Protected Constructors

protected QuadTree (B pBounds, int pMaxLevel)

Public Methods

public synchronized void add (T pItem)

public synchronized void add (T pItem, B pBounds)

public synchronized void addAll (ArrayList<T> pItems)

public synchronized void addAll (T... pItems)

public synchronized void addAll (Collection<T> pItems)

public synchronized void callItems (ParameterCallable<T> pParameterCallable)

public synchronized void callNodes (ParameterCallable<QuadTreeNode> pParameterCallable)

public synchronized void clear ()

public synchronized boolean containsAny (B pBounds)

public synchronized boolean containsAny (B pBounds, IMatcher<T> pMatcher)

public B getBounds ()

public synchronized int getItemCount ()

public int getMaxLevel ()

public synchronized boolean isEmpty ()

public synchronized void move (T pItem, B pOldBounds, B pNewBounds)

Shorthand for remove(pItem, pOldBounds) followed by a add(pItem, pNewBounds).

Parameters
pItem to be freshly added.
pOldBounds to remove pItem with.
pNewBounds to add pItem with.

public synchronized void move (T pItem, B pBounds)

Shorthand for remove(pItem, pBounds) followed by a add(pItem).

Parameters
pItem to be freshly added.
pBounds to remove pItem with.

public synchronized ArrayList<T> query (B pBounds)

public synchronized ArrayList<T> query (B pBounds, IMatcher<T> pMatcher)

public synchronized L query (B pBounds, IMatcher<T> pMatcher, L pResult)

public synchronized L query (B pBounds, L pResult)

public synchronized L queryForSubclass (B pBounds, IMatcher<T> pMatcher, L pResult)

@return

Parameters
pMatcher must only matches(T) when the item is instanceof S, otherwise it will an ClassCastException.
Throws
ClassCastException when pMatcher matched an item that was not instanceof S.

public synchronized boolean remove (T pItem, B pBounds)

public synchronized boolean remove (T pItem)

public String toString ()

Protected Methods

protected abstract QuadTreeNode getRoot ()

protected abstract QuadTreeNode initRoot (B pBounds)