diff options
author | Harvey Harrison <[email protected]> | 2013-07-01 08:48:27 -0700 |
---|---|---|
committer | Harvey Harrison <[email protected]> | 2013-07-01 08:48:27 -0700 |
commit | ef8761ac7a6e75743df048198363bb37f8b1cc91 (patch) | |
tree | 4396b9301b90880fe251b34e216f60e95db7229a | |
parent | 1e7c0dd2a2772aa0b81ac24eafeb7348f7bd11bb (diff) |
j3dcore: add type annotations to Enumerations of Nodes under a Group
Signed-off-by: Harvey Harrison <[email protected]>
-rw-r--r-- | src/classes/share/javax/media/j3d/Group.java | 46 | ||||
-rw-r--r-- | src/classes/share/javax/media/j3d/GroupRetained.java | 59 |
2 files changed, 51 insertions, 54 deletions
diff --git a/src/classes/share/javax/media/j3d/Group.java b/src/classes/share/javax/media/j3d/Group.java index 2457f27..b0e7ae6 100644 --- a/src/classes/share/javax/media/j3d/Group.java +++ b/src/classes/share/javax/media/j3d/Group.java @@ -222,24 +222,23 @@ public class Group extends Node { ((GroupRetained)this.retained).removeChild(index); } - /** - * Retrieves the child node at the specified index in - * this group node's list of children. - * @param index which child to return. - * @return the children at location index. The <code>index</code> - * must be a value - * greater than or equal to 0 and less than <code>numChildren()</code>. - * @exception CapabilityNotSetException if the appropriate capability is - * not set and this group node is part of live or compiled scene graph - * @exception IndexOutOfBoundsException if <code>index</code> is invalid. - */ - public Node getChild(int index) { - if (isLiveOrCompiled()) - if(!this.getCapability(ALLOW_CHILDREN_READ)) - throw new CapabilityNotSetException(J3dI18N.getString("Group9")); - - return (Node) ((GroupRetained)this.retained).getChild(index); - } + /** + * Retrieves the child node at the specified index in + * this group node's list of children. + * @param index which child to return. + * @return the children at location index. The <code>index</code> + * must be a value + * greater than or equal to 0 and less than <code>numChildren()</code>. + * @exception CapabilityNotSetException if the appropriate capability is + * not set and this group node is part of live or compiled scene graph + * @exception IndexOutOfBoundsException if <code>index</code> is invalid. + */ + public Node getChild(int index) { + if (isLiveOrCompiled() && !this.getCapability(ALLOW_CHILDREN_READ)) + throw new CapabilityNotSetException(J3dI18N.getString("Group9")); + + return ((GroupRetained)this.retained).getChild(index); + } /** * Returns an Enumeration object of this group node's list of children. @@ -247,13 +246,12 @@ public class Group extends Node { * @exception CapabilityNotSetException if the appropriate capability is * not set and this group node is part of live or compiled scene graph */ - public Enumeration getAllChildren() { - if (isLiveOrCompiled()) - if(!this.getCapability(ALLOW_CHILDREN_READ)) - throw new CapabilityNotSetException(J3dI18N.getString("Group9")); + public Enumeration<Node> getAllChildren() { + if (isLiveOrCompiled() && !this.getCapability(ALLOW_CHILDREN_READ)) + throw new CapabilityNotSetException(J3dI18N.getString("Group9")); - return (Enumeration)((GroupRetained)this.retained).getAllChildren(); - } + return ((GroupRetained)this.retained).getAllChildren(); + } /** * Appends the specified child node to this group node's list of children. diff --git a/src/classes/share/javax/media/j3d/GroupRetained.java b/src/classes/share/javax/media/j3d/GroupRetained.java index 971fa15..5cb6ed6 100644 --- a/src/classes/share/javax/media/j3d/GroupRetained.java +++ b/src/classes/share/javax/media/j3d/GroupRetained.java @@ -424,38 +424,37 @@ ArrayList<ArrayList<View>> viewLists = null; } - /** - * Returns the child specified by the index. - * @param index which child to return - * @return the children at location index - */ - Node getChild(int index) { - - NodeRetained sgo = children.get(index); - if(sgo == null) - return null; - else - return (Node) sgo.source; - } - - /** - * Returns an enumeration object of the children. - * @return an enumeration object of the children - */ - Enumeration getAllChildren() { - Vector userChildren=new Vector(children.size()); - - for(int i=0; i<children.size(); i++) { - NodeRetained sgo = children.get(i); - if(sgo != null) - userChildren.add(sgo.source); - else - userChildren.add(null); + /** + * Returns the child specified by the index. + * @param index which child to return + * @return the children at location index + */ + Node getChild(int index) { + NodeRetained sgo = children.get(index); + if (sgo == null) + return null; + else + return (Node)sgo.source; + } + + /** + * Returns an enumeration object of the children. + * @return an enumeration object of the children + */ + Enumeration<Node> getAllChildren() { + Vector<Node> userChildren = new Vector<Node>(children.size()); + + for (int i = 0; i < children.size(); i++) { + NodeRetained sgo = children.get(i); + if (sgo != null) + userChildren.add((Node)sgo.source); + else + userChildren.add(null); + } + + return userChildren.elements(); } - return userChildren.elements(); - } - void checkValidChild(Node child, String s) { if ((child != null) && |