2 * Copyright (c) 2003-2009 jMonkeyEngine
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are
9 * * Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
12 * * Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution.
16 * * Neither the name of 'jMonkeyEngine' nor the names of its contributors
17 * may be used to endorse or promote products derived from this software
18 * without specific prior written permission.
20 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
22 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
23 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
24 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
25 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
26 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
27 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
28 * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
29 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
30 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33 package com.jme.intersection;
35 import java.util.ArrayList;
37 import com.jme.scene.Geometry;
40 * <code>CollisionResults</code> stores the results of a collision test by
41 * storing an ArrayList of CollisionData.
44 * @version $Id: CollisionResults.java,v 1.12 2006/06/21 20:33:02 nca Exp $
46 public abstract class CollisionResults {
48 private ArrayList<CollisionData> nodeList;
51 * Constructor instantiates a new <code>PickResults</code> object.
53 public CollisionResults() {
54 nodeList = new ArrayList<CollisionData>();
58 * <code>addCollisionData</code> places a new <code>CollisionData</code>
59 * object into the results list.
62 * The collision data to be placed in the results list.
64 public void addCollisionData(CollisionData col) {
69 * <code>getNumber</code> retrieves the number of collisions that have
70 * been placed in the results.
72 * @return the number of collisions in the list.
74 public int getNumber() {
75 return nodeList.size();
79 * <code>getCollisionData</code> retrieves a CollisionData from a specific
83 * the index requested.
84 * @return the CollisionData at the specified index.
86 public CollisionData getCollisionData(int i) {
87 return nodeList.get(i);
91 * <code>clear</code> clears the list of all CollisionData.
99 * <code>addCollision</code> is an abstract method whose intent is the
100 * subclass determines what to do when two Geometry object's bounding
101 * volumes are determined to intersect.
103 * @param s the first Geometry that intersects.
104 * @param t the second Geometry that intersects.
106 public abstract void addCollision(Geometry s, Geometry t);
110 * <code>processCollisions</code> is an abstract method whose intent is
111 * the subclass defines how to process the collision data that has been
112 * collected since the last clear.
116 public abstract void processCollisions();