diff options
author | phil <[email protected]> | 2016-12-07 18:51:02 +1300 |
---|---|---|
committer | phil <[email protected]> | 2016-12-07 18:51:02 +1300 |
commit | b9ca5f458228492ef3dfba6b85c8cc188860f42e (patch) | |
tree | 729dd932d0cc3add790f0ac522a31e40a0c9874f /src/main/java | |
parent | 1611b9e160e381d28b62ec1fbde3ca9b74246f22 (diff) |
Enumeration swapped to typed Iterator
All Enumerations swapped and generic types added
See docs/api-changes-1.7.txt
THIS WILL BREAK YOUR CODE!
But the change is very minor to adjust to.
Diffstat (limited to 'src/main/java')
47 files changed, 285 insertions, 249 deletions
diff --git a/src/main/java/org/jogamp/java3d/AlternateAppearance.java b/src/main/java/org/jogamp/java3d/AlternateAppearance.java index e186d78..eeb2e73 100644 --- a/src/main/java/org/jogamp/java3d/AlternateAppearance.java +++ b/src/main/java/org/jogamp/java3d/AlternateAppearance.java @@ -26,7 +26,7 @@ package org.jogamp.java3d; -import java.util.Enumeration; +import java.util.Iterator; /** @@ -365,14 +365,14 @@ public class AlternateAppearance extends Leaf { /** - * Returns an enumeration of this AlternateAppearance node's list + * Returns an iterator of this AlternateAppearance node's list * of scopes. - * @return an Enumeration object containing all nodes in this + * @return an Iterator object containing all nodes in this * AlternateAppearance node's list of scopes. * @exception CapabilityNotSetException if appropriate capability is * not set and this object is part of live or compiled scene graph */ -public Enumeration<Group> getAllScopes() { +public Iterator<Group> getAllScopes() { if (isLiveOrCompiled()) if (!this.getCapability(ALLOW_SCOPE_READ)) throw new CapabilityNotSetException(J3dI18N.getString("AlternateAppearance11")); @@ -538,10 +538,10 @@ public Enumeration<Group> getAllScopes() { rt.initInfluencingBounds(attr.getInfluencingBounds()); - Enumeration<Group> elm = attr.getAllScopes(); - while (elm.hasMoreElements()) { + Iterator<Group> elm = attr.getAllScopes(); + while (elm.hasNext()) { // this reference will set correctly in updateNodeReferences() callback - rt.initAddScope(elm.nextElement()); + rt.initAddScope(elm.next()); } // correct value will set in updateNodeReferences diff --git a/src/main/java/org/jogamp/java3d/AlternateAppearanceRetained.java b/src/main/java/org/jogamp/java3d/AlternateAppearanceRetained.java index d36e772..8f143a3 100644 --- a/src/main/java/org/jogamp/java3d/AlternateAppearanceRetained.java +++ b/src/main/java/org/jogamp/java3d/AlternateAppearanceRetained.java @@ -28,7 +28,7 @@ package org.jogamp.java3d; import java.util.ArrayList; -import java.util.Enumeration; +import java.util.Iterator; import java.util.Vector; @@ -349,16 +349,16 @@ Vector<GroupRetained> scopes = new Vector<GroupRetained>(); } /** - * Returns an enumeration object of the scoperen. - * @return an enumeration object of the scoperen + * Returns an iterator object of the scoperen. + * @return an iterator object of the scoperen */ -Enumeration<Group> getAllScopes() { - Enumeration<GroupRetained> elm = scopes.elements(); +Iterator<Group> getAllScopes() { + Iterator<GroupRetained> elm = scopes.iterator(); Vector<Group> v = new Vector<Group>(scopes.size()); - while (elm.hasMoreElements()) { - v.add((Group)elm.nextElement().source); + while (elm.hasNext()) { + v.add((Group)elm.next().source); } - return v.elements(); + return v.iterator(); } /** @@ -811,10 +811,10 @@ Enumeration<Group> getAllScopes() { // setInfluencingBounds(alternate appearance.getInfluencingBounds()); -// Enumeration elm = alternate appearance.getAllScopes(); -// while (elm.hasMoreElements()) { +// Iterator elm = alternate appearance.getAllScopes(); +// while (elm.hasNext()) { // // this reference will set correctly in updateNodeReferences() callback -// addScope((Group) elm.nextElement()); +// addScope((Group) elm.next()); // } // // this reference will set correctly in updateNodeReferences() callback diff --git a/src/main/java/org/jogamp/java3d/AudioDevice.java b/src/main/java/org/jogamp/java3d/AudioDevice.java index cda1443..913edb8 100644 --- a/src/main/java/org/jogamp/java3d/AudioDevice.java +++ b/src/main/java/org/jogamp/java3d/AudioDevice.java @@ -130,7 +130,7 @@ package org.jogamp.java3d; * with the Java3D sound scheduler by associating this device with a * PhysicalEnvironment. The setAudioDevice method introduces new devices * to the Java3D environment and the allAudioDevices method produces an - * enumeration that allows examining all available devices within a Java3D + * iterator that allows examining all available devices within a Java3D * environment. See PhysicalEnvironment class for more details.</UL> * <P> * General Rules for calling AudioDevice methods: diff --git a/src/main/java/org/jogamp/java3d/AudioDeviceEnumerator.java b/src/main/java/org/jogamp/java3d/AudioDeviceEnumerator.java index 548712f..621c057 100644 --- a/src/main/java/org/jogamp/java3d/AudioDeviceEnumerator.java +++ b/src/main/java/org/jogamp/java3d/AudioDeviceEnumerator.java @@ -26,7 +26,7 @@ package org.jogamp.java3d; -import java.util.Enumeration; +import java.util.Iterator; import java.util.NoSuchElementException; /** @@ -36,7 +36,7 @@ import java.util.NoSuchElementException; * execution environment of the currently running Java 3D application. */ -class AudioDeviceEnumerator implements Enumeration { +class AudioDeviceEnumerator implements Iterator<AudioDevice> { boolean endOfList; // NOTE: list length always equals one or zero AudioDevice device; @@ -60,7 +60,7 @@ class AudioDeviceEnumerator implements Enumeration { * @return true if the enumerator has more elements, false otherwise */ @Override - public boolean hasMoreElements() { + public boolean hasNext() { if(endOfList == false) return true; else @@ -72,12 +72,19 @@ class AudioDeviceEnumerator implements Enumeration { * @return the next element in this enumerator */ @Override - public Object nextElement() { - if (this.hasMoreElements()) { + public AudioDevice next() { + if (this.hasNext()) { endOfList = true; - return ((Object) device); + return device; } else { throw new NoSuchElementException(J3dI18N.getString("AudioDeviceEnumerator0")); } } + + @Override + public void remove() + { + throw new UnsupportedOperationException(); + + } } diff --git a/src/main/java/org/jogamp/java3d/Behavior.java b/src/main/java/org/jogamp/java3d/Behavior.java index b9d8278..1032177 100644 --- a/src/main/java/org/jogamp/java3d/Behavior.java +++ b/src/main/java/org/jogamp/java3d/Behavior.java @@ -27,7 +27,7 @@ package org.jogamp.java3d; -import java.util.Enumeration; +import java.util.Iterator; /** * The Behavior leaf node provides a framework for adding user-defined @@ -133,7 +133,7 @@ import java.util.Enumeration; * <P> * <UL> * <LI>Code to decode and extract references from the WakeupCondition - * enumeration that caused the object's awakening.</LI> + * iterator that caused the object's awakening.</LI> * <LI>Code to perform the manipulations associated with the * WakeupCondition</LI> * <LI>Code to establish this behavior's new WakeupCondition</LI> @@ -150,7 +150,7 @@ import java.util.Enumeration; * node provides the Java 3D behavior scheduler with a WakeupCondition * object. When that object's WakeupCondition has been satisfied, the * behavior scheduler hands that same WakeupCondition back to the - * Behavior via an enumeration. + * Behavior via an iterator. * * <P> * <b>WakeupCriterion Object</b> @@ -238,10 +238,10 @@ public abstract class Behavior extends Leaf { * <br> * NOTE: Applications should <i>not</i> call this method. It is called * by the Java 3D behavior scheduler. - * @param criteria an enumeration of triggered wakeup criteria for this + * @param criteria an iterator of triggered wakeup criteria for this * behavior */ - public abstract void processStimulus(Enumeration criteria); + public abstract void processStimulus(Iterator<WakeupCriterion> criteria); /** * Set the Behavior's scheduling region to the specified bounds. diff --git a/src/main/java/org/jogamp/java3d/Billboard.java b/src/main/java/org/jogamp/java3d/Billboard.java index 6851533..c9c24d3 100644 --- a/src/main/java/org/jogamp/java3d/Billboard.java +++ b/src/main/java/org/jogamp/java3d/Billboard.java @@ -26,7 +26,7 @@ package org.jogamp.java3d; -import java.util.Enumeration; +import java.util.Iterator; import org.jogamp.vecmath.AxisAngle4d; import org.jogamp.vecmath.Point3d; @@ -306,11 +306,11 @@ public class Billboard extends Behavior { /** * Process stimulus method that computes appropriate transform. - * @param criteria an enumeration of the criteria that caused the + * @param criteria an iterator of the criteria that caused the * stimulus */ @Override - public void processStimulus(Enumeration criteria) { + public void processStimulus(Iterator<WakeupCriterion> criteria) { double angle = 0.0; double sign; diff --git a/src/main/java/org/jogamp/java3d/ColorInterpolator.java b/src/main/java/org/jogamp/java3d/ColorInterpolator.java index 53cd453..59ef505 100644 --- a/src/main/java/org/jogamp/java3d/ColorInterpolator.java +++ b/src/main/java/org/jogamp/java3d/ColorInterpolator.java @@ -26,7 +26,7 @@ package org.jogamp.java3d; -import java.util.Enumeration; +import java.util.Iterator; import org.jogamp.vecmath.Color3f; @@ -168,11 +168,11 @@ public class ColorInterpolator extends Interpolator { * or specular color (or both the ambient and diffuse color) of * the specified target Material object with this new color value. * - * @param criteria an enumeration of the criteria that caused the + * @param criteria an iterator of the criteria that caused the * stimulus */ @Override - public void processStimulus(Enumeration criteria) { + public void processStimulus(Iterator<WakeupCriterion> criteria) { // Handle stimulus WakeupCriterion criterion = passiveWakeupCriterion; diff --git a/src/main/java/org/jogamp/java3d/CompressedGeometryRenderMethod.java b/src/main/java/org/jogamp/java3d/CompressedGeometryRenderMethod.java index 63a69fc..491afdb 100644 --- a/src/main/java/org/jogamp/java3d/CompressedGeometryRenderMethod.java +++ b/src/main/java/org/jogamp/java3d/CompressedGeometryRenderMethod.java @@ -30,7 +30,7 @@ package org.jogamp.java3d; * The RenderMethod interface is used to create various ways to render * different geometries. */ - +@Deprecated class CompressedGeometryRenderMethod implements RenderMethod { /** diff --git a/src/main/java/org/jogamp/java3d/CompressedGeometryRetained.java b/src/main/java/org/jogamp/java3d/CompressedGeometryRetained.java index 0654f56..8c13acd 100644 --- a/src/main/java/org/jogamp/java3d/CompressedGeometryRetained.java +++ b/src/main/java/org/jogamp/java3d/CompressedGeometryRetained.java @@ -35,6 +35,7 @@ import org.jogamp.vecmath.Point3d; * hardware support becomes available, increased rendering performance * will also result from the use of compressed geometry. */ +@Deprecated class CompressedGeometryRetained extends GeometryRetained { // If not in by-reference mode, a 48-byte header as defined by the @@ -57,7 +58,7 @@ class CompressedGeometryRetained extends GeometryRetained { private static final int HEADER_BUFFER_DATA_OFFSET = 4 ; // The OpenGL compressed geometry extensions use bits instead of - // enumerations to represent the type of compressed geometry. + // iterators to represent the type of compressed geometry. static final byte TYPE_POINT = 1 ; static final byte TYPE_LINE = 2 ; static final byte TYPE_TRIANGLE = 4 ; diff --git a/src/main/java/org/jogamp/java3d/DistanceLOD.java b/src/main/java/org/jogamp/java3d/DistanceLOD.java index a489edc..1664109 100644 --- a/src/main/java/org/jogamp/java3d/DistanceLOD.java +++ b/src/main/java/org/jogamp/java3d/DistanceLOD.java @@ -26,7 +26,7 @@ package org.jogamp.java3d; -import java.util.Enumeration; +import java.util.Iterator; import org.jogamp.vecmath.Point3f; @@ -171,11 +171,11 @@ public class DistanceLOD extends LOD { /** * Process stimulus method that computes appropriate level of detail. - * @param criteria an enumeration of the criteria that caused the + * @param criteria an iterator of the criteria that caused the * stimulus */ @Override - public void processStimulus(Enumeration criteria) { + public void processStimulus(Iterator<WakeupCriterion> criteria) { // compute distance in virtual world diff --git a/src/main/java/org/jogamp/java3d/Fog.java b/src/main/java/org/jogamp/java3d/Fog.java index 666891f..16c0c48 100644 --- a/src/main/java/org/jogamp/java3d/Fog.java +++ b/src/main/java/org/jogamp/java3d/Fog.java @@ -26,7 +26,7 @@ package org.jogamp.java3d; -import java.util.Enumeration; +import java.util.Iterator; import org.jogamp.vecmath.Color3f; @@ -349,13 +349,13 @@ public abstract class Fog extends Leaf { /** - * Returns an enumeration of this Fog node's list of scopes. - * @return an Enumeration object containing all nodes in this Fog node's + * Returns an iterator of this Fog node's list of scopes. + * @return an Iterator object containing all nodes in this Fog node's * list of scopes. * @exception CapabilityNotSetException if appropriate capability is * not set and this object is part of live or compiled scene graph */ -public Enumeration<Group> getAllScopes() { +public Iterator<Group> getAllScopes() { if (isLiveOrCompiled()) if (!this.getCapability(ALLOW_SCOPE_READ)) throw new CapabilityNotSetException(J3dI18N.getString("Fog11")); @@ -511,10 +511,10 @@ public Enumeration<Group> getAllScopes() { rt.initColor(c); rt.initInfluencingBounds(attr.getInfluencingBounds()); - Enumeration<Group> elm = attr.getAllScopes(); - while (elm.hasMoreElements()) { + Iterator<Group> elm = attr.getAllScopes(); + while (elm.hasNext()) { // this reference will set correctly in updateNodeReferences() callback - rt.initAddScope(elm.nextElement()); + rt.initAddScope(elm.next()); } // this reference will set correctly in updateNodeReferences() callback diff --git a/src/main/java/org/jogamp/java3d/FogRetained.java b/src/main/java/org/jogamp/java3d/FogRetained.java index 69a0e87..104caeb 100644 --- a/src/main/java/org/jogamp/java3d/FogRetained.java +++ b/src/main/java/org/jogamp/java3d/FogRetained.java @@ -27,7 +27,7 @@ package org.jogamp.java3d; import java.util.ArrayList; -import java.util.Enumeration; +import java.util.Iterator; import java.util.Vector; import org.jogamp.vecmath.Color3f; @@ -331,16 +331,16 @@ Vector<GroupRetained> scopes = new Vector<GroupRetained>(); } /** - * Returns an enumeration object of the scoperen. - * @return an enumeration object of the scoperen + * Returns an iterator object of the scoperen. + * @return an iterator object of the scoperen */ -Enumeration<Group> getAllScopes() { - Enumeration<GroupRetained> elm = scopes.elements(); +Iterator<Group> getAllScopes() { + Iterator<GroupRetained> elm = scopes.iterator(); Vector<Group> v = new Vector<Group>(scopes.size()); - while (elm.hasMoreElements()) { - v.add((Group)elm.nextElement().source); + while (elm.hasNext()) { + v.add((Group)elm.next().source); } - return v.elements(); + return v.iterator(); } /** diff --git a/src/main/java/org/jogamp/java3d/GeneralizedStrip.java b/src/main/java/org/jogamp/java3d/GeneralizedStrip.java index 42e362d..f27ed88 100644 --- a/src/main/java/org/jogamp/java3d/GeneralizedStrip.java +++ b/src/main/java/org/jogamp/java3d/GeneralizedStrip.java @@ -39,6 +39,7 @@ package org.jogamp.java3d; * @see GeneralizedVertexList * @see GeometryDecompressor */ +@Deprecated class GeneralizedStrip { private static final boolean debug = false ; diff --git a/src/main/java/org/jogamp/java3d/GeneralizedStripFlags.java b/src/main/java/org/jogamp/java3d/GeneralizedStripFlags.java index 8422946..ab0e9f2 100644 --- a/src/main/java/org/jogamp/java3d/GeneralizedStripFlags.java +++ b/src/main/java/org/jogamp/java3d/GeneralizedStripFlags.java @@ -36,6 +36,7 @@ package org.jogamp.java3d; * @see GeneralizedStrip * @see GeneralizedVertexList */ +@Deprecated interface GeneralizedStripFlags { /** diff --git a/src/main/java/org/jogamp/java3d/GeneralizedVertexList.java b/src/main/java/org/jogamp/java3d/GeneralizedVertexList.java index c686fbe..d1a3030 100644 --- a/src/main/java/org/jogamp/java3d/GeneralizedVertexList.java +++ b/src/main/java/org/jogamp/java3d/GeneralizedVertexList.java @@ -43,6 +43,7 @@ import org.jogamp.vecmath.Vector3f; * @see GeneralizedStrip * @see GeometryDecompressor */ +@Deprecated class GeneralizedVertexList implements GeneralizedStripFlags { // The ArrayList containing the vertices. diff --git a/src/main/java/org/jogamp/java3d/GeometryDecompressor.java b/src/main/java/org/jogamp/java3d/GeometryDecompressor.java index 5725cfe..7d24de7 100644 --- a/src/main/java/org/jogamp/java3d/GeometryDecompressor.java +++ b/src/main/java/org/jogamp/java3d/GeometryDecompressor.java @@ -35,6 +35,7 @@ import org.jogamp.vecmath.Vector3f; * consisting of a generalized triangle strip, line strip, or point array, * along with possible global color and normal changes. */ +@Deprecated abstract class GeometryDecompressor { private static final boolean debug = false ; private static final boolean benchmark = false ; diff --git a/src/main/java/org/jogamp/java3d/GeometryDecompressorRetained.java b/src/main/java/org/jogamp/java3d/GeometryDecompressorRetained.java index 9c59399..a3dfc59 100644 --- a/src/main/java/org/jogamp/java3d/GeometryDecompressorRetained.java +++ b/src/main/java/org/jogamp/java3d/GeometryDecompressorRetained.java @@ -34,6 +34,7 @@ import org.jogamp.vecmath.Vector3f; * This class implements a retained geometry backend for the abstract * GeometryDecompressor. */ +@Deprecated class GeometryDecompressorRetained extends GeometryDecompressor { private static final boolean debug = false ; private static final boolean benchmark = false ; diff --git a/src/main/java/org/jogamp/java3d/GeometryDecompressorShape3D.java b/src/main/java/org/jogamp/java3d/GeometryDecompressorShape3D.java index e217456..1cab7d9 100644 --- a/src/main/java/org/jogamp/java3d/GeometryDecompressorShape3D.java +++ b/src/main/java/org/jogamp/java3d/GeometryDecompressorShape3D.java @@ -35,6 +35,7 @@ import org.jogamp.vecmath.Vector3f; * This class implements a Shape3D backend for the abstract * GeometryDecompressor. */ +@Deprecated class GeometryDecompressorShape3D extends GeometryDecompressor { private static final boolean debug = false ; private static final boolean benchmark = false ; diff --git a/src/main/java/org/jogamp/java3d/GraphicsContext3D.java b/src/main/java/org/jogamp/java3d/GraphicsContext3D.java index 36e8adb..2595d8c 100644 --- a/src/main/java/org/jogamp/java3d/GraphicsContext3D.java +++ b/src/main/java/org/jogamp/java3d/GraphicsContext3D.java @@ -28,7 +28,7 @@ package org.jogamp.java3d; import java.awt.Dimension; import java.awt.Point; -import java.util.Enumeration; +import java.util.Iterator; import java.util.Vector; import org.jogamp.vecmath.Color3f; @@ -963,11 +963,11 @@ public Light getLight(int index) { } /** - * Retrieves the enumeration object of all the lights. - * @return the enumeration object of all the lights + * Retrieves the iterator object of all the lights. + * @return the iterator object of all the lights */ -public Enumeration<Light> getAllLights() { - return uLights.elements(); +public Iterator<Light> getAllLights() { + return uLights.iterator(); } /** @@ -1329,11 +1329,11 @@ public Sound getSound(int index) { } /** - * Retrieves the enumeration object of all the sounds. - * @return the enumeration object of all the sounds + * Retrieves the iterator object of all the sounds. + * @return the iterator object of all the sounds */ -public Enumeration<Sound> getAllSounds() { - return uSounds.elements(); +public Iterator<Sound> getAllSounds() { + return uSounds.iterator(); } /** diff --git a/src/main/java/org/jogamp/java3d/Group.java b/src/main/java/org/jogamp/java3d/Group.java index e6cfc4b..f5fce2a 100644 --- a/src/main/java/org/jogamp/java3d/Group.java +++ b/src/main/java/org/jogamp/java3d/Group.java @@ -26,7 +26,7 @@ package org.jogamp.java3d; -import java.util.Enumeration; +import java.util.Iterator; import java.util.Hashtable; /** @@ -242,12 +242,12 @@ public class Group extends Node { } /** - * Returns an Enumeration object of this group node's list of children. - * @return an Enumeration object of all the children + * Returns an Iterator object of this group node's list of children. + * @return an Iterator object of all the children * @exception CapabilityNotSetException if the appropriate capability is * not set and this group node is part of live or compiled scene graph */ - public Enumeration<Node> getAllChildren() { + public Iterator<Node> getAllChildren() { if (isLiveOrCompiled() && !this.getCapability(ALLOW_CHILDREN_READ)) throw new CapabilityNotSetException(J3dI18N.getString("Group9")); diff --git a/src/main/java/org/jogamp/java3d/GroupRetained.java b/src/main/java/org/jogamp/java3d/GroupRetained.java index b49786f..8ecf6d8 100644 --- a/src/main/java/org/jogamp/java3d/GroupRetained.java +++ b/src/main/java/org/jogamp/java3d/GroupRetained.java @@ -27,7 +27,7 @@ package org.jogamp.java3d; import java.util.ArrayList; -import java.util.Enumeration; +import java.util.Iterator; import java.util.Vector; /** @@ -438,10 +438,10 @@ ArrayList<ArrayList<View>> viewLists = null; } /** - * Returns an enumeration object of the children. - * @return an enumeration object of the children + * Returns an iterator object of the children. + * @return an iterator object of the children */ - Enumeration<Node> getAllChildren() { + Iterator<Node> getAllChildren() { Vector<Node> userChildren = new Vector<Node>(children.size()); for (int i = 0; i < children.size(); i++) { @@ -452,7 +452,7 @@ ArrayList<ArrayList<View>> viewLists = null; userChildren.add(null); } - return userChildren.elements(); + return userChildren.iterator(); } void checkValidChild(Node child, String s) { diff --git a/src/main/java/org/jogamp/java3d/LOD.java b/src/main/java/org/jogamp/java3d/LOD.java index 25535d0..af97f7c 100644 --- a/src/main/java/org/jogamp/java3d/LOD.java +++ b/src/main/java/org/jogamp/java3d/LOD.java @@ -26,7 +26,7 @@ package org.jogamp.java3d; -import java.util.Enumeration; +import java.util.Iterator; import java.util.Vector; /** @@ -101,11 +101,11 @@ public Switch getSwitch(int index) { } /** - * Returns the enumeration object of all switches. - * @return the enumeration object of all switches + * Returns the iterator object of all switches. + * @return the iterator object of all switches */ - public Enumeration getAllSwitches() { - return switches.elements(); + public Iterator<Switch> getAllSwitches() { + return switches.iterator(); } /** diff --git a/src/main/java/org/jogamp/java3d/Light.java b/src/main/java/org/jogamp/java3d/Light.java index 8328618..05c643c 100644 --- a/src/main/java/org/jogamp/java3d/Light.java +++ b/src/main/java/org/jogamp/java3d/Light.java @@ -26,7 +26,7 @@ package org.jogamp.java3d; -import java.util.Enumeration; +import java.util.Iterator; import org.jogamp.vecmath.Color3f; @@ -137,7 +137,7 @@ import org.jogamp.vecmath.Color3f; * nodes, defined by a Group object. This is known as "scoping." * All nodes attached to a Group node define a <i>list of scopes</i>. * Methods in the Light class permit the setting, addition, insertion, - * removal, and enumeration of nodes in the list of scopes. + * removal, and iterator of nodes in the list of scopes. * <p> * <b>Two-sided Lighting of Polygons</b> * <p> @@ -437,13 +437,13 @@ public abstract class Light extends Leaf { /** - * Returns an enumeration of this Light node's list of scopes. - * @return an Enumeration object containing all nodes in this Light node's + * Returns an iterator of this Light node's list of scopes. + * @return an Iterator object containing all nodes in this Light node's * list of scopes. * @exception CapabilityNotSetException if appropriate capability is * not set and this object is part of live or compiled scene graph */ -public Enumeration<Group> getAllScopes() { +public Iterator<Group> getAllScopes() { if (isLiveOrCompiled()) if(!this.getCapability(ALLOW_SCOPE_READ)) throw new CapabilityNotSetException(J3dI18N.getString("Light8")); @@ -669,10 +669,10 @@ return ((LightRetained)this.retained).getAllScopes(); rt.initColor(c); rt.initInfluencingBounds(attr.getInfluencingBounds()); - Enumeration<Group> elm = attr.getAllScopes(); - while (elm.hasMoreElements()) { + Iterator<Group> elm = attr.getAllScopes(); + while (elm.hasNext()) { // this reference will set correctly in updateNodeReferences() callback - rt.initAddScope(elm.nextElement()); + rt.initAddScope(elm.next()); } // this reference will set correctly in updateNodeReferences() callback diff --git a/src/main/java/org/jogamp/java3d/LightRetained.java b/src/main/java/org/jogamp/java3d/LightRetained.java index 86b4ef4..8001f59 100644 --- a/src/main/java/org/jogamp/java3d/LightRetained.java +++ b/src/main/java/org/jogamp/java3d/LightRetained.java @@ -27,7 +27,7 @@ package org.jogamp.java3d; import java.util.ArrayList; -import java.util.Enumeration; +import java.util.Iterator; import java.util.Vector; import org.jogamp.vecmath.Color3f; @@ -343,16 +343,16 @@ ArrayList<LightRetained> newlyAddedMirrorLights = new ArrayList<LightRetained>() } /** - * Returns an enumeration object of the scope - * @return an enumeration object of the scope + * Returns an iterator object of the scope + * @return an iterator object of the scope */ -Enumeration<Group> getAllScopes() { - Enumeration<GroupRetained> elm = scopes.elements(); +Iterator<Group> getAllScopes() { + Iterator<GroupRetained> elm = scopes.iterator(); Vector<Group> v = new Vector<Group>(scopes.size()); - while (elm.hasMoreElements()) { - v.add((Group)elm.nextElement().source); + while (elm.hasNext()) { + v.add((Group)elm.next().source); } - return v.elements(); + return v.iterator(); } /** diff --git a/src/main/java/org/jogamp/java3d/Locale.java b/src/main/java/org/jogamp/java3d/Locale.java index b916dc5..5075413 100644 --- a/src/main/java/org/jogamp/java3d/Locale.java +++ b/src/main/java/org/jogamp/java3d/Locale.java @@ -27,7 +27,7 @@ package org.jogamp.java3d; import java.util.ArrayList; -import java.util.Enumeration; +import java.util.Iterator; import java.util.Vector; /** @@ -565,17 +565,17 @@ Vector<BranchGroup> branchGroups = new Vector<BranchGroup>(); } /** - * Gets an Enumeration object of all branch graphs in this Locale. - * @return an Enumeration object of all branch graphs. + * Gets an Iterator object of all branch graphs in this Locale. + * @return an Iterator object of all branch graphs. * @exception IllegalStateException if this Locale has been * removed from its VirtualUniverse. */ - public Enumeration getAllBranchGraphs(){ + public Iterator<BranchGroup> getAllBranchGraphs(){ if (universe == null) { throw new IllegalStateException(J3dI18N.getString("Locale4")); } - return branchGroups.elements(); + return branchGroups.iterator(); } diff --git a/src/main/java/org/jogamp/java3d/MasterControl.java b/src/main/java/org/jogamp/java3d/MasterControl.java index ffcce55..a7495cf 100644 --- a/src/main/java/org/jogamp/java3d/MasterControl.java +++ b/src/main/java/org/jogamp/java3d/MasterControl.java @@ -35,7 +35,7 @@ package org.jogamp.java3d; import java.awt.GraphicsConfiguration; import java.awt.GraphicsDevice; import java.util.ArrayList; -import java.util.Enumeration; +import java.util.Iterator; import java.util.Hashtable; import java.util.logging.Level; import java.util.logging.Logger; @@ -1917,8 +1917,8 @@ private static String getProperty(final String prop) { // remove all InputDeviceScheduler if this is the last View ArrayList<PhysicalEnvironment> list = new ArrayList<PhysicalEnvironment>(); - for (Enumeration<PhysicalEnvironment> e = PhysicalEnvironment.physicalEnvMap.keys(); e.hasMoreElements();) { - PhysicalEnvironment phyEnv = e.nextElement(); + for (Iterator<PhysicalEnvironment> e = PhysicalEnvironment.physicalEnvMap.keySet().iterator(); e.hasNext();) { + PhysicalEnvironment phyEnv = e.next(); InputDeviceScheduler sched = PhysicalEnvironment.physicalEnvMap.get(phyEnv); boolean phyEnvHasUser = false; for (int i = 0; i < phyEnv.users.size(); i++) { @@ -1952,9 +1952,9 @@ private static String getProperty(final String prop) { "MC: Destroy all Renderers"); } // remove all Renderers if this is the last View - for (Enumeration<Renderer> e = Screen3D.deviceRendererMap.elements(); - e.hasMoreElements(); ) { - Renderer rdr = e.nextElement(); + for (Iterator<Renderer> e = Screen3D.deviceRendererMap.values().iterator(); + e.hasNext(); ) { + Renderer rdr = e.next(); Screen3D scr; rendererCleanupArgs[2] = REMOVEALLCTXS_CLEANUP; @@ -1983,9 +1983,9 @@ private static String getProperty(final String prop) { } // cleanup ThreadData corresponds to the view in renderer - for (Enumeration<Renderer> e = Screen3D.deviceRendererMap.elements(); - e.hasMoreElements(); ) { - e.nextElement().cleanup(); + for (Iterator<Renderer> e = Screen3D.deviceRendererMap.values().iterator(); + e.hasNext(); ) { + e.next().cleanup(); } // We have to reuse renderer even though MC exit // see bug 4363279 @@ -1993,9 +1993,9 @@ private static String getProperty(final String prop) { } else { // cleanup ThreadData corresponds to the view in renderer - for (Enumeration<Renderer> e = Screen3D.deviceRendererMap.elements(); - e.hasMoreElements(); ) { - e.nextElement().cleanupView(); + for (Iterator<Renderer> e = Screen3D.deviceRendererMap.values().iterator(); + e.hasNext(); ) { + e.next().cleanupView(); } } @@ -2732,9 +2732,9 @@ private static String getProperty(final String prop) { thread = null; - for (Enumeration<Renderer> e = Screen3D.deviceRendererMap.elements(); - e.hasMoreElements(); ) { - Renderer rdr = e.nextElement(); + for (Iterator<Renderer> e = Screen3D.deviceRendererMap.values().iterator(); + e.hasNext(); ) { + Renderer rdr = e.next(); thread = rdr.getThreadData(null, null); requestRenderWorkThreads.add(thread); thread.threadOpts = J3dThreadData.CONT_THREAD; diff --git a/src/main/java/org/jogamp/java3d/MemoryFreeList.java b/src/main/java/org/jogamp/java3d/MemoryFreeList.java index 97706a9..5a40355 100644 --- a/src/main/java/org/jogamp/java3d/MemoryFreeList.java +++ b/src/main/java/org/jogamp/java3d/MemoryFreeList.java @@ -33,6 +33,7 @@ import java.util.Arrays; * Class for storing various free lists. This class must be * synchronized because different threads may try to access the lists. */ +@Deprecated class MemoryFreeList { // never go smaller than the initial capacity diff --git a/src/main/java/org/jogamp/java3d/ModelClip.java b/src/main/java/org/jogamp/java3d/ModelClip.java index e33c510..db99cfb 100644 --- a/src/main/java/org/jogamp/java3d/ModelClip.java +++ b/src/main/java/org/jogamp/java3d/ModelClip.java @@ -26,7 +26,7 @@ package org.jogamp.java3d; -import java.util.Enumeration; +import java.util.Iterator; import org.jogamp.vecmath.Vector4d; @@ -348,13 +348,13 @@ public class ModelClip extends Leaf { /** - * Returns an enumeration of this ModelClip node's list of scopes. - * @return an Enumeration object containing all nodes in this ModelClip node's + * Returns an iterator of this ModelClip node's list of scopes. + * @return an Iterator object containing all nodes in this ModelClip node's * list of scopes. * @exception CapabilityNotSetException if appropriate capability is * not set and this object is part of live or compiled scene graph */ -public Enumeration<Group> getAllScopes() { +public Iterator<Group> getAllScopes() { if (isLiveOrCompiled()) if (!this.getCapability(ALLOW_SCOPE_READ)) throw new CapabilityNotSetException( @@ -725,10 +725,10 @@ public Enumeration<Group> getAllScopes() { } rt.initInfluencingBounds(attr.getInfluencingBounds()); - Enumeration<Group> elm = attr.getAllScopes(); - while (elm.hasMoreElements()) { + Iterator<Group> elm = attr.getAllScopes(); + while (elm.hasNext()) { // this reference will set correctly in updateNodeReferences() callback - rt.initAddScope(elm.nextElement()); + rt.initAddScope(elm.next()); } // correct value will set in updateNodeReferences diff --git a/src/main/java/org/jogamp/java3d/ModelClipRetained.java b/src/main/java/org/jogamp/java3d/ModelClipRetained.java index cc76eb2..88b5be3 100644 --- a/src/main/java/org/jogamp/java3d/ModelClipRetained.java +++ b/src/main/java/org/jogamp/java3d/ModelClipRetained.java @@ -27,7 +27,7 @@ package org.jogamp.java3d; import java.util.ArrayList; -import java.util.Enumeration; +import java.util.Iterator; import java.util.Vector; import org.jogamp.vecmath.Vector4d; @@ -510,16 +510,16 @@ Vector<GroupRetained> scopes = new Vector<GroupRetained>(); } /** - * Returns an enumeration object of the scoperen. - * @return an enumeration object of the scoperen + * Returns an iterator object of the scoperen. + * @return an iterator object of the scoperen */ -Enumeration<Group> getAllScopes() { - Enumeration<GroupRetained> elm = scopes.elements(); +Iterator<Group> getAllScopes() { + Iterator<GroupRetained> elm = scopes.iterator(); Vector<Group> v = new Vector<Group>(scopes.size()); - while (elm.hasMoreElements()) { - v.add((Group)elm.nextElement().source); + while (elm.hasNext()) { + v.add((Group)elm.next().source); } - return v.elements(); + return v.iterator(); } /** diff --git a/src/main/java/org/jogamp/java3d/MorphRetained.java b/src/main/java/org/jogamp/java3d/MorphRetained.java index 0fca51a..5ce4b53 100644 --- a/src/main/java/org/jogamp/java3d/MorphRetained.java +++ b/src/main/java/org/jogamp/java3d/MorphRetained.java @@ -41,7 +41,7 @@ import org.jogamp.vecmath.Vector3f; /** * A morph leaf node consisting of geometery and appearance properties. */ - +@Deprecated class MorphRetained extends LeafRetained implements GeometryUpdater { // These bits should match the Shape3D bits ...(Since the mirrors for diff --git a/src/main/java/org/jogamp/java3d/Node.java b/src/main/java/org/jogamp/java3d/Node.java index ea0015d..24cf575 100644 --- a/src/main/java/org/jogamp/java3d/Node.java +++ b/src/main/java/org/jogamp/java3d/Node.java @@ -26,7 +26,7 @@ package org.jogamp.java3d; -import java.util.Enumeration; +import java.util.Iterator; import java.util.Hashtable; /** @@ -582,10 +582,10 @@ public abstract class Node extends SceneGraphObject { // go through hash table looking for Leaf nodes. // call updateNodeReferences for each. - Enumeration e = referenceTable.objectHashtable.elements(); + Iterator e = referenceTable.objectHashtable.values().iterator(); - while (e.hasMoreElements()) { - SceneGraphObject o = (SceneGraphObject) e.nextElement(); + while (e.hasNext()) { + SceneGraphObject o = (SceneGraphObject) e.next(); o.updateNodeReferences(referenceTable); } return n; diff --git a/src/main/java/org/jogamp/java3d/PhysicalEnvironment.java b/src/main/java/org/jogamp/java3d/PhysicalEnvironment.java index 2b76b02..caea512 100644 --- a/src/main/java/org/jogamp/java3d/PhysicalEnvironment.java +++ b/src/main/java/org/jogamp/java3d/PhysicalEnvironment.java @@ -27,7 +27,7 @@ package org.jogamp.java3d; import java.util.ArrayList; -import java.util.Enumeration; +import java.util.Iterator; import java.util.Hashtable; import java.util.Vector; @@ -237,8 +237,8 @@ synchronized void notifyUsers() { * Create an enumerator that produces all input devices. * @return an enumerator of all available devices */ -public Enumeration<InputDevice> getAllInputDevices() { - return devices.elements(); +public Iterator<InputDevice> getAllInputDevices() { + return devices.iterator(); } /** diff --git a/src/main/java/org/jogamp/java3d/Pipeline.java b/src/main/java/org/jogamp/java3d/Pipeline.java index 772b3f2..e13d0cb 100644 --- a/src/main/java/org/jogamp/java3d/Pipeline.java +++ b/src/main/java/org/jogamp/java3d/Pipeline.java @@ -156,7 +156,7 @@ public Pipeline run() { case JOGL: return "OpenGL"; case JOGL2ES2: - return "OpenGL"; + return "OpenGLES2"; case NOOP: return "None"; default: diff --git a/src/main/java/org/jogamp/java3d/Shape3D.java b/src/main/java/org/jogamp/java3d/Shape3D.java index 782daf4..c9c2fda 100644 --- a/src/main/java/org/jogamp/java3d/Shape3D.java +++ b/src/main/java/org/jogamp/java3d/Shape3D.java @@ -26,7 +26,7 @@ package org.jogamp.java3d; -import java.util.Enumeration; +import java.util.Iterator; /** @@ -367,16 +367,16 @@ public class Shape3D extends Leaf { /** - * Returns an enumeration of this Shape3D node's list of geometry + * Returns an iterator of this Shape3D node's list of geometry * components. - * @return an Enumeration object containing all geometry components in + * @return an iterator object containing all geometry components in * this Shape3D node's list of geometry components. * @exception CapabilityNotSetException if appropriate capability is * not set and this object is part of live or compiled scene graph * * @since Java 3D 1.2 */ - public Enumeration getAllGeometries() { + public Iterator<Geometry> getAllGeometries() { if (isLiveOrCompiled()) if (!this.getCapability(ALLOW_GEOMETRY_READ)) diff --git a/src/main/java/org/jogamp/java3d/Shape3DCompileRetained.java b/src/main/java/org/jogamp/java3d/Shape3DCompileRetained.java index 9c3d677..8c06a5b 100644 --- a/src/main/java/org/jogamp/java3d/Shape3DCompileRetained.java +++ b/src/main/java/org/jogamp/java3d/Shape3DCompileRetained.java @@ -27,7 +27,7 @@ package org.jogamp.java3d; import java.util.ArrayList; -import java.util.Enumeration; +import java.util.Iterator; import java.util.Vector; import org.jogamp.vecmath.Point3d; @@ -238,7 +238,7 @@ Geometry getGeometry(int i, int childIndex) { } @Override -Enumeration<Geometry> getAllGeometries(int childIndex) { +Iterator<Geometry> getAllGeometries(int childIndex) { ArrayList<Geometry> geoInfo = geometryInfo.get(childIndex); Vector<Geometry> geomList = new Vector<Geometry>(); @@ -246,7 +246,7 @@ Enumeration<Geometry> getAllGeometries(int childIndex) { geomList.add(geoInfo.get(i)); } - return geomList.elements(); + return geomList.iterator(); } Bounds getBounds(int childIndex) { diff --git a/src/main/java/org/jogamp/java3d/Shape3DRetained.java b/src/main/java/org/jogamp/java3d/Shape3DRetained.java index a8597b5..0954166 100644 --- a/src/main/java/org/jogamp/java3d/Shape3DRetained.java +++ b/src/main/java/org/jogamp/java3d/Shape3DRetained.java @@ -27,7 +27,7 @@ package org.jogamp.java3d; import java.util.ArrayList; -import java.util.Enumeration; +import java.util.Iterator; import java.util.LinkedHashSet; import java.util.Vector; @@ -468,14 +468,14 @@ Geometry getGeometry(int index, int id) { } /** - * Returns an enumeration of this Shape3D node's list of geometry + * Returns an iterator of this Shape3D node's list of geometry * components. - * @return an Enumeration object containing all geometry components in + * @return an Iterator object containing all geometry components in * this Shape3D node's list of geometry components. * * @since Java 3D 1.2 */ -Enumeration getAllGeometries(int id) { +Iterator<Geometry> getAllGeometries(int id) { Vector<Geometry> geomList = new Vector<Geometry>(geometryList.size()); for (int i = 0; i < geometryList.size(); i++) { @@ -486,7 +486,7 @@ Enumeration getAllGeometries(int id) { geomList.add(null); } - return geomList.elements(); + return geomList.iterator(); } /** diff --git a/src/main/java/org/jogamp/java3d/SharedGroupRetained.java b/src/main/java/org/jogamp/java3d/SharedGroupRetained.java index 3ecd714..1aac1e4 100644 --- a/src/main/java/org/jogamp/java3d/SharedGroupRetained.java +++ b/src/main/java/org/jogamp/java3d/SharedGroupRetained.java @@ -27,7 +27,7 @@ package org.jogamp.java3d; import java.util.ArrayList; -import java.util.Enumeration; +import java.util.Iterator; import java.util.Vector; /** @@ -918,9 +918,9 @@ public ArrayList<SwitchState> getTargetsData(int type, int index) { // Issue 514 : NPE in Wonderland : triggered in cached bounds computation validCachedBounds = false; synchronized(parents) { - Enumeration e = parents.elements(); - while(e.hasMoreElements()) { - LinkRetained parent = (LinkRetained) e.nextElement(); + Iterator e = parents.iterator(); + while(e.hasNext()) { + LinkRetained parent = (LinkRetained) e.next(); if (parent!=null) { parent.dirtyBoundsCache(); } diff --git a/src/main/java/org/jogamp/java3d/SoundScheduler.java b/src/main/java/org/jogamp/java3d/SoundScheduler.java index 5e0aff8..86429dd 100644 --- a/src/main/java/org/jogamp/java3d/SoundScheduler.java +++ b/src/main/java/org/jogamp/java3d/SoundScheduler.java @@ -32,7 +32,8 @@ import java.io.InputStream; import java.net.URL; import java.util.ArrayList; import java.util.Arrays; -import java.util.Enumeration; +import java.util.Iterator; +import java.util.LinkedHashSet; import org.jogamp.vecmath.Point2f; import org.jogamp.vecmath.Point3d; @@ -525,9 +526,10 @@ class SoundScheduler extends J3dStructure { } else if (node instanceof MediaContainerRetained) { int listSize = ((Integer)m.args[2]).intValue(); - ArrayList userList = (ArrayList)m.args[3]; - for (int i = 0; i < listSize; i++) { - SoundRetained sound = (SoundRetained)userList.get(i); + LinkedHashSet<SoundRetained> userList = (LinkedHashSet<SoundRetained>)m.args[3]; + for (SoundRetained sound : userList) { + //for (int i = 0; i < listSize; i++) { + //SoundRetained sound = userList.get(i); if (sound != null) { loadSound(sound, true); if (debugFlag) @@ -1048,15 +1050,15 @@ class SoundScheduler extends J3dStructure { nRetainedSounds++; } // XXXX: sync canvases - Enumeration<Canvas3D> canvases = view.getAllCanvas3Ds(); - while (canvases.hasMoreElements()) { - Canvas3D canvas = canvases.nextElement(); + Iterator<Canvas3D> canvases = view.getAllCanvas3Ds(); + while (canvases.hasNext()) { + Canvas3D canvas = canvases.next(); GraphicsContext3D graphicsContext = canvas.getGraphicsContext3D(); - Enumeration nonretainedSounds = graphicsContext.getAllSounds(); - while (nonretainedSounds.hasMoreElements()) { + Iterator<Sound> nonretainedSounds = graphicsContext.getAllSounds(); + while (nonretainedSounds.hasNext()) { if (debugFlag) debugPrint(" prioritizeSound , get non-retained sound"); - Sound sound = (Sound)nonretainedSounds.nextElement(); + Sound sound = (Sound)nonretainedSounds.next(); if (sound == null) { if (debugFlag) debugPrint(" prioritizeSound , sound element is null"); diff --git a/src/main/java/org/jogamp/java3d/SwitchValueInterpolator.java b/src/main/java/org/jogamp/java3d/SwitchValueInterpolator.java index df5c49c..07d1dc9 100644 --- a/src/main/java/org/jogamp/java3d/SwitchValueInterpolator.java +++ b/src/main/java/org/jogamp/java3d/SwitchValueInterpolator.java @@ -26,7 +26,7 @@ package org.jogamp.java3d; -import java.util.Enumeration; +import java.util.Iterator; /** * SwitchValueInterpolator behavior. This class defines a @@ -155,11 +155,11 @@ public class SwitchValueInterpolator extends Interpolator { * It maps the alpha value that corresponds to the current time * into a child index value and updates the specified Switch node * with this new child index value. - * @param criteria an enumeration of the criteria that triggered + * @param criteria an iterator of the criteria that triggered * this stimulus */ @Override - public void processStimulus(Enumeration criteria) { + public void processStimulus(Iterator<WakeupCriterion> criteria) { // Handle stimulus WakeupCriterion criterion = passiveWakeupCriterion; diff --git a/src/main/java/org/jogamp/java3d/TransformInterpolator.java b/src/main/java/org/jogamp/java3d/TransformInterpolator.java index 511fddd..07ff76a 100644 --- a/src/main/java/org/jogamp/java3d/TransformInterpolator.java +++ b/src/main/java/org/jogamp/java3d/TransformInterpolator.java @@ -26,7 +26,7 @@ package org.jogamp.java3d; -import java.util.Enumeration; +import java.util.Iterator; /** * TransformInterpolator is an abstract class that extends * Interpolator to provide common methods used by various transform @@ -155,11 +155,11 @@ public abstract class TransformInterpolator extends Interpolator { * First it gets the alpha value that corresponds to the current time. * Then it calls computeTransform() method to computes the transform based on this * alpha vaule, and updates the specified TransformGroup node with this new transform. - * @param criteria an enumeration of the criteria that caused the + * @param criteria an iterator of the criteria that caused the * stimulus */ @Override - public void processStimulus(Enumeration criteria) { + public void processStimulus(Iterator<WakeupCriterion> criteria) { // Handle stimulus WakeupCriterion criterion = passiveWakeupCriterion; diff --git a/src/main/java/org/jogamp/java3d/TransparencyInterpolator.java b/src/main/java/org/jogamp/java3d/TransparencyInterpolator.java index 752744e..53e8ac6 100644 --- a/src/main/java/org/jogamp/java3d/TransparencyInterpolator.java +++ b/src/main/java/org/jogamp/java3d/TransparencyInterpolator.java @@ -26,7 +26,7 @@ package org.jogamp.java3d; -import java.util.Enumeration; +import java.util.Iterator; /** * TransparencyInterpolator behavior. This class defines a behavior @@ -165,11 +165,11 @@ public class TransparencyInterpolator extends Interpolator { * maps the alpha value that corresponds to the current time into a * transparency value and updates the specified TransparencyAttributes * object with this new transparency value. - * @param criteria an enumeration of the criteria that caused the + * @param criteria an iterator of the criteria that caused the * stimulus */ @Override - public void processStimulus(Enumeration criteria) { + public void processStimulus(Iterator<WakeupCriterion> criteria) { // Handle stimulus WakeupCriterion criterion = passiveWakeupCriterion; diff --git a/src/main/java/org/jogamp/java3d/View.java b/src/main/java/org/jogamp/java3d/View.java index a3f4cdb..fe0d5d9 100644 --- a/src/main/java/org/jogamp/java3d/View.java +++ b/src/main/java/org/jogamp/java3d/View.java @@ -28,7 +28,6 @@ package org.jogamp.java3d; import java.awt.AWTEvent; import java.util.ArrayList; -import java.util.Enumeration; import java.util.Iterator; import java.util.LinkedList; import java.util.Vector; @@ -2162,11 +2161,11 @@ private ArrayList<ArrayList<Canvas3D>> canvasList = new ArrayList<ArrayList<Canv } /** - * Gets the enumeration object of all the Canvas3Ds. - * @return the enumeration object of all the Canvas3Ds. + * Gets the iterator object of all the Canvas3Ds. + * @return the iterator object of all the Canvas3Ds. */ - public Enumeration<Canvas3D> getAllCanvas3Ds(){ - return canvases.elements(); + public Iterator<Canvas3D> getAllCanvas3Ds(){ + return canvases.iterator(); } /** diff --git a/src/main/java/org/jogamp/java3d/ViewSpecificGroup.java b/src/main/java/org/jogamp/java3d/ViewSpecificGroup.java index 3a13341..8c23a62 100644 --- a/src/main/java/org/jogamp/java3d/ViewSpecificGroup.java +++ b/src/main/java/org/jogamp/java3d/ViewSpecificGroup.java @@ -26,7 +26,7 @@ package org.jogamp.java3d; -import java.util.Enumeration; +import java.util.Iterator; /** * The ViewSpecificGroup node is a Group whose descendants are @@ -185,14 +185,14 @@ public class ViewSpecificGroup extends Group { /** - * Returns an enumeration of this ViewSpecificGroup node's list + * Returns an iterator of this ViewSpecificGroup node's list * of views. * - * @return an Enumeration object containing all the views. + * @return an Iterator object containing all the views. * @exception CapabilityNotSetException if appropriate capability is * not set and this object is part of live or compiled scene graph */ -public Enumeration<View> getAllViews() { +public Iterator<View> getAllViews() { if (isLiveOrCompiled() && !this.getCapability(ALLOW_VIEW_READ)) throw new CapabilityNotSetException(J3dI18N.getString("ViewSpecificGroup2")); @@ -352,8 +352,8 @@ public Enumeration<View> getAllViews() { ViewSpecificGroupRetained attr = (ViewSpecificGroupRetained) originalNode.retained; ViewSpecificGroupRetained rt = (ViewSpecificGroupRetained) retained; - for (Enumeration<View> e = attr.getAllViews(); e.hasMoreElements(); ) { - rt.addView(e.nextElement()); + for (Iterator<View> e = attr.getAllViews(); e.hasNext(); ) { + rt.addView(e.next()); } } diff --git a/src/main/java/org/jogamp/java3d/ViewSpecificGroupRetained.java b/src/main/java/org/jogamp/java3d/ViewSpecificGroupRetained.java index 6cc4108..d301c15 100644 --- a/src/main/java/org/jogamp/java3d/ViewSpecificGroupRetained.java +++ b/src/main/java/org/jogamp/java3d/ViewSpecificGroupRetained.java @@ -27,7 +27,7 @@ package org.jogamp.java3d; import java.util.ArrayList; -import java.util.Enumeration; +import java.util.Iterator; import java.util.Vector; /** @@ -494,12 +494,12 @@ View getView(int index) { } } -Enumeration<View> getAllViews() { +Iterator<View> getAllViews() { Vector<View> viewList = new Vector<View>(apiViewList.size()); for (int i = 0; i < apiViewList.size(); i++) { viewList.add(apiViewList.get(i)); } - return viewList.elements(); + return viewList.iterator(); } int numViews() { diff --git a/src/main/java/org/jogamp/java3d/VirtualUniverse.java b/src/main/java/org/jogamp/java3d/VirtualUniverse.java index 4c68e60..4da4396 100644 --- a/src/main/java/org/jogamp/java3d/VirtualUniverse.java +++ b/src/main/java/org/jogamp/java3d/VirtualUniverse.java @@ -27,7 +27,7 @@ package org.jogamp.java3d; import java.util.ArrayList; -import java.util.Enumeration; +import java.util.Iterator; import java.util.HashSet; import java.util.Iterator; import java.util.Map; @@ -358,12 +358,12 @@ ArrayList<Integer> viewIdFreeList = new ArrayList<Integer>(); /** - * Returns the enumeration object of all locales in this virtual universe. + * Returns the iterator object of all locales in this virtual universe. * - * @return the enumeration object + * @return the iterator object */ -public Enumeration<Locale> getAllLocales() { - return this.listOfLocales.elements(); +public Iterator<Locale> getAllLocales() { + return this.listOfLocales.iterator(); } /** @@ -681,9 +681,9 @@ void disableFocusEvents() { for (int i = 0; i < vps.length; i++) { View[] views = vps[i].getViewList(); for (int j = views.length - 1; j >= 0; j--) { - Enumeration<Canvas3D> cvs = views[j].getAllCanvas3Ds(); - while (cvs.hasMoreElements()) { - Canvas3D cv = cvs.nextElement(); + Iterator<Canvas3D> cvs = views[j].getAllCanvas3Ds(); + while (cvs.hasNext()) { + Canvas3D cv = cvs.next(); // offscreen canvas does not have event catcher if (cv.eventCatcher != null) cv.eventCatcher.disableFocusEvents(); @@ -699,9 +699,9 @@ void enableFocusEvents() { for (int i = 0; i < vps.length; i++) { View[] views = vps[i].getViewList(); for (int j = views.length - 1; j >= 0; j--) { - Enumeration<Canvas3D> cvs = views[j].getAllCanvas3Ds(); - while (cvs.hasMoreElements()) { - Canvas3D cv = cvs.nextElement(); + Iterator<Canvas3D> cvs = views[j].getAllCanvas3Ds(); + while (cvs.hasNext()) { + Canvas3D cv = cvs.next(); // offscreen canvas does not have event catcher if (cv.eventCatcher != null) cv.eventCatcher.enableFocusEvents(); @@ -717,9 +717,9 @@ void disableKeyEvents() { for (int i = 0; i < vps.length; i++) { View[] views = vps[i].getViewList(); for (int j = views.length - 1; j >= 0; j--) { - Enumeration<Canvas3D> cvs = views[j].getAllCanvas3Ds(); - while (cvs.hasMoreElements()) { - Canvas3D cv = cvs.nextElement(); + Iterator<Canvas3D> cvs = views[j].getAllCanvas3Ds(); + while (cvs.hasNext()) { + Canvas3D cv = cvs.next(); // offscreen canvas does not have event catcher if (cv.eventCatcher != null) cv.eventCatcher.disableKeyEvents(); @@ -735,9 +735,9 @@ void enableKeyEvents() { for (int i = 0; i < vps.length; i++) { View[] views = vps[i].getViewList(); for (int j = views.length - 1; j >= 0; j--) { - Enumeration<Canvas3D> cvs = views[j].getAllCanvas3Ds(); - while (cvs.hasMoreElements()) { - Canvas3D cv = cvs.nextElement(); + Iterator<Canvas3D> cvs = views[j].getAllCanvas3Ds(); + while (cvs.hasNext()) { + Canvas3D cv = cvs.next(); // offscreen canvas does not have event catcher if (cv.eventCatcher != null) cv.eventCatcher.enableKeyEvents(); @@ -753,9 +753,9 @@ void disableMouseEvents() { for (int i = 0; i < vps.length; i++) { View[] views = vps[i].getViewList(); for (int j = views.length - 1; j >= 0; j--) { - Enumeration<Canvas3D> cvs = views[j].getAllCanvas3Ds(); - while (cvs.hasMoreElements()) { - Canvas3D cv = cvs.nextElement(); + Iterator<Canvas3D> cvs = views[j].getAllCanvas3Ds(); + while (cvs.hasNext()) { + Canvas3D cv = cvs.next(); // offscreen canvas does not have event catcher if (cv.eventCatcher != null) cv.eventCatcher.disableMouseEvents(); @@ -771,9 +771,9 @@ void enableMouseEvents() { for (int i = 0; i < vps.length; i++) { View[] views = vps[i].getViewList(); for (int j = views.length - 1; j >= 0; j--) { - Enumeration<Canvas3D> cvs = views[j].getAllCanvas3Ds(); - while (cvs.hasMoreElements()) { - Canvas3D cv = cvs.nextElement(); + Iterator<Canvas3D> cvs = views[j].getAllCanvas3Ds(); + while (cvs.hasNext()) { + Canvas3D cv = cvs.next(); // offscreen canvas does not have event catcher if (cv.eventCatcher != null) cv.eventCatcher.enableMouseEvents(); @@ -789,9 +789,9 @@ void disableMouseMotionEvents() { for (int i = 0; i < vps.length; i++) { View[] views = vps[i].getViewList(); for (int j = views.length - 1; j >= 0; j--) { - Enumeration<Canvas3D> cvs = views[j].getAllCanvas3Ds(); - while (cvs.hasMoreElements()) { - Canvas3D cv = cvs.nextElement(); + Iterator<Canvas3D> cvs = views[j].getAllCanvas3Ds(); + while (cvs.hasNext()) { + Canvas3D cv = cvs.next(); // offscreen canvas does not have event catcher if (cv.eventCatcher != null) cv.eventCatcher.disableMouseMotionEvents(); @@ -807,9 +807,9 @@ void enableMouseMotionEvents() { for (int i = 0; i < vps.length; i++) { View[] views = vps[i].getViewList(); for (int j = views.length - 1; j >= 0; j--) { - Enumeration<Canvas3D> cvs = views[j].getAllCanvas3Ds(); - while (cvs.hasMoreElements()) { - Canvas3D cv = cvs.nextElement(); + Iterator<Canvas3D> cvs = views[j].getAllCanvas3Ds(); + while (cvs.hasNext()) { + Canvas3D cv = cvs.next(); // offscreen canvas does not have event catcher if (cv.eventCatcher != null) cv.eventCatcher.enableMouseMotionEvents(); @@ -825,9 +825,9 @@ void disableMouseWheelEvents() { for (int i = 0; i < vps.length; i++) { View[] views = vps[i].getViewList(); for (int j = views.length - 1; j >= 0; j--) { - Enumeration<Canvas3D> cvs = views[j].getAllCanvas3Ds(); - while (cvs.hasMoreElements()) { - Canvas3D cv = cvs.nextElement(); + Iterator<Canvas3D> cvs = views[j].getAllCanvas3Ds(); + while (cvs.hasNext()) { + Canvas3D cv = cvs.next(); // offscreen canvas does not have event catcher if (cv.eventCatcher != null) cv.eventCatcher.disableMouseWheelEvents(); @@ -843,9 +843,9 @@ void enableMouseWheelEvents() { for (int i = 0; i < vps.length; i++) { View[] views = vps[i].getViewList(); for (int j = views.length - 1; j >= 0; j--) { - Enumeration<Canvas3D> cvs = views[j].getAllCanvas3Ds(); - while (cvs.hasMoreElements()) { - Canvas3D cv = cvs.nextElement(); + Iterator<Canvas3D> cvs = views[j].getAllCanvas3Ds(); + while (cvs.hasNext()) { + Canvas3D cv = cvs.next(); // offscreen canvas does not have event catcher if (cv.eventCatcher != null) cv.eventCatcher.enableMouseWheelEvents(); @@ -886,10 +886,10 @@ void enableMouseWheelEvents() { * attach to it. */ boolean isEmpty() { - Enumeration<Locale> elm = listOfLocales.elements(); + Iterator<Locale> elm = listOfLocales.iterator(); - while (elm.hasMoreElements()) { - Locale loc = elm.nextElement(); + while (elm.hasNext()) { + Locale loc = elm.next(); if (!loc.branchGroups.isEmpty()) { return false; } diff --git a/src/main/java/org/jogamp/java3d/WakeupCondition.java b/src/main/java/org/jogamp/java3d/WakeupCondition.java index b5fdcee..14b436b 100644 --- a/src/main/java/org/jogamp/java3d/WakeupCondition.java +++ b/src/main/java/org/jogamp/java3d/WakeupCondition.java @@ -26,14 +26,14 @@ package org.jogamp.java3d; -import java.util.Enumeration; +import java.util.Iterator; /** * An abstract class specifying a single wakeup Condition. This class * is extended by the WakeupCriterion, WakeupOr, WakeupAnd, * WakeupOrOfAnds, and WakeupAndOfOr classes. A Behavior node hands a * WakeupCondition object to the behavior scheduler and the behavior - * scheduler hands back an enumeration of that WakeupCondition. + * scheduler hands back an iterator of that WakeupCondition. */ public abstract class WakeupCondition extends Object { @@ -75,24 +75,32 @@ public abstract class WakeupCondition extends Object { int listIdx[][]; /** - * Returns an enumeration of all WakeupCriterias in this Condition. + * Returns an iterator of all WakeupCriterias in this Condition. */ - public Enumeration allElements() { - if (allEnum == null) { + public Iterator<WakeupCriterion> allElements() + { + if (allEnum == null) + { allEnum = new WakeupCriteriaEnumerator(this, ALL_ELEMENTS); - } else { + } + else + { allEnum.reset(this, ALL_ELEMENTS); } return allEnum; } /** - * Returns an enumeration of all triggered WakeupCriterias in this Condition. + * Returns an iterator of all triggered WakeupCriterias in this Condition. */ - public Enumeration triggeredElements() { - if (trigEnum == null) { + public Iterator<WakeupCriterion> triggeredElements() + { + if (trigEnum == null) + { trigEnum = new WakeupCriteriaEnumerator(this, TRIGGERED_ELEMENTS); - } else { + } + else + { trigEnum.reset(this, TRIGGERED_ELEMENTS); } return trigEnum; diff --git a/src/main/java/org/jogamp/java3d/WakeupCriteriaEnumerator.java b/src/main/java/org/jogamp/java3d/WakeupCriteriaEnumerator.java index e3133eb..e49a4e5 100644 --- a/src/main/java/org/jogamp/java3d/WakeupCriteriaEnumerator.java +++ b/src/main/java/org/jogamp/java3d/WakeupCriteriaEnumerator.java @@ -26,14 +26,14 @@ package org.jogamp.java3d; -import java.util.Enumeration; +import java.util.Iterator; import java.util.NoSuchElementException; /** * A class that enumerates all wakeup criteria in a wakeup condition */ -class WakeupCriteriaEnumerator implements Enumeration { +class WakeupCriteriaEnumerator implements Iterator<WakeupCriterion> { // An array used for the current criteria in this object WakeupCriterion[] criterion = null; @@ -131,19 +131,31 @@ class WakeupCriteriaEnumerator implements Enumeration { } @Override - public boolean hasMoreElements() { - if (currentIndex == length) { - return false; - } - return true; + public boolean hasNext() + { + if (currentIndex == length) + { + return false; + } + return true; } @Override - public Object nextElement() { - if (currentIndex < length) { - return criterion[currentIndex++]; - } else { - throw new NoSuchElementException(J3dI18N.getString("WakeupCriteriaEnumerator0")); - } + public WakeupCriterion next() + { + if (currentIndex < length) + { + return criterion[currentIndex++]; + } + else + { + throw new NoSuchElementException(J3dI18N.getString("WakeupCriteriaEnumerator0")); + } } + + @Override + public void remove() + { + throw new UnsupportedOperationException(); + } } |