From 27e1f5b3c14e4aa7a653b26b6e39acf7d09b7d0e Mon Sep 17 00:00:00 2001 From: Harvey Harrison Date: Thu, 3 May 2012 16:10:11 -0700 Subject: j3dcore: annotate users list in Screen3D Signed-off-by: Harvey Harrison --- src/classes/share/javax/media/j3d/Screen3D.java | 41 ++++++++++--------------- 1 file changed, 16 insertions(+), 25 deletions(-) (limited to 'src') diff --git a/src/classes/share/javax/media/j3d/Screen3D.java b/src/classes/share/javax/media/j3d/Screen3D.java index 7d02fcf..fe15eb3 100644 --- a/src/classes/share/javax/media/j3d/Screen3D.java +++ b/src/classes/share/javax/media/j3d/Screen3D.java @@ -180,8 +180,8 @@ public class Screen3D extends Object { // A count of the number of active View associated with this screen UnorderList activeViews = new UnorderList(1, View.class); - // A list of Canvas3D Objects that refer to this - ArrayList users = new ArrayList(); + // A list of Canvas3D Objects that refer to this + private final ArrayList users = new ArrayList(); void addActiveView(View v) { activeViews.addUnique(v); @@ -195,32 +195,23 @@ public class Screen3D extends Object { return activeViews.isEmpty(); } - // Add a user to the list of users - synchronized void removeUser(Canvas3D c) { - int idx = users.indexOf(c); - if (idx >= 0) { - users.remove(idx); - } - } - - // Add a user to the list of users - synchronized void addUser(Canvas3D c) { - int idx = users.indexOf(c); - if (idx < 0) { - users.add(c); - } - } +// Add a user to the list of users +synchronized void removeUser(Canvas3D c) { + users.remove(c); +} - // Add a user to the list of users - synchronized void notifyUsers() { - int i; - Canvas3D c; +// Add a user to the list of users +synchronized void addUser(Canvas3D c) { + if (!users.contains(c)) + users.add(c); +} - for (i=0; i