devicemap-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From re...@apache.org
Subject svn commit: r1693382 - in /devicemap/trunk/clients/2.0/reference: devicemap-reference-2.0.jar src/DeviceMapClient.java src/JsonFile.java src/Main.java src/Pattern.java
Date Thu, 30 Jul 2015 02:07:53 GMT
Author: rezan
Date: Thu Jul 30 02:07:52 2015
New Revision: 1693382

URL: http://svn.apache.org/r1693382
Log:
removed iterators

Modified:
    devicemap/trunk/clients/2.0/reference/devicemap-reference-2.0.jar
    devicemap/trunk/clients/2.0/reference/src/DeviceMapClient.java
    devicemap/trunk/clients/2.0/reference/src/JsonFile.java
    devicemap/trunk/clients/2.0/reference/src/Main.java
    devicemap/trunk/clients/2.0/reference/src/Pattern.java

Modified: devicemap/trunk/clients/2.0/reference/devicemap-reference-2.0.jar
URL: http://svn.apache.org/viewvc/devicemap/trunk/clients/2.0/reference/devicemap-reference-2.0.jar?rev=1693382&r1=1693381&r2=1693382&view=diff
==============================================================================
Binary files - no diff available.

Modified: devicemap/trunk/clients/2.0/reference/src/DeviceMapClient.java
URL: http://svn.apache.org/viewvc/devicemap/trunk/clients/2.0/reference/src/DeviceMapClient.java?rev=1693382&r1=1693381&r2=1693382&view=diff
==============================================================================
--- devicemap/trunk/clients/2.0/reference/src/DeviceMapClient.java (original)
+++ devicemap/trunk/clients/2.0/reference/src/DeviceMapClient.java Thu Jul 30 02:07:52 2015
@@ -22,6 +22,7 @@ import java.util.HashMap;
 import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
+
 import org.codehaus.jackson.JsonNode;
 
 public class DeviceMapClient {
@@ -88,8 +89,8 @@ public class DeviceMapClient {
           transformers = new ArrayList<>();
         }
 
-        for(Iterator<JsonNode> i = inputParser.get("transformers").iterator(); i.hasNext();)
{
-          JsonNode transformerNode = i.next();
+        for(int i = 0; i < inputParser.get("transformers").size(); i++) {
+          JsonNode transformerNode = inputParser.get("transformers").get(i);
 
           Transformer transformer = getTransformer(transformerNode);
 
@@ -108,8 +109,8 @@ public class DeviceMapClient {
           tokenSeperators = new ArrayList<>();
         }
         
-        for(Iterator<JsonNode> i = inputParser.get("tokenSeperators").iterator(); i.hasNext();)
{
-          JsonNode tokenSeperatorNode = i.next();
+        for(int i = 0; i < inputParser.get("tokenSeperators").size(); i++) {
+          JsonNode tokenSeperatorNode = inputParser.get("tokenSeperators").get(i);
 
           if(tokenSeperatorNode.asText().isEmpty()) {
             throw new Exception("Empty tokenSeperator not allowed");
@@ -164,8 +165,8 @@ public class DeviceMapClient {
       //PATTERNS
 
       if(JsonFile.get(patternSet, "patterns").isArray()) {
-        for(Iterator<JsonNode> i = patternSet.get("patterns").iterator(); i.hasNext();)
{
-          JsonNode patternNode = i.next();
+        for(int i = 0; i < patternSet.get("patterns").size(); i++) {
+          JsonNode patternNode = patternSet.get("patterns").get(i);
 
           Pattern pattern = new Pattern(patternNode);
 
@@ -209,8 +210,8 @@ public class DeviceMapClient {
     int attributeCount = 0;
 
     if(JsonFile.get(attributes.getJsonNode(), "attributes").isArray()) {
-        for(Iterator<JsonNode> i = attributes.getJsonNode().get("attributes").iterator();
i.hasNext();) {
-          JsonNode attribute = i.next();
+        for(int i = 0; i < attributes.getJsonNode().get("attributes").size(); i++) {
+          JsonNode attribute = attributes.getJsonNode().get("attributes").get(i);
 
           if(JsonFile.get(attribute, "patternId").asText().isEmpty()) {
             throw new Exception("Bad attribute patternId found, position: " + attributeCount);
@@ -230,8 +231,8 @@ public class DeviceMapClient {
           //ATTRIBUTE TRANFORMERS
 
           if(JsonFile.get(attribute, "attributeTransformers").isArray()) {
-            for(Iterator<JsonNode> j = attribute.get("attributeTransformers").iterator();
j.hasNext();) {
-              JsonNode attributeTransformer = j.next();
+            for(int j = 0; j < attribute.get("attributeTransformers").size(); j++) {
+              JsonNode attributeTransformer = attribute.get("attributeTransformers").get(j);
 
               if(JsonFile.get(attributeTransformer, "name").asText().isEmpty()) {
                 throw new Exception("Bad attributeTransformer name, position: " + attributeCount);
@@ -240,8 +241,8 @@ public class DeviceMapClient {
               String name = attributeTransformer.get("name").asText();
 
               if(JsonFile.get(attributeTransformer, "transformers").isArray()) {
-                for(Iterator<JsonNode> k = attributeTransformer.get("transformers").iterator();
k.hasNext();) {
-                  JsonNode transformer = k.next();
+                for(int k = 0; k < attributeTransformer.get("transformers").size(); k++)
{
+                  JsonNode transformer = attributeTransformer.get("transformers").get(k);
                 }
               }
             }

Modified: devicemap/trunk/clients/2.0/reference/src/JsonFile.java
URL: http://svn.apache.org/viewvc/devicemap/trunk/clients/2.0/reference/src/JsonFile.java?rev=1693382&r1=1693381&r2=1693382&view=diff
==============================================================================
--- devicemap/trunk/clients/2.0/reference/src/JsonFile.java (original)
+++ devicemap/trunk/clients/2.0/reference/src/JsonFile.java Thu Jul 30 02:07:52 2015
@@ -18,6 +18,7 @@
  */
 
 import java.io.File;
+
 import org.codehaus.jackson.JsonNode;
 import org.codehaus.jackson.map.ObjectMapper;
 

Modified: devicemap/trunk/clients/2.0/reference/src/Main.java
URL: http://svn.apache.org/viewvc/devicemap/trunk/clients/2.0/reference/src/Main.java?rev=1693382&r1=1693381&r2=1693382&view=diff
==============================================================================
--- devicemap/trunk/clients/2.0/reference/src/Main.java (original)
+++ devicemap/trunk/clients/2.0/reference/src/Main.java Thu Jul 30 02:07:52 2015
@@ -20,6 +20,7 @@
 import java.util.ArrayList;
 import java.util.Iterator;
 import java.util.List;
+
 import org.codehaus.jackson.JsonNode;
 
 public class Main {
@@ -155,8 +156,8 @@ public class Main {
     //ITERATE THRU THE TESTS
     
     if(JsonFile.get(tests.getJsonNode(), "tests").isArray()) {
-        for(Iterator<JsonNode> i = tests.getJsonNode().get("tests").iterator(); i.hasNext();)
{
-          JsonNode test = i.next();
+        for(int i = 0; i < tests.getJsonNode().get("tests").size(); i++) {
+          JsonNode test = tests.getJsonNode().get("tests").get(i);
 
           if(JsonFile.get(test, "input").asText().isEmpty()) {
             throw new Exception("Bad test input found, position: " + testCount);

Modified: devicemap/trunk/clients/2.0/reference/src/Pattern.java
URL: http://svn.apache.org/viewvc/devicemap/trunk/clients/2.0/reference/src/Pattern.java?rev=1693382&r1=1693381&r2=1693382&view=diff
==============================================================================
--- devicemap/trunk/clients/2.0/reference/src/Pattern.java (original)
+++ devicemap/trunk/clients/2.0/reference/src/Pattern.java Thu Jul 30 02:07:52 2015
@@ -18,8 +18,8 @@
  */
 
 import java.util.ArrayList;
-import java.util.Iterator;
 import java.util.List;
+
 import org.codehaus.jackson.JsonNode;
 
 public class Pattern {
@@ -69,8 +69,8 @@ public class Pattern {
 
     patternTokens = new ArrayList<>();
 
-    for(Iterator<JsonNode> i = json.get("patternTokens").iterator(); i.hasNext();)
{
-      JsonNode patternToken = i.next();
+    for(int i = 0; i < json.get("patternTokens").size(); i++) {
+      JsonNode patternToken = json.get("patternTokens").get(i);
 
       if(patternToken.asText().isEmpty()) {
         throw new Exception("Empty patternToken in " + patternId);



Mime
View raw message