Author: orbiter
Date: 2008-01-25 00:58:18 +0100 (Fri, 25 Jan 2008)
New Revision: 4398

Modified:
   trunk/source/de/anomic/kelondro/kelondroRowSet.java
   trunk/source/de/anomic/plasma/plasmaCrawlBalancer.java
   trunk/source/de/anomic/yacy/yacySearch.java
Log:
minor fixes, some generics

Modified: trunk/source/de/anomic/kelondro/kelondroRowSet.java
===================================================================
--- trunk/source/de/anomic/kelondro/kelondroRowSet.java 2008-01-24 22:49:00 UTC 
(rev 4397)
+++ trunk/source/de/anomic/kelondro/kelondroRowSet.java 2008-01-24 23:58:18 UTC 
(rev 4398)
@@ -33,7 +33,7 @@
 
 public class kelondroRowSet extends kelondroRowCollection implements 
kelondroIndex {
 
-    private static final int collectionReSortLimit = 300;
+    private static final int collectionReSortLimit = 400;
     
     private kelondroProfile profile;
 
@@ -144,6 +144,10 @@
         
         if (rowdef.objectOrder == null) return iterativeSearch(a, astart, 
alength, 0, this.chunkcount);
         
+        if ((this.chunkcount - this.sortBound) > (collectionReSortLimit << 1)) 
{
+            sort();
+        }
+        
         if ((this.rowdef.objectOrder != null) && (this.rowdef.objectOrder 
instanceof kelondroBase64Order) && (this.sortBound > 4000)) {
             // first try to find in sorted area
             final byte[] compiledPivot = compilePivot(a, astart, alength);

Modified: trunk/source/de/anomic/plasma/plasmaCrawlBalancer.java
===================================================================
--- trunk/source/de/anomic/plasma/plasmaCrawlBalancer.java      2008-01-24 
22:49:00 UTC (rev 4397)
+++ trunk/source/de/anomic/plasma/plasmaCrawlBalancer.java      2008-01-24 
23:58:18 UTC (rev 4398)
@@ -465,7 +465,7 @@
         assert delta >= 0: "delta = " + delta;
         int s = urlFileIndex.size();
         kelondroRow.Entry rowEntry = urlFileIndex.remove(result.getBytes(), 
false);
-        assert (rowEntry != null) && (urlFileIndex.size() + 1 == s) : 
"urlFileIndex.size() = " + urlFileIndex.size() + ", s = " + s + ", result = " + 
result;
+        assert (rowEntry == null) || (urlFileIndex.size() + 1 == s) : 
"urlFileIndex.size() = " + urlFileIndex.size() + ", s = " + s + ", result = " + 
result;
         if (rowEntry == null) {
             serverLog.logSevere("PLASMA BALANCER", "get() found a valid 
urlhash, but failed to fetch the corresponding url entry - total size = " + 
size() + ", fileStack.size() = " + urlFileStack.size() + ", ramStack.size() = " 
+ urlRAMStack.size() + ", domainStacks.size() = " + domainStacks.size());
             return null;

Modified: trunk/source/de/anomic/yacy/yacySearch.java
===================================================================
--- trunk/source/de/anomic/yacy/yacySearch.java 2008-01-24 22:49:00 UTC (rev 
4397)
+++ trunk/source/de/anomic/yacy/yacySearch.java 2008-01-24 23:58:18 UTC (rev 
4398)
@@ -120,9 +120,9 @@
         }
     }
 
-    public static String set2string(Set hashes) {
+    public static String set2string(Set<String> hashes) {
         String wh = "";
-        final Iterator iter = hashes.iterator();
+        final Iterator<String> iter = hashes.iterator();
         while (iter.hasNext()) { wh = wh + (String) iter.next(); }
         return wh;
     }
@@ -139,28 +139,28 @@
         return targetPeer;
     }
 
-    private static yacySeed[] selectClusterPeers(TreeMap peerhashes) {
-       Iterator i = peerhashes.entrySet().iterator();
-       ArrayList l = new ArrayList();
-       Map.Entry entry;
+    private static yacySeed[] selectClusterPeers(TreeMap<String, String> 
peerhashes) {
+       Iterator<Map.Entry<String, String>> i = 
peerhashes.entrySet().iterator();
+       ArrayList<yacySeed> l = new ArrayList<yacySeed>();
+       Map.Entry<String, String> entry;
        yacySeed s;
        while (i.hasNext()) {
-               entry = (Map.Entry) i.next();
-               s = yacyCore.seedDB.get((String) entry.getKey()); // should be 
getConnected; get only during testing time
+               entry = i.next();
+               s = yacyCore.seedDB.get(entry.getKey()); // should be 
getConnected; get only during testing time
                if (s != null) {
-                       s.setAlternativeAddress((String) entry.getValue());
+                       s.setAlternativeAddress(entry.getValue());
                        l.add(s);
                }
        }
        yacySeed[] result = new yacySeed[l.size()];
        for (int j = 0; j < l.size(); j++) {
-               result[j] = (yacySeed) l.get(j);
+               result[j] = l.get(j);
        }
        return result;
        //return (yacySeed[]) l.toArray();
     }
     
-    private static yacySeed[] selectSearchTargets(Set wordhashes, int 
seedcount) {
+    private static yacySeed[] selectSearchTargets(Set<String> wordhashes, int 
seedcount) {
         // find out a specific number of seeds, that would be relevant for the 
given word hash(es)
         // the result is ordered by relevance: [0] is most relevant
         // the seedcount is the maximum number of wanted results
@@ -171,15 +171,15 @@
         
         // put in seeds according to dht
         final kelondroMScoreCluster<String> ranking = new 
kelondroMScoreCluster<String>();
-        final HashMap seeds = new HashMap();
+        final HashMap<String, yacySeed> seeds = new HashMap<String, 
yacySeed>();
         yacySeed seed;
-        Iterator dhtEnum;         
+        Iterator<yacySeed> dhtEnum;         
         int c;
         String wordhash;
         double distance;
-        Iterator iter = wordhashes.iterator();
+        Iterator<String> iter = wordhashes.iterator();
         while (iter.hasNext()) {
-            wordhash = (String) iter.next();
+            wordhash = iter.next();
             dhtEnum = yacyCore.dhtAgent.getDHTSeeds(true, wordhash, (float) 
0.0);
             c = seedcount;
             while (dhtEnum.hasNext() && c > 0) {
@@ -200,7 +200,7 @@
         int score;
         if (c > yacyCore.seedDB.sizeConnected()) { c = 
yacyCore.seedDB.sizeConnected(); }
         while (dhtEnum.hasNext() && c > 0) {
-            seed = (yacySeed) dhtEnum.next();
+            seed = dhtEnum.next();
             if (seed == null) continue;
             if (!seed.getFlagAcceptRemoteIndex()) continue; // probably a 
robinson peer
             score = (int) Math.round(Math.random() * ((c / 3) + 3));
@@ -214,7 +214,7 @@
         // or seeds that are newbies to ensure that public demonstrations 
always work
         dhtEnum = yacyCore.seedDB.seedsConnected(true, false, null, (float) 
0.50);
         while (dhtEnum.hasNext()) {
-               seed = (yacySeed) dhtEnum.next();
+               seed = dhtEnum.next();
             if (seed == null) continue;
             if (seed.matchPeerTags(wordhashes)) { // access robinson peers 
with matching tag
                serverLog.logInfo("PLASMA", "selectPeers/PeerTags: " + 
seed.hash + ":" + seed.getName() + ", is specialized peer for " + 
seed.getPeerTags().toString());

_______________________________________________
YaCy-svn mailing list
YaCy-svn@lists.berlios.de
https://lists.berlios.de/mailman/listinfo/yacy-svn

Antwort per Email an