org.apache.mahout.cf.taste.common
Class TopK<T>

java.lang.Object
  extended by org.apache.mahout.cf.taste.common.TopK<T>

public class TopK<T>
extends Object

this class will preserve the k maximum elements of all elements it has been offered


Constructor Summary
TopK(int k, Comparator<? super T> comparator)
           
 
Method Summary
 boolean isEmpty()
           
 void offer(T item)
           
protected  T peek()
           
protected  Comparator<? super T> queueingComparator(Comparator<? super T> stdComparator)
           
 List<T> retrieve()
           
 int size()
           
 T smallestGreat()
           
protected  Comparator<? super T> sortingComparator(Comparator<? super T> stdComparator)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TopK

public TopK(int k,
            Comparator<? super T> comparator)
Method Detail

queueingComparator

protected Comparator<? super T> queueingComparator(Comparator<? super T> stdComparator)

sortingComparator

protected Comparator<? super T> sortingComparator(Comparator<? super T> stdComparator)

smallestGreat

public T smallestGreat()

offer

public void offer(T item)

isEmpty

public boolean isEmpty()

size

public int size()

retrieve

public List<T> retrieve()

peek

protected T peek()


Copyright © 2008-2012 The Apache Software Foundation. All Rights Reserved.