Package pal.algorithmics
Class Ranker
- java.lang.Object
-
- pal.algorithmics.Ranker
-
public class Ranker extends java.lang.ObjectTitle: Ranker Description: Maintains a list of ranked objects- Version:
- 1.0
- Author:
- Matthew Goode
-
-
Constructor Summary
Constructors Constructor Description Ranker(int maximumSize)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidadd(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 versionjava.lang.ObjectgetBestObject()doublegetBestScore()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 rankerbooleanisWorthAdding(double score, boolean maximising)Enquire to the merits of adding an object with a particular scorejava.lang.StringtoString()
-
-
-
Method Detail
-
getBestObject
public final java.lang.Object getBestObject()
-
getBestScore
public final double getBestScore()
Obtain the best score which may be the highest score (if maximising), or the lowest score (if minimising)- Returns:
- the best score
-
isWorthAdding
public final boolean isWorthAdding(double score, boolean maximising)Enquire to the merits of adding an object with a particular score- Parameters:
score- The score in question- Returns:
- true if an object with such a score is going to make a difference to the current state of this ranker
-
getObjects
public final java.lang.Object[] getObjects()
Obtain the objects in this ranker- Returns:
- the objects in the order of bestness (such that the first is the best)
-
add
public 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- Parameters:
object- The object to add inscore- The score of the object
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-