From 238e562757742c8df155689a2a5c8f54d9e3174a Mon Sep 17 00:00:00 2001 From: Harvey Harrison Date: Sun, 26 Feb 2012 00:29:25 -0800 Subject: j3dcore: annotate NodeRetained::branchGroupPaths - also use the copy constructor rather than clone() Signed-off-by: Harvey Harrison --- .../share/javax/media/j3d/BackgroundRetained.java | 4 ++-- .../share/javax/media/j3d/BranchGroupRetained.java | 8 +++----- src/classes/share/javax/media/j3d/GroupRetained.java | 6 +++--- src/classes/share/javax/media/j3d/Locale.java | 8 ++++---- src/classes/share/javax/media/j3d/MorphRetained.java | 4 ++-- src/classes/share/javax/media/j3d/NodeRetained.java | 4 ++-- src/classes/share/javax/media/j3d/SetLiveState.java | 17 ++++++++--------- src/classes/share/javax/media/j3d/Shape3DRetained.java | 4 ++-- .../share/javax/media/j3d/SharedGroupRetained.java | 2 +- 9 files changed, 27 insertions(+), 30 deletions(-) (limited to 'src/classes') diff --git a/src/classes/share/javax/media/j3d/BackgroundRetained.java b/src/classes/share/javax/media/j3d/BackgroundRetained.java index abfda06..d3f2445 100644 --- a/src/classes/share/javax/media/j3d/BackgroundRetained.java +++ b/src/classes/share/javax/media/j3d/BackgroundRetained.java @@ -492,8 +492,8 @@ class BackgroundRetained extends LeafRetained { setLiveState.localToVworld = setLiveState.currentTransforms; setLiveState.localToVworldIndex = setLiveState.currentTransformsIndex; - setLiveState.branchGroupPaths = new ArrayList(); - setLiveState.branchGroupPaths.add(new BranchGroupRetained[0]); + setLiveState.branchGroupPaths = new ArrayList(); + setLiveState.branchGroupPaths.add(new BranchGroupRetained[0]); setLiveState.orderedPaths = new ArrayList(1); setLiveState.orderedPaths.add(new OrderedPath()); diff --git a/src/classes/share/javax/media/j3d/BranchGroupRetained.java b/src/classes/share/javax/media/j3d/BranchGroupRetained.java index 5f55764..b448cbc 100644 --- a/src/classes/share/javax/media/j3d/BranchGroupRetained.java +++ b/src/classes/share/javax/media/j3d/BranchGroupRetained.java @@ -146,10 +146,8 @@ class BranchGroupRetained extends GroupRetained { void setAuxData(SetLiveState s, int index, int hkIndex) { super.setAuxData(s, index, hkIndex); - BranchGroupRetained path[] = (BranchGroupRetained[]) - s.branchGroupPaths.get(index); - BranchGroupRetained clonePath[] = - new BranchGroupRetained[path.length+1]; + BranchGroupRetained path[] = s.branchGroupPaths.get(index); + BranchGroupRetained clonePath[] = new BranchGroupRetained[path.length + 1]; System.arraycopy(path, 0, clonePath, 0, path.length); clonePath[path.length] = this; s.branchGroupPaths.set(index, clonePath); @@ -165,7 +163,7 @@ class BranchGroupRetained extends GroupRetained { if((!inSharedGroup) || (s.keys.length == localToVworld.length)) { // restore to default and avoid calling clear() // that may clear parent reference branchGroupPaths - branchGroupPaths = new ArrayList(1); + branchGroupPaths = new ArrayList(1); } else { int i, index; diff --git a/src/classes/share/javax/media/j3d/GroupRetained.java b/src/classes/share/javax/media/j3d/GroupRetained.java index 558b7e9..1f91eaf 100644 --- a/src/classes/share/javax/media/j3d/GroupRetained.java +++ b/src/classes/share/javax/media/j3d/GroupRetained.java @@ -1530,7 +1530,7 @@ synchronized void setAltAppScope() { // Note that there is no need to clone individual // branchGroupArray since they will get replace (not append) // by creating a new reference in child's group. - s.branchGroupPaths = (ArrayList) branchGroupPaths.clone(); + s.branchGroupPaths = new ArrayList(branchGroupPaths); s.orderedPaths = orderedPaths; // Make the scoped fogs and lights of the child to include, the @@ -2213,7 +2213,7 @@ synchronized void setAltAppScope() { boolean oldcollidableArray[] = (boolean []) s.collidable.clone(); boolean workingpickableArray[] = new boolean[oldpickableArray.length]; boolean workingcollidableArray[] = new boolean[oldcollidableArray.length]; - ArrayList oldBranchGroupPaths = s.branchGroupPaths; + ArrayList oldBranchGroupPaths = s.branchGroupPaths; setScopingInfo(s); @@ -2234,7 +2234,7 @@ synchronized void setAltAppScope() { // s.branchGroupPaths will be modified by child setLive() // so we have to restore it every time. s.parentBranchGroupPaths = branchGroupPaths; - s.branchGroupPaths = (ArrayList) oldBranchGroupPaths.clone(); + s.branchGroupPaths = new ArrayList(oldBranchGroupPaths); s.inViewSpecificGroup = inViewSpecificGroup; childDoSetLive(child, i, s); } diff --git a/src/classes/share/javax/media/j3d/Locale.java b/src/classes/share/javax/media/j3d/Locale.java index 8617ad1..c5df5d6 100644 --- a/src/classes/share/javax/media/j3d/Locale.java +++ b/src/classes/share/javax/media/j3d/Locale.java @@ -217,8 +217,8 @@ public class Locale extends Object { s.localToVworld = s.currentTransforms; s.localToVworldIndex = s.currentTransformsIndex; - s.branchGroupPaths = new ArrayList(); - s.branchGroupPaths.add(new BranchGroupRetained[0]); + s.branchGroupPaths = new ArrayList(); + s.branchGroupPaths.add(new BranchGroupRetained[0]); s.orderedPaths = new ArrayList(1); s.orderedPaths.add(new OrderedPath()); @@ -503,8 +503,8 @@ public class Locale extends Object { universe.setLiveState.localToVworldIndex = universe.setLiveState.currentTransformsIndex; - universe.setLiveState.branchGroupPaths = new ArrayList(); - universe.setLiveState.branchGroupPaths.add(new BranchGroupRetained[0]); + universe.setLiveState.branchGroupPaths = new ArrayList(); + universe.setLiveState.branchGroupPaths.add(new BranchGroupRetained[0]); universe.setLiveState.orderedPaths = new ArrayList(1); universe.setLiveState.orderedPaths.add(new OrderedPath()); diff --git a/src/classes/share/javax/media/j3d/MorphRetained.java b/src/classes/share/javax/media/j3d/MorphRetained.java index e3fea05..6aeef37 100644 --- a/src/classes/share/javax/media/j3d/MorphRetained.java +++ b/src/classes/share/javax/media/j3d/MorphRetained.java @@ -1293,7 +1293,7 @@ class MorphRetained extends LeafRetained implements GeometryUpdater { shape.localToVworld[0] = localToVworld[j]; shape.localToVworldIndex[0] = localToVworldIndex[j]; - shape.branchGroupPath = (BranchGroupRetained []) branchGroupPaths.get(j); + shape.branchGroupPath = branchGroupPaths.get(j); shape.isPickable = s.pickable[i]; shape.isCollidable = s.collidable[i]; @@ -1373,7 +1373,7 @@ class MorphRetained extends LeafRetained implements GeometryUpdater { shape.localToVworldIndex = new int[1][]; shape.localToVworld[0] = this.localToVworld[0]; shape.localToVworldIndex[0] = this.localToVworldIndex[0]; - shape.branchGroupPath = (BranchGroupRetained []) branchGroupPaths.get(0); + shape.branchGroupPath = branchGroupPaths.get(0); shape.isPickable = s.pickable[0]; shape.isCollidable = s.collidable[0]; shape.initMirrorShape3D(s, this, 0); diff --git a/src/classes/share/javax/media/j3d/NodeRetained.java b/src/classes/share/javax/media/j3d/NodeRetained.java index 21f6430..d8a304c 100644 --- a/src/classes/share/javax/media/j3d/NodeRetained.java +++ b/src/classes/share/javax/media/j3d/NodeRetained.java @@ -170,7 +170,7 @@ abstract class NodeRetained extends SceneGraphObjectRetained implements NnuId { * For non BranchGroupRetained class this is a reference to * the previous BranchGroupRetained branchGroupPaths. */ - ArrayList branchGroupPaths = new ArrayList(1); +ArrayList branchGroupPaths = new ArrayList(1); // background node whose geometry branch contains this node BackgroundRetained geometryBackground = null; @@ -704,7 +704,7 @@ abstract class NodeRetained extends SceneGraphObjectRetained implements NnuId { localToVworldKeys = null; // restore to default and avoid calling clear() // that may clear parent reference branchGroupPaths - branchGroupPaths = new ArrayList(1); + branchGroupPaths = new ArrayList(1); parentTransformLink = null; parentSwitchLink = null; } diff --git a/src/classes/share/javax/media/j3d/SetLiveState.java b/src/classes/share/javax/media/j3d/SetLiveState.java index 0b72123..bf2f7c8 100644 --- a/src/classes/share/javax/media/j3d/SetLiveState.java +++ b/src/classes/share/javax/media/j3d/SetLiveState.java @@ -122,15 +122,14 @@ ArrayList> altAppearances = null; // ogCIOTableList contains a list of affected child index order. ArrayList ogCIOTableList = new ArrayList(5); - /** - * List of BranchGroup from this node to the root of tree - * This is used by BranchGroupRetained to construct - * BranchGroup lists for picking. - * - * @see NodeRetained.branchGroupPaths - */ - ArrayList branchGroupPaths = null; - ArrayList parentBranchGroupPaths = null; +/** + * List of BranchGroup from this node to the root of tree This is used by + * BranchGroupRetained to construct BranchGroup lists for picking. + * + * @see NodeRetained.branchGroupPaths + */ +ArrayList branchGroupPaths = null; +ArrayList parentBranchGroupPaths = null; /** * List of Pickable flags, one for each share path. diff --git a/src/classes/share/javax/media/j3d/Shape3DRetained.java b/src/classes/share/javax/media/j3d/Shape3DRetained.java index 3b0a35f..f5a1c65 100644 --- a/src/classes/share/javax/media/j3d/Shape3DRetained.java +++ b/src/classes/share/javax/media/j3d/Shape3DRetained.java @@ -1010,7 +1010,7 @@ class Shape3DRetained extends LeafRetained { */ shape.localToVworld[0] = localToVworld[j]; shape.localToVworldIndex[0] = localToVworldIndex[j]; - shape.branchGroupPath = (BranchGroupRetained []) branchGroupPaths.get(j); + shape.branchGroupPath = branchGroupPaths.get(j); shape.isPickable = s.pickable[i]; shape.isCollidable = s.collidable[i]; @@ -1085,7 +1085,7 @@ class Shape3DRetained extends LeafRetained { shape.localToVworldIndex = new int[1][]; shape.localToVworld[0] = localToVworld[0]; shape.localToVworldIndex[0] = localToVworldIndex[0]; - shape.branchGroupPath = (BranchGroupRetained []) branchGroupPaths.get(0); + shape.branchGroupPath = branchGroupPaths.get(0); shape.isPickable = s.pickable[0]; shape.isCollidable = s.collidable[0]; initMirrorShape3D(s, shape, 0); diff --git a/src/classes/share/javax/media/j3d/SharedGroupRetained.java b/src/classes/share/javax/media/j3d/SharedGroupRetained.java index 9052853..710fd1c 100644 --- a/src/classes/share/javax/media/j3d/SharedGroupRetained.java +++ b/src/classes/share/javax/media/j3d/SharedGroupRetained.java @@ -374,7 +374,7 @@ class SharedGroupRetained extends GroupRetained implements TargetsInterface { // restore to default and avoid calling clear() // that may clear parent reference branchGroupPaths // Note that this function did not invoke super.removeNodeData() - branchGroupPaths = new ArrayList(1); + branchGroupPaths = new ArrayList(1); orderedPaths = null; switchStates = null; cachedTargets = null; -- cgit v1.2.3