uk.ac.starlink.topcat
Class Classifier.CountedValue<T>

java.lang.Object
  extended by uk.ac.starlink.topcat.Classifier.CountedValue<T>
All Implemented Interfaces:
Comparable<Classifier.CountedValue<T>>
Enclosing class:
Classifier<T>

public static class Classifier.CountedValue<T>
extends Object
implements Comparable<Classifier.CountedValue<T>>

Aggregates a value and the number of times it has been submitted. The natural comparison sequence of these objects sorts them in decreasing order of Count (number of submissions).


Constructor Summary
Classifier.CountedValue(T value, long count)
          Constructor.
 
Method Summary
 int compareTo(Classifier.CountedValue<T> cv2)
          Decreasing comparison on count, with appropriate tie-breakers.
 boolean equals(Object o)
           
 long getCount()
          Returns the count.
 T getValue()
          Returns the value.
 int hashCode()
           
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Classifier.CountedValue

public Classifier.CountedValue(T value,
                               long count)
Constructor.

Parameters:
value - submitted value
count - number of times it has been submitted
Method Detail

getValue

public T getValue()
Returns the value.

Returns:
value

getCount

public long getCount()
Returns the count.

Returns:
number of times the value has been submitted

toString

public String toString()
Overrides:
toString in class Object

hashCode

public int hashCode()
Overrides:
hashCode in class Object

equals

public boolean equals(Object o)
Overrides:
equals in class Object

compareTo

public int compareTo(Classifier.CountedValue<T> cv2)
Decreasing comparison on count, with appropriate tie-breakers.

Specified by:
compareTo in interface Comparable<Classifier.CountedValue<T>>


Copyright © 2003-2018 CCLRC: Council for the Central Laboratory of the Research Councils. All Rights Reserved.