aboutsummaryrefslogtreecommitdiffstats
path: root/src/classes
diff options
context:
space:
mode:
authorHarvey Harrison <[email protected]>2013-01-27 10:20:23 -0800
committerHarvey Harrison <[email protected]>2013-01-27 10:20:23 -0800
commit4eba3daeeed92726954784394f0b298450a3cd0b (patch)
treec9ed78ddd4d55efc623cd76f20e01e8534585e12 /src/classes
parent6cdf2bc4112f69dac505e7538b7f9bb6e4f9b522 (diff)
j3dcore: annotate list of Views in Physical body, call remove directly
Signed-off-by: Harvey Harrison <[email protected]>
Diffstat (limited to 'src/classes')
-rw-r--r--src/classes/share/javax/media/j3d/PhysicalBody.java29
1 files changed, 12 insertions, 17 deletions
diff --git a/src/classes/share/javax/media/j3d/PhysicalBody.java b/src/classes/share/javax/media/j3d/PhysicalBody.java
index 448284f..b263551 100644
--- a/src/classes/share/javax/media/j3d/PhysicalBody.java
+++ b/src/classes/share/javax/media/j3d/PhysicalBody.java
@@ -96,8 +96,8 @@ public class PhysicalBody extends Object {
// This is used in both SCREEN_VIEW and HMD_VIEW modes.
Transform3D headToHeadTracker = new Transform3D();
- // A list of View Objects that refer to this
- ArrayList users = new ArrayList();
+// A list of View Objects that refer to this
+ArrayList<View> users = new ArrayList<View>();
// Mask that indicates this PhysicalBody's view dependence info. has changed,
// and CanvasViewCache may need to recompute the final view matries.
@@ -124,26 +124,21 @@ public class PhysicalBody extends Object {
initHeadToHeadTracker();
}
- // Add a user to the list of users
- synchronized void removeUser(View view) {
- int idx = users.indexOf(view);
- if (idx >= 0) {
- users.remove(idx);
- }
- }
+// Add a user to the list of users
+synchronized void removeUser(View view) {
+ users.remove(view);
+}
- // Add a user to the list of users
- synchronized void addUser(View view) {
- int idx = users.indexOf(view);
- if (idx < 0) {
- users.add(view);
- }
- }
+// Add a user to the list of users
+synchronized void addUser(View view) {
+ if (!users.contains(view))
+ users.add(view);
+}
// Add a user to the list of users
synchronized void notifyUsers() {
for (int i=users.size()-1; i>=0; i--) {
- View view = (View)users.get(i);
+ View view = users.get(i);
// XXXX: notifyUsers should have a parameter denoting field changed
if (view.soundScheduler != null) {
view.soundScheduler.setListenerFlag(