T - type of objectpublic class TieBreaker<T>
extends java.lang.Object
| Constructor and Description |
|---|
TieBreaker(long rngSeed)
Initialize the random seed
|
| Modifier and Type | Method and Description |
|---|---|
void |
candidate(T obj,
double cost)
Supply a candidate with a cost
|
T |
getWinner()
Based upon stream of candidates since the last
reset (or construction), returns the winning
candidate (lowest cost; selected randomly from
any ties).
|
void |
reset()
Resets the object to a state in which
it hasn't encountered any candidate
objects.
|
public TieBreaker(long rngSeed)
rngSeed - random number generator seedpublic void reset()
public void candidate(T obj, double cost)
obj - candidatecost - cost (lower is cheaper)public T getWinner()