stack to deque

experimental
Phr00t 11 years ago
parent d200e406d5
commit ecf6297783
  1. 7
      jme3-bullet/src/main/java/com/jme3/bullet/PhysicsSpace.java

@ -46,14 +46,13 @@ import com.jme3.math.Transform;
import com.jme3.math.Vector3f; import com.jme3.math.Vector3f;
import com.jme3.scene.Node; import com.jme3.scene.Node;
import com.jme3.scene.Spatial; import com.jme3.scene.Spatial;
import com.jme3.util.SafeArrayList; import java.util.ArrayDeque;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collection; import java.util.Collection;
import java.util.Iterator; import java.util.Iterator;
import java.util.LinkedList; import java.util.LinkedList;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Stack;
import java.util.concurrent.Callable; import java.util.concurrent.Callable;
import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentLinkedQueue; import java.util.concurrent.ConcurrentLinkedQueue;
@ -95,7 +94,7 @@ public class PhysicsSpace {
private Map<Long, PhysicsJoint> physicsJoints = new ConcurrentHashMap<Long, PhysicsJoint>(); private Map<Long, PhysicsJoint> physicsJoints = new ConcurrentHashMap<Long, PhysicsJoint>();
private Map<Long, PhysicsVehicle> physicsVehicles = new ConcurrentHashMap<Long, PhysicsVehicle>(); private Map<Long, PhysicsVehicle> physicsVehicles = new ConcurrentHashMap<Long, PhysicsVehicle>();
private ArrayList<PhysicsCollisionListener> collisionListeners = new ArrayList<PhysicsCollisionListener>(); private ArrayList<PhysicsCollisionListener> collisionListeners = new ArrayList<PhysicsCollisionListener>();
private Stack<PhysicsCollisionEvent> collisionEvents = new Stack<PhysicsCollisionEvent>(); private ArrayDeque<PhysicsCollisionEvent> collisionEvents = new ArrayDeque<PhysicsCollisionEvent>();
private Map<Integer, PhysicsCollisionGroupListener> collisionGroupListeners = new ConcurrentHashMap<Integer, PhysicsCollisionGroupListener>(); private Map<Integer, PhysicsCollisionGroupListener> collisionGroupListeners = new ConcurrentHashMap<Integer, PhysicsCollisionGroupListener>();
private ConcurrentLinkedQueue<PhysicsTickListener> tickListeners = new ConcurrentLinkedQueue<PhysicsTickListener>(); private ConcurrentLinkedQueue<PhysicsTickListener> tickListeners = new ConcurrentLinkedQueue<PhysicsTickListener>();
private PhysicsCollisionEventFactory eventFactory = new PhysicsCollisionEventFactory(); private PhysicsCollisionEventFactory eventFactory = new PhysicsCollisionEventFactory();
@ -365,7 +364,7 @@ public class PhysicsSpace {
public void distributeEvents() { public void distributeEvents() {
//add collision callbacks //add collision callbacks
int clistsize = collisionListeners.size(); int clistsize = collisionListeners.size();
while( collisionEvents.empty() == false ) { while( collisionEvents.isEmpty() == false ) {
PhysicsCollisionEvent physicsCollisionEvent = collisionEvents.pop(); PhysicsCollisionEvent physicsCollisionEvent = collisionEvents.pop();
for(int i=0;i<clistsize;i++) { for(int i=0;i<clistsize;i++) {
collisionListeners.get(i).collision(physicsCollisionEvent); collisionListeners.get(i).collision(physicsCollisionEvent);

Loading…
Cancel
Save