[Openstreetmap-dev] Patch to allow compilation with Java 1.5 compliant compiler

Magne Mæhre magne at samfundet.no
Sun May 29 14:09:02 BST 2005


In Java 1.5, 'enum' was introduced as a keyword.  The attached diff file
has replaced all occurences of 'enum' with 'en' to allow
compilation with  Java 1.5 compilers.  


--Magne

-------------- next part --------------
Index: java/src/org/openstreetmap/applet/osmLineLayer.java
===================================================================
--- java/src/org/openstreetmap/applet/osmLineLayer.java	(revision 440)
+++ java/src/org/openstreetmap/applet/osmLineLayer.java	(working copy)
@@ -79,17 +79,17 @@
         LatLonPoint lowerRight = proj.getLowerRight();
         nodeHashTable = serverClient.getNodes(upperLeft, lowerRight);
         {
-	        Enumeration enum = nodeHashTable.elements();
-	        while (enum.hasMoreElements()) {
-	            Node n = (Node) enum.nextElement();
+	        Enumeration en = nodeHashTable.elements();
+	        while (en.hasMoreElements()) {
+	            Node n = (Node) en.nextElement();
 	            nodeGraphics.add(n);
 	        }
         }
         {
             Vector lines = serverClient.getLines(nodeHashTable);
-	        Enumeration enum = lines.elements();
-	        while (enum.hasMoreElements()) {
-	            OMGraphic g = (OMGraphic) enum.nextElement();
+	        Enumeration en = lines.elements();
+	        while (en.hasMoreElements()) {
+	            OMGraphic g = (OMGraphic) en.nextElement();
 	            lineGraphics.add(g);
 	        }
         }
Index: java/src/org/openstreetmap/applet/osmBackgroundLoader.java
===================================================================
--- java/src/org/openstreetmap/applet/osmBackgroundLoader.java	(revision 440)
+++ java/src/org/openstreetmap/applet/osmBackgroundLoader.java	(working copy)
@@ -33,9 +33,9 @@
         long lLastTime = System.currentTimeMillis();
         Vector v = new Vector();
         v = osc.getPoints(llTopLeft, llBotRight);
-        Enumeration enum = v.elements();
-        while (enum.hasMoreElements()) {
-            gpspoint p = (gpspoint) enum.nextElement();
+        Enumeration en = v.elements();
+        while (en.hasMoreElements()) {
+            gpspoint p = (gpspoint) en.nextElement();
             omc = new OMCircle(p.getLatitude(), p.getLongitude(), 5f, com.bbn.openmap.proj.Length.METER);
             omc.setLinePaint(Color.gray);
             omc.setSelectPaint(Color.red);
Index: java/src/org/openstreetmap/client/osmServerClient.java
===================================================================
--- java/src/org/openstreetmap/client/osmServerClient.java	(revision 440)
+++ java/src/org/openstreetmap/client/osmServerClient.java	(working copy)
@@ -191,10 +191,10 @@
         Vector results = vector_callServer("getPoints", params);
         Logger.log("reading points...");
         Vector gpsPoints = new Vector();
-        Enumeration enum = results.elements();
-        while (enum.hasMoreElements()) {
-            float lat = (float) ((Double) enum.nextElement()).doubleValue();
-            float lon = (float) ((Double) enum.nextElement()).doubleValue();
+        Enumeration en = results.elements();
+        while (en.hasMoreElements()) {
+            float lat = (float) ((Double) en.nextElement()).doubleValue();
+            float lon = (float) ((Double) en.nextElement()).doubleValue();
             gpsPoints.add(new gpspoint(lat, lon, 0, 0));
         }
         Logger.log("done getting points");
@@ -211,9 +211,9 @@
         params.addElement(new Double((double) llp2.getLongitude()));
         Vector results = vector_callServer("getNodes", params);
         Hashtable htNodes = new Hashtable();
-        Enumeration enum = results.elements();
-        while (enum.hasMoreElements()) {
-            Vector vNode = (Vector) enum.nextElement(); 
+        Enumeration en = results.elements();
+        while (en.hasMoreElements()) {
+            Vector vNode = (Vector) en.nextElement(); 
             int uid = ((Integer)vNode.get(0)).intValue();
             double lat = ((Double)vNode.get(1)).doubleValue();
             double lon = ((Double)vNode.get(2)).doubleValue();
@@ -263,16 +263,16 @@
         Vector params = new Vector();
         params.addElement("applet");
         Vector uids = new Vector();
-        Enumeration enum = htNodes.elements();
-        while (enum.hasMoreElements()) {
-            uids.addElement(new Integer(((Node) enum.nextElement()).getUID()));
+        Enumeration en = htNodes.elements();
+        while (en.hasMoreElements()) {
+            uids.addElement(new Integer(((Node) en.nextElement()).getUID()));
         }
         params.addElement(uids);
         Map streetNameCache = new HashMap();
         Vector results = vector_callServer("getLines", params);
-        enum = results.elements();
-        while (enum.hasMoreElements()) {
-            Vector line = (Vector) enum.nextElement();
+        en = results.elements();
+        while (en.hasMoreElements()) {
+            Vector line = (Vector) en.nextElement();
             Integer ia = (Integer) line.get(1);
             Integer ib = (Integer) line.get(2);
             int na = ia.intValue();


More information about the dev mailing list