diff options
author | Harvey Harrison <[email protected]> | 2012-05-03 16:10:11 -0700 |
---|---|---|
committer | Harvey Harrison <[email protected]> | 2012-05-03 16:10:11 -0700 |
commit | 27e1f5b3c14e4aa7a653b26b6e39acf7d09b7d0e (patch) | |
tree | d8e1f2a77e144d2e17a12d19d9b6ac134ced199c /src/classes | |
parent | 8b3da0bc72ab269818f452df02b55c98b03dd4dc (diff) |
j3dcore: annotate users list in Screen3D
Signed-off-by: Harvey Harrison <[email protected]>
Diffstat (limited to 'src/classes')
-rw-r--r-- | src/classes/share/javax/media/j3d/Screen3D.java | 41 |
1 files changed, 16 insertions, 25 deletions
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<Canvas3D> users = new ArrayList<Canvas3D>(); 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<users.size(); i++) { - c = (Canvas3D)users.get(i); - c.redraw(); +// Add a user to the list of users +synchronized void notifyUsers() { + for (int i = 0; i < users.size(); i++) { + users.get(i).redraw(); } - } +} /** * Retrieves the width and height (in pixels) of this Screen3D. |