org.jbox2d.collision
Class PairManager

java.lang.Object
  extended by org.jbox2d.collision.PairManager

public class PairManager
extends Object


Field Summary
 BroadPhase m_broadPhase
           
 PairCallback m_callback
           
 int m_freePair
           
 int[] m_hashTable
           
 BufferedPair[] m_pairBuffer
           
 int m_pairBufferCount
           
 int m_pairCount
           
 Pair[] m_pairs
           
static int NULL_PAIR
           
static int NULL_PROXY
           
static int TABLE_CAPACITY
           
static int TABLE_MASK
           
 
Constructor Summary
PairManager()
           
 
Method Summary
 void addBufferedPair(int id1, int id2)
          Buffer a pair for addition.
 Pair addPair(int proxyId1, int proxyId2)
           
 void commit()
          commits the proxies
 boolean equals(BufferedPair pair1, BufferedPair pair2)
          returns if the pairs have the same proxy id's
 boolean equals(Pair pair, int proxyId1, int proxyId2)
          returns if the pair has the two proxy id's
 Pair find(int proxyId1, int proxyId2)
          finds the pair, creates hash and uses find(int, int, int)
 Pair find(int proxyId1, int proxyId2, int hash)
          finds the pair with the given hash
 void initialize(BroadPhase broadPhase, PairCallback callback)
           
 boolean minor(BufferedPair pair1, BufferedPair pair2)
          For sorting.
 void removeBufferedPair(int id1, int id2)
          Buffer a pair for removal.
 Object removePair(int proxyId1, int proxyId2)
           
 void validateBuffer()
          Unimplemented - for debugging purposes only in C++ version
 void validateTable()
          For debugging
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

NULL_PAIR

public static final int NULL_PAIR
See Also:
Constant Field Values

NULL_PROXY

public static final int NULL_PROXY
See Also:
Constant Field Values

TABLE_CAPACITY

public static final int TABLE_CAPACITY
See Also:
Constant Field Values

TABLE_MASK

public static final int TABLE_MASK
See Also:
Constant Field Values

m_pairs

public final Pair[] m_pairs

m_pairCount

public int m_pairCount

m_hashTable

public int[] m_hashTable

m_broadPhase

public BroadPhase m_broadPhase

m_callback

public PairCallback m_callback

m_freePair

public int m_freePair

m_pairBuffer

public final BufferedPair[] m_pairBuffer

m_pairBufferCount

public int m_pairBufferCount
Constructor Detail

PairManager

public PairManager()
Method Detail

initialize

public void initialize(BroadPhase broadPhase,
                       PairCallback callback)

addPair

public Pair addPair(int proxyId1,
                    int proxyId2)

removePair

public Object removePair(int proxyId1,
                         int proxyId2)

addBufferedPair

public void addBufferedPair(int id1,
                            int id2)
Buffer a pair for addition. We may add a pair that is not in the pair manager or pair buffer. We may add a pair that is already in the pair manager and pair buffer. If the added pair is not a new pair, then it must be in the pair buffer (because RemovePair was called).


removeBufferedPair

public void removeBufferedPair(int id1,
                               int id2)
Buffer a pair for removal.

Parameters:
id1 -
id2 -

commit

public void commit()
commits the proxies


validateBuffer

public void validateBuffer()
Unimplemented - for debugging purposes only in C++ version


validateTable

public void validateTable()
For debugging


find

public Pair find(int proxyId1,
                 int proxyId2,
                 int hash)
finds the pair with the given hash

Parameters:
proxyId1 -
proxyId2 -
hash -
Returns:

find

public Pair find(int proxyId1,
                 int proxyId2)
finds the pair, creates hash and uses find(int, int, int)

Parameters:
proxyId1 -
proxyId2 -
Returns:

equals

public final boolean equals(Pair pair,
                            int proxyId1,
                            int proxyId2)
returns if the pair has the two proxy id's

Parameters:
pair -
proxyId1 -
proxyId2 -
Returns:

equals

public final boolean equals(BufferedPair pair1,
                            BufferedPair pair2)
returns if the pairs have the same proxy id's

Parameters:
pair1 -
pair2 -
Returns:

minor

public final boolean minor(BufferedPair pair1,
                           BufferedPair pair2)
For sorting. Returns if the first pair's proxyid's are less than the second pair, starting with proxyId1

Parameters:
pair1 -
pair2 -
Returns: