manifoldcf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kwri...@apache.org
Subject svn commit: r1848992 - /manifoldcf/trunk/framework/pull-agent/src/main/java/org/apache/manifoldcf/crawler/jobs/HopCount.java
Date Sat, 15 Dec 2018 12:56:23 GMT
Author: kwright
Date: Sat Dec 15 12:56:23 2018
New Revision: 1848992

URL: http://svn.apache.org/viewvc?rev=1848992&view=rev
Log:
More minor refactoring of HopCount module

Modified:
    manifoldcf/trunk/framework/pull-agent/src/main/java/org/apache/manifoldcf/crawler/jobs/HopCount.java

Modified: manifoldcf/trunk/framework/pull-agent/src/main/java/org/apache/manifoldcf/crawler/jobs/HopCount.java
URL: http://svn.apache.org/viewvc/manifoldcf/trunk/framework/pull-agent/src/main/java/org/apache/manifoldcf/crawler/jobs/HopCount.java?rev=1848992&r1=1848991&r2=1848992&view=diff
==============================================================================
--- manifoldcf/trunk/framework/pull-agent/src/main/java/org/apache/manifoldcf/crawler/jobs/HopCount.java
(original)
+++ manifoldcf/trunk/framework/pull-agent/src/main/java/org/apache/manifoldcf/crawler/jobs/HopCount.java
Sat Dec 15 12:56:23 2018
@@ -1929,7 +1929,7 @@ public class HopCount extends org.apache
     /** The answer value */
     protected int answer = ANSWER_UNKNOWN;
     /** This is the set of delete dependencies.  It is keyed by a DeleteDependency object.
*/
-    protected HashMap deleteDependencies = new HashMap();
+    protected HashSet<DeleteDependency> deleteDependencies = new HashSet<>();
 
     /** Constructor. */
     public Answer()
@@ -1940,7 +1940,7 @@ public class HopCount extends org.apache
     {
       answer = other.answer;
       // Shallow copy is fine, because the stuff in these dependencies is immutable.
-      deleteDependencies = (HashMap)other.deleteDependencies.clone();
+      deleteDependencies = (HashSet<DeleteDependency>)other.deleteDependencies.clone();
     }
 
     public Answer(int value)
@@ -1955,8 +1955,8 @@ public class HopCount extends org.apache
       int i = 0;
       while (i < deleteDeps.length)
       {
-        DeleteDependency dep = (DeleteDependency)deleteDeps[i++];
-        deleteDependencies.put(dep,dep);
+        DeleteDependency dep = deleteDeps[i++];
+        deleteDependencies.add(dep);
       }
     }
 
@@ -1974,15 +1974,15 @@ public class HopCount extends org.apache
     }
 
     /** Iterate over the delete dependencies. */
-    public Iterator getDeleteDependencies()
+    public Iterator<DeleteDependency> getDeleteDependencies()
     {
-      return deleteDependencies.keySet().iterator();
+      return deleteDependencies.iterator();
     }
 
     /** Check if a delete dependency is present */
     public boolean hasDependency(DeleteDependency dep)
     {
-      return deleteDependencies.get(dep) != null;
+      return deleteDependencies.contains(dep);
     }
 
     /** Initialize this answer object.  This sets the answer value to ANSWER_INFINITY
@@ -1999,7 +1999,7 @@ public class HopCount extends org.apache
     {
       answer = other.answer;
       // Shallow copy is fine, because the stuff in these dependencies is immutable.
-      deleteDependencies = (HashMap)other.deleteDependencies.clone();
+      deleteDependencies = (HashSet<DeleteDependency>)other.deleteDependencies.clone();
     }
 
     /** Update the current answer, using a child link's information and answer.
@@ -2075,12 +2075,12 @@ public class HopCount extends org.apache
     }
 
     /** Set answer from child */
-    protected void setAnswerFromChild(int newAnswer, HashMap childDeleteDependencies, String
linkType, String parentIDHash, String childIDHash)
+    protected void setAnswerFromChild(int newAnswer, HashSet<DeleteDependency> childDeleteDependencies,
String linkType, String parentIDHash, String childIDHash)
     {
       answer = newAnswer;
-      deleteDependencies = (HashMap)childDeleteDependencies.clone();
+      deleteDependencies = (HashSet<DeleteDependency>)childDeleteDependencies.clone();
       DeleteDependency x = new DeleteDependency(linkType,parentIDHash,childIDHash);
-      deleteDependencies.put(x,x);
+      deleteDependencies.add(x);
     }
 
     /** Set an answer from initial data. */
@@ -2091,8 +2091,8 @@ public class HopCount extends org.apache
       int i = 0;
       while (i < deleteDeps.length)
       {
-        DeleteDependency dep = (DeleteDependency)deleteDeps[i++];
-        deleteDependencies.put(dep,dep);
+        DeleteDependency dep = deleteDeps[i++];
+        deleteDependencies.add(dep);
       }
     }
   }



Mime
View raw message