fix for term iteration

git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@7900 6c8d7289-2bf4-0310-a012-ef5d649a1542
pull/1/head
orbiter 14 years ago
parent 9bdee5c71c
commit 45e497a9bd

@ -48,19 +48,8 @@ public class Rating<A> {
return this.object;
}
@SuppressWarnings("rawtypes")
public final static ObjectComparator<?> objectComparator = new ObjectComparator();
public final static ScoreComparator scoreComparator = new ScoreComparator();
public static class ObjectComparator<B> implements Comparator<Rating<B>> {
@SuppressWarnings("unchecked")
public int compare(final Rating<B> arg0, final Rating<B> arg1) {
if (!(arg0 instanceof Comparable<?>)) throw new UnsupportedOperationException("object class must implement comparable");
return ((Comparable<B>) arg0.getObject()).compareTo(arg1.getObject());
}
}
public static class ScoreComparator implements Comparator<Rating<?>> {
public int compare(final Rating<?> arg0, final Rating<?> arg1) {

@ -34,7 +34,6 @@ import java.util.TreeMap;
import net.yacy.cora.ranking.Order;
import net.yacy.cora.ranking.Rating;
import net.yacy.cora.ranking.RatingOrder;
import net.yacy.cora.storage.ComparableARC;
import net.yacy.kelondro.data.meta.URIMetadataRow;
import net.yacy.kelondro.index.HandleSet;
@ -453,19 +452,7 @@ public final class IndexCell<ReferenceType extends Reference> extends AbstractBu
}
public CloneableIterator<Rating<byte[]>> referenceCountIterator(final byte[] starttermHash, final boolean rot) {
final RatingOrder<byte[]> containerOrder = new RatingOrder<byte[]>(this.ram.rowdef().getOrdering());
containerOrder.rotate(new Rating<byte[]>(starttermHash, 0));
return new MergeIterator<Rating<byte[]>>(
this.ram.referenceCountIterator(starttermHash, rot),
new MergeIterator<Rating<byte[]>>(
this.ram.referenceCountIterator(starttermHash, false),
this.array.referenceCountIterator(starttermHash, false),
containerOrder,
ReferenceContainer.containerMergeMethod,
true),
containerOrder,
ReferenceContainer.containerMergeMethod,
true);
return this.array.referenceCountIterator(starttermHash, false);
}
public CloneableIterator<ReferenceContainer<ReferenceType>> referenceContainerIterator(final byte[] starttermHash, final boolean rot) {

@ -216,9 +216,12 @@ public class ReferenceContainer<ReferenceType extends Reference> extends RowSet
}
public static Object mergeUnique(final Object a, final Object b) throws RowSpaceExceededException {
final ReferenceContainer<?> c = (ReferenceContainer<?>) a;
c.addAllUnique((ReferenceContainer<?>) b);
return c;
if (a instanceof ReferenceContainer<?>) {
final ReferenceContainer<?> c = (ReferenceContainer<?>) a;
c.addAllUnique((ReferenceContainer<?>) b);
return c;
}
throw new UnsupportedOperationException("Objects have wrong type: " + a.getClass().getName());
}
public static final Method containerMergeMethod;

@ -185,7 +185,6 @@ public final class ReferenceContainerCache<ReferenceType extends Reference> exte
if (entry.getValue() != null && entry.getValue().getTermHash() != null) list.add(new Rating<ByteArray>(entry.getKey(), entry.getValue().size()));
}
}
Collections.sort(list, new Rating.ObjectComparator<ByteArray>());
return list;
}

Loading…
Cancel
Save