From aed33a5b7e2b1620c3a760aaab062149549ac034 Mon Sep 17 00:00:00 2001 From: Harvey Harrison Date: Sat, 3 Aug 2013 21:41:11 -0700 Subject: j3dcore: annotate childSwitchLinks arraylist - not quite right as this list can hold LinkRetained or SwitchRetained...NodeRetained is the closest common class Signed-off-by: Harvey Harrison --- .../share/javax/media/j3d/GroupRetained.java | 11 +++++------ src/classes/share/javax/media/j3d/LinkRetained.java | 4 +--- src/classes/share/javax/media/j3d/SetLiveState.java | 6 +++--- .../share/javax/media/j3d/SharedGroupRetained.java | 17 ++++++++--------- .../share/javax/media/j3d/SwitchRetained.java | 21 +++++++++------------ 5 files changed, 26 insertions(+), 33 deletions(-) (limited to 'src/classes') diff --git a/src/classes/share/javax/media/j3d/GroupRetained.java b/src/classes/share/javax/media/j3d/GroupRetained.java index d20dc68..e2489eb 100644 --- a/src/classes/share/javax/media/j3d/GroupRetained.java +++ b/src/classes/share/javax/media/j3d/GroupRetained.java @@ -72,8 +72,8 @@ ArrayList> altAppearances = null; // indicates whether this Group node can be the target of a collision boolean collisionTarget = false; - // per child switchLinks - ArrayList childrenSwitchLinks = null; +// per child switchLinks +ArrayList> childrenSwitchLinks = null; // the immediate childIndex of a parentSwitchLink int parentSwitchLinkChildIndex = -1; @@ -1994,21 +1994,20 @@ synchronized void setAltAppScope() { // set switch states if (nodeType == NodeRetained.SWITCH) { i = parentSwitchLinkChildIndex; - s.childSwitchLinks = (ArrayList)childrenSwitchLinks.get(i); + s.childSwitchLinks = childrenSwitchLinks.get(i); s.parentSwitchLink = this; } else { if (nodeType == NodeRetained.SHAREDGROUP) { i = parentSwitchLinkChildIndex; - s.childSwitchLinks = (ArrayList)childrenSwitchLinks.get(i); + s.childSwitchLinks = childrenSwitchLinks.get(i); s.parentSwitchLink = this; } else { s.parentSwitchLink = parentSwitchLink; if (parentSwitchLink != null) { i = parentSwitchLinkChildIndex; - s.childSwitchLinks = (ArrayList) - parentSwitchLink.childrenSwitchLinks.get(i); + s.childSwitchLinks = parentSwitchLink.childrenSwitchLinks.get(i); } } } diff --git a/src/classes/share/javax/media/j3d/LinkRetained.java b/src/classes/share/javax/media/j3d/LinkRetained.java index cdf4c8c..4ad5ddf 100644 --- a/src/classes/share/javax/media/j3d/LinkRetained.java +++ b/src/classes/share/javax/media/j3d/LinkRetained.java @@ -261,10 +261,8 @@ class LinkRetained extends LeafRetained { // remove this node from parentSwitchLink's childSwitchLink if (parentSwitchLink != null) { - ArrayList switchLinks; for(int i=0; i switchLinks = parentSwitchLink.childrenSwitchLinks.get(i); if (switchLinks.contains(this)) { switchLinks.remove(this); break; diff --git a/src/classes/share/javax/media/j3d/SetLiveState.java b/src/classes/share/javax/media/j3d/SetLiveState.java index 892b9fb..dcb306d 100644 --- a/src/classes/share/javax/media/j3d/SetLiveState.java +++ b/src/classes/share/javax/media/j3d/SetLiveState.java @@ -170,9 +170,9 @@ ArrayList childTransformLinks = null; // The current list of leaf nodes for switch targets Targets[] switchTargets = null; - // The current list of closest child switch nodes or - // link nodes under a switch node - ArrayList childSwitchLinks = null; +// The current list of closest child switch nodes or +// link nodes under a switch node +ArrayList childSwitchLinks = null; // closest parent which is a SwitchRetained or sharedGroupRetained GroupRetained parentSwitchLink = null; diff --git a/src/classes/share/javax/media/j3d/SharedGroupRetained.java b/src/classes/share/javax/media/j3d/SharedGroupRetained.java index 2de2bde..1d5b3d3 100644 --- a/src/classes/share/javax/media/j3d/SharedGroupRetained.java +++ b/src/classes/share/javax/media/j3d/SharedGroupRetained.java @@ -284,7 +284,7 @@ Vector parents = new Vector(1); SharedGroupRetained savedLastSharedGroup = s.lastSharedGroup; Targets[] savedSwitchTargets = s.switchTargets; ArrayList savedSwitchStates = s.switchStates; - ArrayList savedChildSwitchLinks = s.childSwitchLinks; + ArrayList savedChildSwitchLinks = s.childSwitchLinks; GroupRetained savedParentSwitchLink = s.parentSwitchLink; ArrayList savedChildTransformLinks = s.childTransformLinks; GroupRetained savedParentTransformLink = s.parentTransformLink; @@ -594,10 +594,9 @@ Vector parents = new Vector(1); SwitchRetained sw; LinkRetained ln; Object obj; - ArrayList childSwitchLinks; int i,j,k; - childSwitchLinks = (ArrayList)childrenSwitchLinks.get(child); + ArrayList childSwitchLinks = childrenSwitchLinks.get(child); for (i=0; i parents = new Vector(1); @Override void insertChildrenData(int index) { if (childrenSwitchLinks == null) { - childrenSwitchLinks = new ArrayList(1); + childrenSwitchLinks = new ArrayList>(1); } - childrenSwitchLinks.add(index, new ArrayList(1)); + childrenSwitchLinks.add(index, new ArrayList(1)); } @Override void appendChildrenData() { if (childrenSwitchLinks == null) { - childrenSwitchLinks = new ArrayList(1); + childrenSwitchLinks = new ArrayList>(1); } - childrenSwitchLinks.add(new ArrayList(1)); + childrenSwitchLinks.add(new ArrayList(1)); } @Override void removeChildrenData(int index) { - ArrayList oldSwitchLinks = (ArrayList)childrenSwitchLinks.get(index); + ArrayList oldSwitchLinks = childrenSwitchLinks.get(index); oldSwitchLinks.clear(); childrenSwitchLinks.remove(index); } @@ -894,7 +893,7 @@ public ArrayList getTargetsData(int type, int index) { void childDoSetLive(NodeRetained child, int childIndex, SetLiveState s) { int i; - s.childSwitchLinks = (ArrayList)childrenSwitchLinks.get(childIndex); + s.childSwitchLinks = childrenSwitchLinks.get(childIndex); s.switchStates = switchStates; if(child!=null) diff --git a/src/classes/share/javax/media/j3d/SwitchRetained.java b/src/classes/share/javax/media/j3d/SwitchRetained.java index 76aba21..eac2cb6 100644 --- a/src/classes/share/javax/media/j3d/SwitchRetained.java +++ b/src/classes/share/javax/media/j3d/SwitchRetained.java @@ -354,7 +354,7 @@ void updateSwitchChild(int child, boolean switchOn, ArrayList updat ArrayList savedSwitchStates = s.switchStates; SwitchRetained[] savedClosestSwitchParents = s.closestSwitchParents; int[] savedClosestSwitchIndices = s.closestSwitchIndices; - ArrayList savedChildSwitchLinks = s.childSwitchLinks; + ArrayList savedChildSwitchLinks = s.childSwitchLinks; GroupRetained savedParentSwitchLink = s.parentSwitchLink; int[] savedHashkeyIndex = s.hashkeyIndex; @@ -425,11 +425,9 @@ void updateSwitchChild(int child, boolean switchOn, ArrayList updat if (refCount <= 0) { // remove this node from parentSwitchLink's childSwitchLinks // clear childSwitchLinks - ArrayList switchLinks; if (parentSwitchLink != null) { for(i=0; i switchLinks = parentSwitchLink.childrenSwitchLinks.get(i); if (switchLinks.contains(this)) { switchLinks.remove(this); break; @@ -516,7 +514,6 @@ void updateSwitchChild(int child, boolean switchOn, ArrayList updat SwitchRetained sw; LinkRetained ln; Object obj; - ArrayList childSwitchLinks; boolean newSwChanged = false; ArrayList childSwitchStates = childrenSwitchStates.get(child); @@ -542,7 +539,7 @@ void updateSwitchChild(int child, boolean switchOn, ArrayList updat } - childSwitchLinks = (ArrayList)childrenSwitchLinks.get(child); + ArrayList childSwitchLinks = childrenSwitchLinks.get(child); int cslSize =childSwitchLinks.size(); for (i=0; i updat void insertChildrenData(int index) { if (childrenSwitchStates == null) { childrenSwitchStates = new ArrayList>(1); - childrenSwitchLinks = new ArrayList(1); + childrenSwitchLinks = new ArrayList>(1); } - childrenSwitchLinks.add(index, new ArrayList(1)); + childrenSwitchLinks.add(index, new ArrayList(1)); ArrayList switchStates = new ArrayList(1); childrenSwitchStates.add(index, switchStates); @@ -807,9 +804,9 @@ void updateSwitchChild(int child, boolean switchOn, ArrayList updat void appendChildrenData() { if (childrenSwitchStates == null) { childrenSwitchStates = new ArrayList>(1); - childrenSwitchLinks = new ArrayList(1); + childrenSwitchLinks = new ArrayList>(1); } - childrenSwitchLinks.add(new ArrayList(1)); + childrenSwitchLinks.add(new ArrayList(1)); ArrayList switchStates = new ArrayList(1); childrenSwitchStates.add(switchStates); @@ -826,7 +823,7 @@ void updateSwitchChild(int child, boolean switchOn, ArrayList updat oldSwitchStates.clear(); childrenSwitchStates.remove(index); - ArrayList oldSwitchLinks = (ArrayList)childrenSwitchLinks.get(index); + ArrayList oldSwitchLinks = childrenSwitchLinks.get(index); oldSwitchLinks.clear(); childrenSwitchLinks.remove(index); } @@ -835,7 +832,7 @@ void updateSwitchChild(int child, boolean switchOn, ArrayList updat void childDoSetLive(NodeRetained child, int childIndex, SetLiveState s) { int numPaths = (inSharedGroup)? s.keys.length : 1; - s.childSwitchLinks = (ArrayList)childrenSwitchLinks.get(childIndex); + s.childSwitchLinks = childrenSwitchLinks.get(childIndex); for (int j=0; j< numPaths; j++) { s.closestSwitchIndices[j] = switchIndexCount; s.closestSwitchParents[j] = this; -- cgit v1.2.3