public class Ranker
extends java.lang.Object
| Constructor and Description |
|---|
Ranker(int maximumSize) |
| Modifier and Type | Method and Description |
|---|---|
void |
add(java.lang.Object object,
double score,
boolean maximising)
Add in (if it's good enough) a new object based on a score
If an object has equality with an object already in the store that object is replaced by the new version
|
java.lang.Object |
getBestObject() |
double |
getBestScore()
Obtain the best score which may be the highest score (if maximising), or the lowest score (if minimising)
|
java.lang.Object[] |
getObjects()
Obtain the objects in this ranker
|
boolean |
isWorthAdding(double score,
boolean maximising)
Enquire to the merits of adding an object with a particular score
|
java.lang.String |
toString() |
public final java.lang.Object getBestObject()
public final double getBestScore()
public final boolean isWorthAdding(double score,
boolean maximising)
score - The score in questionpublic final java.lang.Object[] getObjects()
public void add(java.lang.Object object,
double score,
boolean maximising)
object - The object to add inscore - The score of the objectpublic java.lang.String toString()
toString in class java.lang.Object