diff options
author | phil <[email protected]> | 2016-12-07 18:51:34 +1300 |
---|---|---|
committer | phil <[email protected]> | 2016-12-07 18:51:34 +1300 |
commit | 3b5bbbc4d0aca4bd59492d64e813e18d6b766b8c (patch) | |
tree | ff0fd63d36053832d86bda21c621f98f44121a56 | |
parent | 91e086b3c0631198405cf6303f547bae34697c96 (diff) |
Enumeration swapped to typed Iterator
All Enumerations swapped and generic types added
25 files changed, 136 insertions, 133 deletions
diff --git a/src/main/java/org/jogamp/java3d/loaders/lw3d/J3dLwoParser.java b/src/main/java/org/jogamp/java3d/loaders/lw3d/J3dLwoParser.java index f8155aa..089981f 100644 --- a/src/main/java/org/jogamp/java3d/loaders/lw3d/J3dLwoParser.java +++ b/src/main/java/org/jogamp/java3d/loaders/lw3d/J3dLwoParser.java @@ -41,7 +41,7 @@ package org.jogamp.java3d.loaders.lw3d; import java.io.FileNotFoundException; import java.net.URL; -import java.util.Enumeration; +import java.util.Iterator; import java.util.Vector; import org.jogamp.java3d.Appearance; @@ -113,10 +113,10 @@ class J3dLwoParser extends LwoParser { GeometryArray object; LwoTexture texture; - for (Enumeration e = shapeList.elements(); - e.hasMoreElements() ;) { + for (Iterator e = shapeList.iterator(); + e.hasNext() ;) { int vertexFormat = org.jogamp.java3d.GeometryArray.COORDINATES; - ShapeHolder shape = (ShapeHolder)e.nextElement(); + ShapeHolder shape = (ShapeHolder)e.next(); debugOutputLn(LINE_TRACE, "about to create Arrays for Shape"); debugOutputLn(VALUES, "shape = " + shape); shape.createArrays(true); diff --git a/src/main/java/org/jogamp/java3d/loaders/lw3d/LightIntensityPathInterpolator.java b/src/main/java/org/jogamp/java3d/loaders/lw3d/LightIntensityPathInterpolator.java index 8848b53..8076168 100644 --- a/src/main/java/org/jogamp/java3d/loaders/lw3d/LightIntensityPathInterpolator.java +++ b/src/main/java/org/jogamp/java3d/loaders/lw3d/LightIntensityPathInterpolator.java @@ -39,9 +39,10 @@ package org.jogamp.java3d.loaders.lw3d; -import java.util.Enumeration; +import java.util.Iterator; import org.jogamp.java3d.Alpha; +import org.jogamp.java3d.WakeupCriterion; /** * This Interpolator object modifies the intensity of a Light object @@ -66,11 +67,11 @@ class LightIntensityPathInterpolator extends FloatValueInterpolator { * appropriate light intensity for that time as obtained by interpolating * between the light intensity values for each knot point that were passed * to this class. - * @param criteria enumeration of criteria that have triggered this wakeup + * @param criteria Iterator of criteria that have triggered this wakeup */ @Override - public void processStimulus(Enumeration criteria) { + public void processStimulus(Iterator<WakeupCriterion> criteria) { // Handle stimulus if (this.getAlpha() != null) { diff --git a/src/main/java/org/jogamp/java3d/loaders/lw3d/Lw3dLoader.java b/src/main/java/org/jogamp/java3d/loaders/lw3d/Lw3dLoader.java index 7930825..9dff593 100644 --- a/src/main/java/org/jogamp/java3d/loaders/lw3d/Lw3dLoader.java +++ b/src/main/java/org/jogamp/java3d/loaders/lw3d/Lw3dLoader.java @@ -49,7 +49,7 @@ import java.io.InputStreamReader; import java.io.Reader; import java.io.StreamTokenizer; import java.net.URL; -import java.util.Enumeration; +import java.util.Iterator; import java.util.Vector; import org.jogamp.java3d.AmbientLight; @@ -232,9 +232,9 @@ public class Lw3dLoader extends TextfileParser implements Loader { debugOutputLn(TIME, "done loading at " + System.currentTimeMillis()); LwsObject cloneObject = null; - for (Enumeration e = objectList.elements() ; - e.hasMoreElements() ;) { - LwsObject tmpObj = (LwsObject)e.nextElement(); + for (Iterator e = objectList.iterator() ; + e.hasNext() ;) { + LwsObject tmpObj = (LwsObject)e.next(); if (tmpObj.fileName != null && tmpObj.fileName.equals(filename)) { cloneObject = tmpObj; @@ -334,9 +334,9 @@ public class Lw3dLoader extends TextfileParser implements Loader { scene.setSceneGroup(sceneGroupNode); // now add named objects to the scenes name table - for (Enumeration e = objectList.elements(); e.hasMoreElements() ;) { + for (Iterator e = objectList.iterator(); e.hasNext() ;) { - LwsObject obj = (LwsObject)e.nextElement(); + LwsObject obj = (LwsObject)e.next(); if (obj.fileName != null) scene.addNamedObject(obj.fileName,(Object)obj.getObjectNode()); else if (obj.objName != null) @@ -419,9 +419,9 @@ public class Lw3dLoader extends TextfileParser implements Loader { */ void parentObjects() { debugOutputLn(TRACE, "parentObjects()"); - for (Enumeration e = objectList.elements(); e.hasMoreElements(); ) { + for (Iterator e = objectList.iterator(); e.hasNext(); ) { - LwsObject obj = (LwsObject)e.nextElement(); + LwsObject obj = (LwsObject)e.next(); if (obj.getParent() != -1) { LwsObject parent = (LwsObject) @@ -544,9 +544,9 @@ public class Lw3dLoader extends TextfileParser implements Loader { String indexString = bracketsString.substring(1, bracketEndIndex); indexNumber = (new Integer(indexString)).intValue(); } - for (Enumeration e = objectList.elements() ; - e.hasMoreElements() ;) { - LwsObject tempObj = (LwsObject)e.nextElement(); + for (Iterator e = objectList.iterator() ; + e.hasNext() ;) { + LwsObject tempObj = (LwsObject)e.next(); debugOutputLn(VALUES, "tempObj, file, objname = " + tempObj + tempObj.fileName + tempObj.objName); @@ -617,10 +617,10 @@ public class Lw3dLoader extends TextfileParser implements Loader { */ void addLights() { // Add lights to the scene - for (Enumeration e1 = lightList.elements(); e1.hasMoreElements(); ) { + for (Iterator e1 = lightList.iterator(); e1.hasNext(); ) { debugOutputLn(LINE_TRACE, "adding light to scene group"); - LwsLight light = (LwsLight)e1.nextElement(); + LwsLight light = (LwsLight)e1.next(); if (light.getObjectNode() != null) { // scope light to the lw3d scene @@ -700,9 +700,9 @@ public class Lw3dLoader extends TextfileParser implements Loader { */ void addBehaviors() { if (!sceneBehaviors.isEmpty()) { - Enumeration e = sceneBehaviors.elements(); - while (e.hasMoreElements()) { - scene.addBehaviorNode((Behavior)e.nextElement()); + Iterator e = sceneBehaviors.iterator(); + while (e.hasNext()) { + scene.addBehaviorNode((Behavior)e.next()); } } } diff --git a/src/main/java/org/jogamp/java3d/loaders/lw3d/LwoParser.java b/src/main/java/org/jogamp/java3d/loaders/lw3d/LwoParser.java index 4a4a551..38f3e8c 100644 --- a/src/main/java/org/jogamp/java3d/loaders/lw3d/LwoParser.java +++ b/src/main/java/org/jogamp/java3d/loaders/lw3d/LwoParser.java @@ -44,7 +44,7 @@ package org.jogamp.java3d.loaders.lw3d; import java.io.FileNotFoundException; import java.io.IOException; import java.net.URL; -import java.util.Enumeration; +import java.util.Iterator; import java.util.Vector; import org.jogamp.java3d.loaders.IncorrectFormatException; @@ -145,9 +145,9 @@ class LwoParser extends ParserObject { * surface and the same geometry type (point, line, or poly) */ ShapeHolder getAppropriateShape(int numSurf, int numVerts) { - for (Enumeration e = shapeList.elements(); - e.hasMoreElements() ;) { - ShapeHolder shape = (ShapeHolder)e.nextElement(); + for (Iterator e = shapeList.iterator(); + e.hasNext() ;) { + ShapeHolder shape = (ShapeHolder)e.next(); if (shape.numSurf == numSurf) if (shape.numVerts == numVerts || (shape.numVerts > 3 && diff --git a/src/main/java/org/jogamp/java3d/loaders/lw3d/LwsMotion.java b/src/main/java/org/jogamp/java3d/loaders/lw3d/LwsMotion.java index 2d3df74..4211f4e 100644 --- a/src/main/java/org/jogamp/java3d/loaders/lw3d/LwsMotion.java +++ b/src/main/java/org/jogamp/java3d/loaders/lw3d/LwsMotion.java @@ -40,7 +40,7 @@ package org.jogamp.java3d.loaders.lw3d; import java.io.StreamTokenizer; -import java.util.Enumeration; +import java.util.Iterator; import java.util.Vector; import org.jogamp.java3d.Alpha; @@ -266,10 +266,10 @@ class LwsMotion extends TextfileParser { // Recreate frames array from newFramesList LwsFrame newFrames[] = new LwsFrame[newFramesList.size()]; - Enumeration elements = newFramesList.elements(); + Iterator elements = newFramesList.iterator(); int index = 0; - while (elements.hasMoreElements()) { - newFrames[index++] = (LwsFrame)elements.nextElement(); + while (elements.hasNext()) { + newFrames[index++] = (LwsFrame)elements.next(); } frames = newFrames; numFrames = frames.length; diff --git a/src/main/java/org/jogamp/java3d/loaders/lw3d/LwsObject.java b/src/main/java/org/jogamp/java3d/loaders/lw3d/LwsObject.java index 7529bbc..9d75ec2 100644 --- a/src/main/java/org/jogamp/java3d/loaders/lw3d/LwsObject.java +++ b/src/main/java/org/jogamp/java3d/loaders/lw3d/LwsObject.java @@ -46,7 +46,7 @@ import java.io.IOException; import java.io.StreamTokenizer; import java.net.MalformedURLException; import java.net.URL; -import java.util.Enumeration; +import java.util.Iterator; import java.util.StringTokenizer; import java.util.Vector; @@ -495,12 +495,12 @@ class LwsObject extends TextfileParser implements LwsPrimitive { } if (objParser.getJava3dShapeList() != null) { shapeList = objParser.getJava3dShapeList(); - for (Enumeration e = shapeList.elements() ; - e.hasMoreElements() ;) { + for (Iterator e = shapeList.iterator() ; + e.hasNext() ;) { if (!hasPivot || pivotTransGroup == null) - objectTransform.addChild((Shape3D)e.nextElement()); + objectTransform.addChild((Shape3D)e.next()); else - pivotTransGroup.addChild((Shape3D)e.nextElement()); + pivotTransGroup.addChild((Shape3D)e.next()); } } } @@ -508,10 +508,10 @@ class LwsObject extends TextfileParser implements LwsPrimitive { // Already read that file: Clone original object debugOutputLn(LINE_TRACE, "Cloning shapes"); Vector cloneShapeList = cloneObject.getShapeList(); - for (Enumeration e = cloneShapeList.elements() ; - e.hasMoreElements() ;) { + for (Iterator e = cloneShapeList.iterator() ; + e.hasNext() ;) { debugOutputLn(LINE_TRACE, " shape clone"); - Shape3D shape = (Shape3D)e.nextElement(); + Shape3D shape = (Shape3D)e.next(); Shape3D cloneShape = (Shape3D)shape.cloneTree(); objectTransform.addChild(cloneShape); } diff --git a/src/main/java/org/jogamp/java3d/loaders/lw3d/SequenceLine.java b/src/main/java/org/jogamp/java3d/loaders/lw3d/SequenceLine.java index 5c475dd..5f0028c 100644 --- a/src/main/java/org/jogamp/java3d/loaders/lw3d/SequenceLine.java +++ b/src/main/java/org/jogamp/java3d/loaders/lw3d/SequenceLine.java @@ -43,7 +43,7 @@ import java.io.File; import java.io.FileNotFoundException; import java.io.IOException; import java.io.StreamTokenizer; -import java.util.Enumeration; +import java.util.Iterator; import java.util.Hashtable; import org.jogamp.java3d.Alpha; @@ -208,10 +208,10 @@ class SequenceLine { Link newLink = new Link(newSharedGroup); s.addChild(newLink); if (objParser.getJava3dShapeList() != null) { - for (Enumeration e = - objParser.getJava3dShapeList().elements() ; - e.hasMoreElements() ;) { - t.addChild((Shape3D)e.nextElement()); + for (Iterator e = + objParser.getJava3dShapeList().iterator() ; + e.hasNext() ;) { + t.addChild((Shape3D)e.next()); } } } @@ -245,9 +245,9 @@ class SequenceLine { objParser.createJava3dGeometry(); TransformGroup t = new TransformGroup(); if (objParser.getJava3dShapeList() != null) { - for (Enumeration e = objParser.getJava3dShapeList().elements() ; - e.hasMoreElements() ;) { - t.addChild((Shape3D)e.nextElement()); + for (Iterator e = objParser.getJava3dShapeList().iterator() ; + e.hasNext() ;) { + t.addChild((Shape3D)e.next()); } } SharedGroup newSharedGroup = new SharedGroup(); diff --git a/src/main/java/org/jogamp/java3d/loaders/lw3d/SequenceReader.java b/src/main/java/org/jogamp/java3d/loaders/lw3d/SequenceReader.java index c774918..913af95 100644 --- a/src/main/java/org/jogamp/java3d/loaders/lw3d/SequenceReader.java +++ b/src/main/java/org/jogamp/java3d/loaders/lw3d/SequenceReader.java @@ -44,7 +44,7 @@ import java.io.FileNotFoundException; import java.io.FileReader; import java.io.IOException; import java.io.StreamTokenizer; -import java.util.Enumeration; +import java.util.Iterator; import java.util.Vector; import org.jogamp.java3d.Alpha; @@ -113,13 +113,13 @@ class SequenceReader { objectTransform = new TransformGroup(); behaviorVector = new Vector(); - Enumeration e = sequenceLines.elements(); + Iterator e = sequenceLines.iterator(); Switch switchNode = new Switch(); switchNode.setCapability(Switch.ALLOW_SWITCH_READ); switchNode.setCapability(Switch.ALLOW_SWITCH_WRITE); objectTransform.addChild(switchNode); - while (e.hasMoreElements()) { - SequenceLine line = (SequenceLine)e.nextElement(); + while (e.hasNext()) { + SequenceLine line = (SequenceLine)e.next(); line.createJava3dObjects(debugVals, loadBehaviors); if (line.getGeometry() != null) switchNode.addChild(line.getGeometry()); @@ -158,9 +158,9 @@ class SequenceReader { } void printLines() { - Enumeration e = sequenceLines.elements(); - while (e.hasMoreElements()) { - SequenceLine line = (SequenceLine)e.nextElement(); + Iterator e = sequenceLines.iterator(); + while (e.hasNext()) { + SequenceLine line = (SequenceLine)e.next(); } } diff --git a/src/main/java/org/jogamp/java3d/loaders/lw3d/SwitchPathInterpolator.java b/src/main/java/org/jogamp/java3d/loaders/lw3d/SwitchPathInterpolator.java index 218ebbf..c08555c 100644 --- a/src/main/java/org/jogamp/java3d/loaders/lw3d/SwitchPathInterpolator.java +++ b/src/main/java/org/jogamp/java3d/loaders/lw3d/SwitchPathInterpolator.java @@ -40,11 +40,11 @@ package org.jogamp.java3d.loaders.lw3d; -import java.util.Enumeration; +import java.util.Iterator; import org.jogamp.java3d.Alpha; import org.jogamp.java3d.Switch; - +import org.jogamp.java3d.WakeupCriterion; import org.jogamp.java3d.internal.J3dUtilsI18N; /** @@ -87,11 +87,11 @@ class SwitchPathInterpolator extends FloatValueInterpolator { /** * This method sets the correct child for the Switch node according * to alpha - * @param criteria enumeration of criteria that have triggered this wakeup + * @param criteria Iterator of criteria that have triggered this wakeup */ @Override - public void processStimulus(Enumeration criteria) { + public void processStimulus(Iterator<WakeupCriterion> criteria) { int child; diff --git a/src/main/java/org/jogamp/java3d/utils/behaviors/keyboard/KeyNavigatorBehavior.java b/src/main/java/org/jogamp/java3d/utils/behaviors/keyboard/KeyNavigatorBehavior.java index 78ecb41..96e0ba7 100644 --- a/src/main/java/org/jogamp/java3d/utils/behaviors/keyboard/KeyNavigatorBehavior.java +++ b/src/main/java/org/jogamp/java3d/utils/behaviors/keyboard/KeyNavigatorBehavior.java @@ -43,7 +43,7 @@ import java.awt.AWTEvent; import java.awt.Component; import java.awt.event.KeyEvent; import java.awt.event.KeyListener; -import java.util.Enumeration; +import java.util.Iterator; import java.util.LinkedList; import org.jogamp.java3d.Behavior; @@ -95,14 +95,14 @@ public class KeyNavigatorBehavior extends Behavior implements KeyListener { * Override Behavior's stimulus method to handle the event. */ @Override - public void processStimulus(Enumeration criteria) { + public void processStimulus(Iterator<WakeupCriterion> criteria) { WakeupOnAWTEvent ev; WakeupCriterion genericEvt; AWTEvent[] events; boolean sawFrame = false; - while (criteria.hasMoreElements()) { - genericEvt = (WakeupCriterion) criteria.nextElement(); + while (criteria.hasNext()) { + genericEvt = criteria.next(); if (genericEvt instanceof WakeupOnAWTEvent) { ev = (WakeupOnAWTEvent) genericEvt; events = ev.getAWTEvent(); diff --git a/src/main/java/org/jogamp/java3d/utils/behaviors/mouse/MouseBehavior.java b/src/main/java/org/jogamp/java3d/utils/behaviors/mouse/MouseBehavior.java index cfc0c2c..f54b170 100644 --- a/src/main/java/org/jogamp/java3d/utils/behaviors/mouse/MouseBehavior.java +++ b/src/main/java/org/jogamp/java3d/utils/behaviors/mouse/MouseBehavior.java @@ -45,7 +45,7 @@ import java.awt.event.MouseListener; import java.awt.event.MouseMotionListener; import java.awt.event.MouseWheelEvent; import java.awt.event.MouseWheelListener; -import java.util.Enumeration; +import java.util.Iterator; import java.util.LinkedList; import org.jogamp.java3d.Behavior; @@ -55,7 +55,6 @@ import org.jogamp.java3d.WakeupCriterion; import org.jogamp.java3d.WakeupOnAWTEvent; import org.jogamp.java3d.WakeupOnBehaviorPost; import org.jogamp.java3d.WakeupOr; - import org.jogamp.java3d.internal.J3dUtilsI18N; @@ -265,7 +264,7 @@ public abstract class MouseBehavior extends Behavior * All mouse manipulators must implement this. */ @Override - public abstract void processStimulus (Enumeration criteria); + public abstract void processStimulus (Iterator<WakeupCriterion> criteria); /** * Adds this behavior as a MouseListener, mouseWheelListener and MouseMotionListener to diff --git a/src/main/java/org/jogamp/java3d/utils/behaviors/mouse/MouseRotate.java b/src/main/java/org/jogamp/java3d/utils/behaviors/mouse/MouseRotate.java index 65f0c09..607e346 100644 --- a/src/main/java/org/jogamp/java3d/utils/behaviors/mouse/MouseRotate.java +++ b/src/main/java/org/jogamp/java3d/utils/behaviors/mouse/MouseRotate.java @@ -42,7 +42,7 @@ package org.jogamp.java3d.utils.behaviors.mouse; import java.awt.AWTEvent; import java.awt.Component; import java.awt.event.MouseEvent; -import java.util.Enumeration; +import java.util.Iterator; import org.jogamp.java3d.Transform3D; import org.jogamp.java3d.TransformGroup; @@ -193,15 +193,15 @@ public class MouseRotate extends MouseBehavior { } @Override - public void processStimulus (Enumeration criteria) { + public void processStimulus (Iterator<WakeupCriterion> criteria) { WakeupCriterion wakeup; AWTEvent[] events; MouseEvent evt; // int id; // int dx, dy; - while (criteria.hasMoreElements()) { - wakeup = (WakeupCriterion) criteria.nextElement(); + while (criteria.hasNext()) { + wakeup = criteria.next(); if (wakeup instanceof WakeupOnAWTEvent) { events = ((WakeupOnAWTEvent)wakeup).getAWTEvent(); if (events.length > 0) { diff --git a/src/main/java/org/jogamp/java3d/utils/behaviors/mouse/MouseTranslate.java b/src/main/java/org/jogamp/java3d/utils/behaviors/mouse/MouseTranslate.java index 44bd43b..03b717a 100644 --- a/src/main/java/org/jogamp/java3d/utils/behaviors/mouse/MouseTranslate.java +++ b/src/main/java/org/jogamp/java3d/utils/behaviors/mouse/MouseTranslate.java @@ -42,7 +42,7 @@ package org.jogamp.java3d.utils.behaviors.mouse; import java.awt.AWTEvent; import java.awt.Component; import java.awt.event.MouseEvent; -import java.util.Enumeration; +import java.util.Iterator; import org.jogamp.java3d.Transform3D; import org.jogamp.java3d.TransformGroup; @@ -178,15 +178,15 @@ public class MouseTranslate extends MouseBehavior { } @Override - public void processStimulus (Enumeration criteria) { + public void processStimulus (Iterator<WakeupCriterion> criteria) { WakeupCriterion wakeup; AWTEvent[] events; MouseEvent evt; // int id; // int dx, dy; - while (criteria.hasMoreElements()) { - wakeup = (WakeupCriterion) criteria.nextElement(); + while (criteria.hasNext()) { + wakeup = criteria.next(); if (wakeup instanceof WakeupOnAWTEvent) { events = ((WakeupOnAWTEvent)wakeup).getAWTEvent(); diff --git a/src/main/java/org/jogamp/java3d/utils/behaviors/mouse/MouseWheelZoom.java b/src/main/java/org/jogamp/java3d/utils/behaviors/mouse/MouseWheelZoom.java index 3e18bec..f1afdf7 100644 --- a/src/main/java/org/jogamp/java3d/utils/behaviors/mouse/MouseWheelZoom.java +++ b/src/main/java/org/jogamp/java3d/utils/behaviors/mouse/MouseWheelZoom.java @@ -43,7 +43,7 @@ import java.awt.AWTEvent; import java.awt.Component; import java.awt.event.MouseEvent; import java.awt.event.MouseWheelEvent; -import java.util.Enumeration; +import java.util.Iterator; import org.jogamp.java3d.Transform3D; import org.jogamp.java3d.TransformGroup; @@ -162,13 +162,13 @@ public class MouseWheelZoom extends MouseBehavior { @Override - public void processStimulus(Enumeration criteria) { + public void processStimulus(Iterator<WakeupCriterion> criteria) { WakeupCriterion wakeup; AWTEvent[] events; MouseEvent evt; - while (criteria.hasMoreElements()) { - wakeup = (WakeupCriterion) criteria.nextElement(); + while (criteria.hasNext()) { + wakeup = criteria.next(); if (wakeup instanceof WakeupOnAWTEvent) { events = ((WakeupOnAWTEvent)wakeup).getAWTEvent(); if (events.length > 0) { diff --git a/src/main/java/org/jogamp/java3d/utils/behaviors/mouse/MouseZoom.java b/src/main/java/org/jogamp/java3d/utils/behaviors/mouse/MouseZoom.java index 0e724e3..0f156bd 100644 --- a/src/main/java/org/jogamp/java3d/utils/behaviors/mouse/MouseZoom.java +++ b/src/main/java/org/jogamp/java3d/utils/behaviors/mouse/MouseZoom.java @@ -42,7 +42,7 @@ package org.jogamp.java3d.utils.behaviors.mouse; import java.awt.AWTEvent; import java.awt.Component; import java.awt.event.MouseEvent; -import java.util.Enumeration; +import java.util.Iterator; import org.jogamp.java3d.Transform3D; import org.jogamp.java3d.TransformGroup; @@ -161,15 +161,15 @@ public class MouseZoom extends MouseBehavior { @Override - public void processStimulus (Enumeration criteria) { + public void processStimulus (Iterator<WakeupCriterion> criteria) { WakeupCriterion wakeup; AWTEvent[] events; MouseEvent evt; // int id; // int dx, dy; - while (criteria.hasMoreElements()) { - wakeup = (WakeupCriterion) criteria.nextElement(); + while (criteria.hasNext()) { + wakeup = criteria.next(); if (wakeup instanceof WakeupOnAWTEvent) { events = ((WakeupOnAWTEvent)wakeup).getAWTEvent(); if (events.length > 0) { diff --git a/src/main/java/org/jogamp/java3d/utils/behaviors/picking/PickMouseBehavior.java b/src/main/java/org/jogamp/java3d/utils/behaviors/picking/PickMouseBehavior.java index b072ffa..c39ecf8 100644 --- a/src/main/java/org/jogamp/java3d/utils/behaviors/picking/PickMouseBehavior.java +++ b/src/main/java/org/jogamp/java3d/utils/behaviors/picking/PickMouseBehavior.java @@ -42,7 +42,7 @@ package org.jogamp.java3d.utils.behaviors.picking; import java.awt.AWTEvent; import java.awt.Event; import java.awt.event.MouseEvent; -import java.util.Enumeration; +import java.util.Iterator; import org.jogamp.java3d.Behavior; import org.jogamp.java3d.Bounds; @@ -120,13 +120,13 @@ public abstract class PickMouseBehavior extends Behavior { } @Override - public void processStimulus (Enumeration criteria) { + public void processStimulus (Iterator<WakeupCriterion> criteria) { WakeupCriterion wakeup; AWTEvent[] evt = null; int xpos = 0, ypos = 0; - while(criteria.hasMoreElements()) { - wakeup = (WakeupCriterion)criteria.nextElement(); + while(criteria.hasNext()) { + wakeup = criteria.next(); if (wakeup instanceof WakeupOnAWTEvent) evt = ((WakeupOnAWTEvent)wakeup).getAWTEvent(); } diff --git a/src/main/java/org/jogamp/java3d/utils/behaviors/sensor/Mouse6DPointerBehavior.java b/src/main/java/org/jogamp/java3d/utils/behaviors/sensor/Mouse6DPointerBehavior.java index 1ffea4f..c5250f9 100644 --- a/src/main/java/org/jogamp/java3d/utils/behaviors/sensor/Mouse6DPointerBehavior.java +++ b/src/main/java/org/jogamp/java3d/utils/behaviors/sensor/Mouse6DPointerBehavior.java @@ -39,7 +39,7 @@ package org.jogamp.java3d.utils.behaviors.sensor ; -import java.util.Enumeration; +import java.util.Iterator; import org.jogamp.java3d.Behavior; import org.jogamp.java3d.Sensor; @@ -47,6 +47,7 @@ import org.jogamp.java3d.Shape3D; import org.jogamp.java3d.Transform3D; import org.jogamp.java3d.TransformGroup; import org.jogamp.java3d.WakeupCondition; +import org.jogamp.java3d.WakeupCriterion; import org.jogamp.java3d.WakeupOnElapsedFrames; import org.jogamp.vecmath.Point3d; import org.jogamp.vecmath.Vector3f; @@ -168,7 +169,7 @@ public class Mouse6DPointerBehavior extends Behavior { * Java 3D behavior scheduler. */ @Override - public void processStimulus(Enumeration criteria) { + public void processStimulus(Iterator<WakeupCriterion> criteria) { eventAgent.dispatchEvents() ; wakeupOn(conditions) ; } diff --git a/src/main/java/org/jogamp/java3d/utils/behaviors/vp/ViewPlatformAWTBehavior.java b/src/main/java/org/jogamp/java3d/utils/behaviors/vp/ViewPlatformAWTBehavior.java index f0c84a1..65c1ffe 100644 --- a/src/main/java/org/jogamp/java3d/utils/behaviors/vp/ViewPlatformAWTBehavior.java +++ b/src/main/java/org/jogamp/java3d/utils/behaviors/vp/ViewPlatformAWTBehavior.java @@ -46,13 +46,14 @@ import java.awt.event.MouseListener; import java.awt.event.MouseMotionListener; import java.awt.event.MouseWheelListener; import java.util.ArrayList; +import java.util.Iterator; import org.jogamp.java3d.Canvas3D; import org.jogamp.java3d.Transform3D; import org.jogamp.java3d.WakeupCondition; +import org.jogamp.java3d.WakeupCriterion; import org.jogamp.java3d.WakeupOnBehaviorPost; import org.jogamp.java3d.WakeupOnElapsedFrames; - import org.jogamp.java3d.utils.universe.Viewer; import org.jogamp.java3d.utils.universe.ViewingPlatform; @@ -199,11 +200,11 @@ implements MouseListener, MouseMotionListener, KeyListener, MouseWheelListener { * Java 3D behavior scheduler. */ @Override - public void processStimulus( java.util.Enumeration behEnum ) { + public void processStimulus( Iterator<WakeupCriterion> behEnum ) { boolean hadPost = false; - while(behEnum.hasMoreElements()) { - WakeupCondition wakeup = (WakeupCondition)behEnum.nextElement(); + while(behEnum.hasNext()) { + WakeupCondition wakeup = behEnum.next(); if (wakeup instanceof WakeupOnBehaviorPost) { hadPost = true; } else if (wakeup instanceof WakeupOnElapsedFrames) { diff --git a/src/main/java/org/jogamp/java3d/utils/behaviors/vp/WandViewBehavior.java b/src/main/java/org/jogamp/java3d/utils/behaviors/vp/WandViewBehavior.java index 3dfe7ce..09e3067 100644 --- a/src/main/java/org/jogamp/java3d/utils/behaviors/vp/WandViewBehavior.java +++ b/src/main/java/org/jogamp/java3d/utils/behaviors/vp/WandViewBehavior.java @@ -40,7 +40,7 @@ package org.jogamp.java3d.utils.behaviors.vp ; import java.util.ArrayList; -import java.util.Enumeration; +import java.util.Iterator; import java.util.Map; import org.jogamp.java3d.Appearance; @@ -56,14 +56,8 @@ import org.jogamp.java3d.TransformGroup; import org.jogamp.java3d.TransparencyAttributes; import org.jogamp.java3d.View; import org.jogamp.java3d.WakeupCondition; +import org.jogamp.java3d.WakeupCriterion; import org.jogamp.java3d.WakeupOnElapsedFrames; -import org.jogamp.vecmath.AxisAngle4d; -import org.jogamp.vecmath.Color3f; -import org.jogamp.vecmath.Matrix3d; -import org.jogamp.vecmath.Matrix4d; -import org.jogamp.vecmath.Point3d; -import org.jogamp.vecmath.Vector3d; - import org.jogamp.java3d.utils.behaviors.sensor.SensorBeamEcho; import org.jogamp.java3d.utils.behaviors.sensor.SensorButtonListener; import org.jogamp.java3d.utils.behaviors.sensor.SensorEvent; @@ -75,6 +69,12 @@ import org.jogamp.java3d.utils.universe.ConfiguredUniverse; import org.jogamp.java3d.utils.universe.SimpleUniverse; import org.jogamp.java3d.utils.universe.Viewer; import org.jogamp.java3d.utils.universe.ViewingPlatform; +import org.jogamp.vecmath.AxisAngle4d; +import org.jogamp.vecmath.Color3f; +import org.jogamp.vecmath.Matrix3d; +import org.jogamp.vecmath.Matrix4d; +import org.jogamp.vecmath.Point3d; +import org.jogamp.vecmath.Vector3d; /** * Manipulates view platform transforms using a motion-tracked wand or mouse @@ -618,7 +618,7 @@ public class WandViewBehavior extends ViewPlatformBehavior { * the Java 3D behavior scheduler. */ @Override - public void processStimulus(Enumeration criteria) { + public void processStimulus(Iterator<WakeupCriterion> criteria) { // Invoke the sensor event dispatcher. eventAgent.dispatchEvents() ; diff --git a/src/main/java/org/jogamp/java3d/utils/geometry/compression/CompressedGeometryRetained.java b/src/main/java/org/jogamp/java3d/utils/geometry/compression/CompressedGeometryRetained.java index bda1df5..55441c4 100644 --- a/src/main/java/org/jogamp/java3d/utils/geometry/compression/CompressedGeometryRetained.java +++ b/src/main/java/org/jogamp/java3d/utils/geometry/compression/CompressedGeometryRetained.java @@ -71,7 +71,7 @@ class CompressedGeometryRetained extends Object { 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. + // enums 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/utils/pickfast/behaviors/PickMouseBehavior.java b/src/main/java/org/jogamp/java3d/utils/pickfast/behaviors/PickMouseBehavior.java index 3b1862f..c072794 100644 --- a/src/main/java/org/jogamp/java3d/utils/pickfast/behaviors/PickMouseBehavior.java +++ b/src/main/java/org/jogamp/java3d/utils/pickfast/behaviors/PickMouseBehavior.java @@ -42,7 +42,7 @@ package org.jogamp.java3d.utils.pickfast.behaviors; import java.awt.AWTEvent; import java.awt.Event; import java.awt.event.MouseEvent; -import java.util.Enumeration; +import java.util.Iterator; import org.jogamp.java3d.Behavior; import org.jogamp.java3d.Bounds; @@ -52,7 +52,6 @@ import org.jogamp.java3d.TransformGroup; import org.jogamp.java3d.WakeupCriterion; import org.jogamp.java3d.WakeupOnAWTEvent; import org.jogamp.java3d.WakeupOr; - import org.jogamp.java3d.utils.pickfast.PickCanvas; import org.jogamp.java3d.utils.pickfast.PickTool; @@ -146,13 +145,13 @@ public abstract class PickMouseBehavior extends Behavior { } @Override - public void processStimulus (Enumeration criteria) { + public void processStimulus (Iterator<WakeupCriterion> criteria) { WakeupCriterion wakeup; AWTEvent[] evt = null; int xpos = 0, ypos = 0; - while(criteria.hasMoreElements()) { - wakeup = (WakeupCriterion)criteria.nextElement(); + while(criteria.hasNext()) { + wakeup = criteria.next(); if (wakeup instanceof WakeupOnAWTEvent) evt = ((WakeupOnAWTEvent)wakeup).getAWTEvent(); } diff --git a/src/main/java/org/jogamp/java3d/utils/picking/behaviors/PickMouseBehavior.java b/src/main/java/org/jogamp/java3d/utils/picking/behaviors/PickMouseBehavior.java index ce41f53..7ab1e2c 100644 --- a/src/main/java/org/jogamp/java3d/utils/picking/behaviors/PickMouseBehavior.java +++ b/src/main/java/org/jogamp/java3d/utils/picking/behaviors/PickMouseBehavior.java @@ -42,7 +42,7 @@ package org.jogamp.java3d.utils.picking.behaviors; import java.awt.AWTEvent; import java.awt.Event; import java.awt.event.MouseEvent; -import java.util.Enumeration; +import java.util.Iterator; import org.jogamp.java3d.Behavior; import org.jogamp.java3d.Bounds; @@ -52,7 +52,6 @@ import org.jogamp.java3d.TransformGroup; import org.jogamp.java3d.WakeupCriterion; import org.jogamp.java3d.WakeupOnAWTEvent; import org.jogamp.java3d.WakeupOr; - import org.jogamp.java3d.utils.picking.PickCanvas; import org.jogamp.java3d.utils.picking.PickTool; @@ -146,13 +145,13 @@ public abstract class PickMouseBehavior extends Behavior { } @Override - public void processStimulus (Enumeration criteria) { + public void processStimulus (Iterator<WakeupCriterion> criteria) { WakeupCriterion wakeup; AWTEvent[] evt = null; int xpos = 0, ypos = 0; - while(criteria.hasMoreElements()) { - wakeup = (WakeupCriterion)criteria.nextElement(); + while(criteria.hasNext()) { + wakeup = criteria.next(); if (wakeup instanceof WakeupOnAWTEvent) evt = ((WakeupOnAWTEvent)wakeup).getAWTEvent(); } diff --git a/src/main/java/org/jogamp/java3d/utils/scenegraph/io/UnresolvedBehavior.java b/src/main/java/org/jogamp/java3d/utils/scenegraph/io/UnresolvedBehavior.java index 78f8f82..cadd212 100644 --- a/src/main/java/org/jogamp/java3d/utils/scenegraph/io/UnresolvedBehavior.java +++ b/src/main/java/org/jogamp/java3d/utils/scenegraph/io/UnresolvedBehavior.java @@ -39,15 +39,20 @@ package org.jogamp.java3d.utils.scenegraph.io; +import java.util.Iterator; + +import org.jogamp.java3d.Behavior; +import org.jogamp.java3d.WakeupCriterion; + /** * This Behavior is used in place of any behaviors which can not * be instantiated when a scene graph is read. This behavior is - * always disabled when it initalizes. It just provides an indicator + * always disabled when it initializes. It just provides an indicator * in the scene graph that a Behavior is missing. * * This normally means the Behavior is not present in the classpath. */ -public class UnresolvedBehavior extends org.jogamp.java3d.Behavior { +public class UnresolvedBehavior extends Behavior { @Override public void initialize() { @@ -55,7 +60,7 @@ public class UnresolvedBehavior extends org.jogamp.java3d.Behavior { } @Override - public void processStimulus(java.util.Enumeration enumeration) { + public void processStimulus(Iterator<WakeupCriterion> criteria) { } } diff --git a/src/main/java/org/jogamp/java3d/utils/scenegraph/io/state/org/jogamp/java3d/utils/universe/SimpleUniverseState.java b/src/main/java/org/jogamp/java3d/utils/scenegraph/io/state/org/jogamp/java3d/utils/universe/SimpleUniverseState.java index 5307dfd..f2dc255 100644 --- a/src/main/java/org/jogamp/java3d/utils/scenegraph/io/state/org/jogamp/java3d/utils/universe/SimpleUniverseState.java +++ b/src/main/java/org/jogamp/java3d/utils/scenegraph/io/state/org/jogamp/java3d/utils/universe/SimpleUniverseState.java @@ -43,7 +43,7 @@ import java.io.DataInput; import java.io.DataOutput; import java.io.IOException; import java.util.ArrayList; -import java.util.Enumeration; +import java.util.Iterator; import org.jogamp.java3d.BranchGroup; import org.jogamp.java3d.Canvas3D; @@ -51,8 +51,6 @@ import org.jogamp.java3d.HiResCoord; import org.jogamp.java3d.Locale; import org.jogamp.java3d.Transform3D; import org.jogamp.java3d.TransformGroup; -import org.jogamp.vecmath.Matrix4d; - import org.jogamp.java3d.utils.scenegraph.io.retained.Controller; import org.jogamp.java3d.utils.scenegraph.io.retained.SymbolTableData; import org.jogamp.java3d.utils.scenegraph.io.state.org.jogamp.java3d.SceneGraphObjectState; @@ -62,6 +60,7 @@ import org.jogamp.java3d.utils.universe.PlatformGeometry; import org.jogamp.java3d.utils.universe.SimpleUniverse; import org.jogamp.java3d.utils.universe.ViewerAvatar; import org.jogamp.java3d.utils.universe.ViewingPlatform; +import org.jogamp.vecmath.Matrix4d; public class SimpleUniverseState extends java.lang.Object { @@ -152,13 +151,13 @@ public class SimpleUniverseState extends java.lang.Object { private void writeLocales( DataOutput out ) throws IOException { - Enumeration<Locale> allLocales = universe.getAllLocales(); + Iterator<Locale> allLocales = universe.getAllLocales(); out.writeInt( universe.numLocales() ); localeBGs = new ArrayList( universe.numLocales() ); int currentLocale = 0; int graphID = 0; - while( allLocales.hasMoreElements() ) { - Locale locale = allLocales.nextElement(); + while( allLocales.hasNext() ) { + Locale locale = allLocales.next(); HiResCoord hiRes = new HiResCoord(); writeHiResCoord( out, hiRes ); int bgs[]; @@ -168,9 +167,9 @@ public class SimpleUniverseState extends java.lang.Object { bgs = new int[locale.numBranchGraphs()]; out.writeInt( bgs.length ); int count=0; - Enumeration e = locale.getAllBranchGraphs(); - while( e.hasMoreElements() ) { - BranchGroup bg = (BranchGroup)e.nextElement(); + Iterator<BranchGroup> e = locale.getAllBranchGraphs(); + while( e.hasNext() ) { + BranchGroup bg = e.next(); if (!(bg instanceof ViewingPlatform)) { control.getSymbolTable().addBranchGraphReference( bg, graphID ); bgs[count] = graphID++; @@ -213,9 +212,9 @@ public class SimpleUniverseState extends java.lang.Object { */ public void buildGraph() { Locale locale; - Enumeration<Locale> e = universe.getAllLocales(); + Iterator<Locale> e = universe.getAllLocales(); for( int i=0; i<localeBGs.size(); i++) { - locale = e.nextElement(); + locale = e.next(); int[] bgs = (int[])localeBGs.get(i); for(int j=0; j<bgs.length; j++) { SymbolTableData symbol = control.getSymbolTable().getBranchGraphRoot( bgs[j] ); @@ -277,11 +276,11 @@ public class SimpleUniverseState extends java.lang.Object { * Reattach each BranchGraph to the Locale(s) */ public void attachAllGraphs() { - Enumeration<Locale> e = universe.getAllLocales(); + Iterator<Locale> e = universe.getAllLocales(); Locale locale; for( int i=0; i<localeBGs.size(); i++) { - locale = e.nextElement(); + locale = e.next(); int[] bgs = (int[])localeBGs.get(i); for(int j=0; j<bgs.length; j++) { SymbolTableData symbol = control.getSymbolTable().getBranchGraphRoot( bgs[j] ); diff --git a/src/main/java/org/jogamp/java3d/utils/universe/ViewingPlatform.java b/src/main/java/org/jogamp/java3d/utils/universe/ViewingPlatform.java index cf116a0..36a410f 100644 --- a/src/main/java/org/jogamp/java3d/utils/universe/ViewingPlatform.java +++ b/src/main/java/org/jogamp/java3d/utils/universe/ViewingPlatform.java @@ -39,8 +39,8 @@ package org.jogamp.java3d.utils.universe; -import java.util.Enumeration; import java.util.Hashtable; +import java.util.Iterator; import org.jogamp.java3d.BranchGroup; import org.jogamp.java3d.Group; @@ -48,10 +48,9 @@ import org.jogamp.java3d.Transform3D; import org.jogamp.java3d.TransformGroup; import org.jogamp.java3d.View; import org.jogamp.java3d.ViewPlatform; -import org.jogamp.vecmath.Vector3d; - import org.jogamp.java3d.internal.J3dUtilsI18N; import org.jogamp.java3d.utils.behaviors.vp.ViewPlatformBehavior; +import org.jogamp.vecmath.Vector3d; /** * This class is used to set up the "view" side of a Java 3D scene graph. @@ -190,10 +189,10 @@ public class ViewingPlatform extends BranchGroup { tg.addChild(vp); viewPlatform = vp; // Assign this to all Viewers. - Enumeration e = viewerList.keys(); + Iterator<Viewer> e = viewerList.keySet().iterator(); - while (e.hasMoreElements()) - ((Viewer)e.nextElement()).setViewingPlatform(this); + while (e.hasNext()) + e.next().setViewingPlatform(this); } /** |