mirror of
https://github.com/yacy/yacy_search_server.git
synced 2024-09-19 00:01:41 +02:00
* add custom comparator to ScoreCluster for byte[]
* fixes http://forum.yacy-websuche.de/viewtopic.php?f=6&t=2010 git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@5836 6c8d7289-2bf4-0310-a012-ef5d649a1542
This commit is contained in:
parent
31c6934df2
commit
76af84d732
|
@ -33,6 +33,7 @@ import java.util.Iterator;
|
|||
import java.util.Set;
|
||||
|
||||
import de.anomic.kelondro.index.Row;
|
||||
import de.anomic.kelondro.order.Base64Order;
|
||||
import de.anomic.kelondro.order.ByteOrder;
|
||||
import de.anomic.kelondro.order.CloneableIterator;
|
||||
import de.anomic.kelondro.text.referencePrototype.WordReferenceRow;
|
||||
|
@ -72,8 +73,8 @@ public final class IndexBuffer<ReferenceType extends Reference> extends Abstract
|
|||
|
||||
// creates a new index cache
|
||||
// the cache has a back-end where indexes that do not fit in the cache are flushed
|
||||
this.hashScore = new ScoreCluster<byte[]>();
|
||||
this.hashDate = new ScoreCluster<byte[]>();
|
||||
this.hashScore = new ScoreCluster<byte[]>(Base64Order.enhancedCoder);
|
||||
this.hashDate = new ScoreCluster<byte[]>(Base64Order.enhancedCoder);
|
||||
this.initTime = System.currentTimeMillis();
|
||||
this.cacheEntityMaxCount = entityCacheMaxSize;
|
||||
this.cacheReferenceCountLimit = wCacheReferenceCountLimitInit;
|
||||
|
|
|
@ -23,6 +23,7 @@ package de.anomic.kelondro.util;
|
|||
|
||||
import java.text.ParseException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Comparator;
|
||||
import java.util.Iterator;
|
||||
import java.util.Map;
|
||||
import java.util.Random;
|
||||
|
@ -38,7 +39,15 @@ public final class ScoreCluster<E> {
|
|||
private int encnt;
|
||||
|
||||
public ScoreCluster() {
|
||||
refkeyDB = new TreeMap<E, Long>();
|
||||
this(null);
|
||||
}
|
||||
|
||||
public ScoreCluster(Comparator<? super E> comparator) {
|
||||
if(comparator != null) {
|
||||
refkeyDB = new TreeMap<E, Long>(comparator);
|
||||
} else {
|
||||
refkeyDB = new TreeMap<E, Long>();
|
||||
}
|
||||
keyrefDB = new TreeMap<Long, E>();
|
||||
gcount = 0;
|
||||
encnt = 0;
|
||||
|
|
Loading…
Reference in New Issue
Block a user