diff options
author | Harvey Harrison <[email protected]> | 2013-08-03 21:41:11 -0700 |
---|---|---|
committer | Harvey Harrison <[email protected]> | 2013-08-03 21:41:11 -0700 |
commit | aed33a5b7e2b1620c3a760aaab062149549ac034 (patch) | |
tree | 0176819af59f753bec29e2c2484cb830ebd502a6 | |
parent | 18c3e4150f2a47bab868aefc28a0bf72cf0c9013 (diff) |
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 <[email protected]>
5 files changed, 26 insertions, 33 deletions
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<ArrayList<AlternateAppearanceRetained>> 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<ArrayList<NodeRetained>> 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<parentSwitchLink.childrenSwitchLinks.size();i++){ - switchLinks = (ArrayList) - parentSwitchLink.childrenSwitchLinks.get(i); + ArrayList<NodeRetained> 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<NodeRetained> 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<NodeRetained> 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<NodeRetained> parents = new Vector<NodeRetained>(1); SharedGroupRetained savedLastSharedGroup = s.lastSharedGroup; Targets[] savedSwitchTargets = s.switchTargets; ArrayList<SwitchState> savedSwitchStates = s.switchStates; - ArrayList savedChildSwitchLinks = s.childSwitchLinks; + ArrayList<NodeRetained> savedChildSwitchLinks = s.childSwitchLinks; GroupRetained savedParentSwitchLink = s.parentSwitchLink; ArrayList<NodeRetained> savedChildTransformLinks = s.childTransformLinks; GroupRetained savedParentTransformLink = s.parentTransformLink; @@ -594,10 +594,9 @@ Vector<NodeRetained> parents = new Vector<NodeRetained>(1); SwitchRetained sw; LinkRetained ln; Object obj; - ArrayList childSwitchLinks; int i,j,k; - childSwitchLinks = (ArrayList)childrenSwitchLinks.get(child); + ArrayList<NodeRetained> childSwitchLinks = childrenSwitchLinks.get(child); for (i=0; i<childSwitchLinks.size(); i++) { obj = childSwitchLinks.get(i); @@ -702,22 +701,22 @@ Vector<NodeRetained> parents = new Vector<NodeRetained>(1); @Override void insertChildrenData(int index) { if (childrenSwitchLinks == null) { - childrenSwitchLinks = new ArrayList(1); + childrenSwitchLinks = new ArrayList<ArrayList<NodeRetained>>(1); } - childrenSwitchLinks.add(index, new ArrayList(1)); + childrenSwitchLinks.add(index, new ArrayList<NodeRetained>(1)); } @Override void appendChildrenData() { if (childrenSwitchLinks == null) { - childrenSwitchLinks = new ArrayList(1); + childrenSwitchLinks = new ArrayList<ArrayList<NodeRetained>>(1); } - childrenSwitchLinks.add(new ArrayList(1)); + childrenSwitchLinks.add(new ArrayList<NodeRetained>(1)); } @Override void removeChildrenData(int index) { - ArrayList oldSwitchLinks = (ArrayList)childrenSwitchLinks.get(index); + ArrayList<NodeRetained> oldSwitchLinks = childrenSwitchLinks.get(index); oldSwitchLinks.clear(); childrenSwitchLinks.remove(index); } @@ -894,7 +893,7 @@ public ArrayList<SwitchState> 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<SwitchState> updat ArrayList<SwitchState> savedSwitchStates = s.switchStates; SwitchRetained[] savedClosestSwitchParents = s.closestSwitchParents; int[] savedClosestSwitchIndices = s.closestSwitchIndices; - ArrayList savedChildSwitchLinks = s.childSwitchLinks; + ArrayList<NodeRetained> savedChildSwitchLinks = s.childSwitchLinks; GroupRetained savedParentSwitchLink = s.parentSwitchLink; int[] savedHashkeyIndex = s.hashkeyIndex; @@ -425,11 +425,9 @@ void updateSwitchChild(int child, boolean switchOn, ArrayList<SwitchState> updat if (refCount <= 0) { // remove this node from parentSwitchLink's childSwitchLinks // clear childSwitchLinks - ArrayList switchLinks; if (parentSwitchLink != null) { for(i=0; i<parentSwitchLink.childrenSwitchLinks.size();i++) { - switchLinks = (ArrayList) - parentSwitchLink.childrenSwitchLinks.get(i); + ArrayList<NodeRetained> switchLinks = parentSwitchLink.childrenSwitchLinks.get(i); if (switchLinks.contains(this)) { switchLinks.remove(this); break; @@ -516,7 +514,6 @@ void updateSwitchChild(int child, boolean switchOn, ArrayList<SwitchState> updat SwitchRetained sw; LinkRetained ln; Object obj; - ArrayList childSwitchLinks; boolean newSwChanged = false; ArrayList<SwitchState> childSwitchStates = childrenSwitchStates.get(child); @@ -542,7 +539,7 @@ void updateSwitchChild(int child, boolean switchOn, ArrayList<SwitchState> updat } - childSwitchLinks = (ArrayList)childrenSwitchLinks.get(child); + ArrayList<NodeRetained> childSwitchLinks = childrenSwitchLinks.get(child); int cslSize =childSwitchLinks.size(); for (i=0; i<cslSize; i++) { @@ -789,10 +786,10 @@ void updateSwitchChild(int child, boolean switchOn, ArrayList<SwitchState> updat void insertChildrenData(int index) { if (childrenSwitchStates == null) { childrenSwitchStates = new ArrayList<ArrayList<SwitchState>>(1); - childrenSwitchLinks = new ArrayList(1); + childrenSwitchLinks = new ArrayList<ArrayList<NodeRetained>>(1); } - childrenSwitchLinks.add(index, new ArrayList(1)); + childrenSwitchLinks.add(index, new ArrayList<NodeRetained>(1)); ArrayList<SwitchState> switchStates = new ArrayList<SwitchState>(1); childrenSwitchStates.add(index, switchStates); @@ -807,9 +804,9 @@ void updateSwitchChild(int child, boolean switchOn, ArrayList<SwitchState> updat void appendChildrenData() { if (childrenSwitchStates == null) { childrenSwitchStates = new ArrayList<ArrayList<SwitchState>>(1); - childrenSwitchLinks = new ArrayList(1); + childrenSwitchLinks = new ArrayList<ArrayList<NodeRetained>>(1); } - childrenSwitchLinks.add(new ArrayList(1)); + childrenSwitchLinks.add(new ArrayList<NodeRetained>(1)); ArrayList<SwitchState> switchStates = new ArrayList<SwitchState>(1); childrenSwitchStates.add(switchStates); @@ -826,7 +823,7 @@ void updateSwitchChild(int child, boolean switchOn, ArrayList<SwitchState> updat oldSwitchStates.clear(); childrenSwitchStates.remove(index); - ArrayList oldSwitchLinks = (ArrayList)childrenSwitchLinks.get(index); + ArrayList<NodeRetained> oldSwitchLinks = childrenSwitchLinks.get(index); oldSwitchLinks.clear(); childrenSwitchLinks.remove(index); } @@ -835,7 +832,7 @@ void updateSwitchChild(int child, boolean switchOn, ArrayList<SwitchState> 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; |