commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From s...@apache.org
Subject svn commit: r999923 - /commons/proper/net/trunk/src/main/java/org/apache/commons/net/ftp/parser/VMSVersioningFTPEntryParser.java
Date Wed, 22 Sep 2010 13:03:51 GMT
Author: sebb
Date: Wed Sep 22 13:03:51 2010
New Revision: 999923

URL: http://svn.apache.org/viewvc?rev=999923&view=rev
Log:
Simplify code - no need for NameVersion class as we only use the version

Modified:
    commons/proper/net/trunk/src/main/java/org/apache/commons/net/ftp/parser/VMSVersioningFTPEntryParser.java

Modified: commons/proper/net/trunk/src/main/java/org/apache/commons/net/ftp/parser/VMSVersioningFTPEntryParser.java
URL: http://svn.apache.org/viewvc/commons/proper/net/trunk/src/main/java/org/apache/commons/net/ftp/parser/VMSVersioningFTPEntryParser.java?rev=999923&r1=999922&r2=999923&view=diff
==============================================================================
--- commons/proper/net/trunk/src/main/java/org/apache/commons/net/ftp/parser/VMSVersioningFTPEntryParser.java
(original)
+++ commons/proper/net/trunk/src/main/java/org/apache/commons/net/ftp/parser/VMSVersioningFTPEntryParser.java
Wed Sep 22 13:03:51 2010
@@ -94,17 +94,6 @@ public class VMSVersioningFTPEntryParser
 
    }
 
-
-
-    private static class NameVersion {
-        final String name;
-        final int versionNumber;
-        NameVersion(String name, String vers) {
-            this.name = name;
-            this.versionNumber = Integer.parseInt(vers);
-        }
-    }
-
     /**
      * Implement hook provided for those implementers (such as
      * VMSVersioningFTPEntryParser, and possibly others) which return
@@ -117,7 +106,7 @@ public class VMSVersioningFTPEntryParser
     @Override
     public List<String> preParse(List<String> original) {
         original = super.preParse(original);
-        HashMap<String, NameVersion> existingEntries = new HashMap<String, NameVersion>();
+        HashMap<String, Integer> existingEntries = new HashMap<String, Integer>();
         ListIterator<String> iter = original.listIterator();
         while (iter.hasNext()) {
             String entry = iter.next().trim();
@@ -127,11 +116,11 @@ public class VMSVersioningFTPEntryParser
                 result = _preparse_matcher_.toMatchResult();
                 String name = result.group(1);
                 String version = result.group(2);
-                NameVersion nv = new NameVersion(name, version);
-                NameVersion existing = existingEntries.get(name);
+                Integer nv = Integer.valueOf(version);
+                Integer existing = existingEntries.get(name);
                 if (null != existing) {
-                    if (nv.versionNumber < existing.versionNumber) {
-                        iter.remove();  // removal removes from original list.
+                    if (nv.intValue() < existing.intValue()) {
+                        iter.remove();  // removes older version from original list.
                         continue;
                     }
                 }
@@ -151,11 +140,11 @@ public class VMSVersioningFTPEntryParser
                 result = _preparse_matcher_.toMatchResult();
                 String name = result.group(1);
                 String version = result.group(2);
-                NameVersion nv = new NameVersion(name, version);
-                NameVersion existing = existingEntries.get(name);
+                Integer nv = Integer.valueOf(version);
+                Integer existing = existingEntries.get(name);
                 if (null != existing) {
-                    if (nv.versionNumber < existing.versionNumber) {
-                        iter.remove(); // removal removes from original list.
+                    if (nv.intValue() < existing.intValue()) {
+                        iter.remove(); // removes older version from original list.
                     }
                 }
             }



Mime
View raw message