T - the type of choicepublic class WeightedChoice<T> extends Object
A function must be supplied that returns a numeric score for each choice. The function can return null to mean that the choice should not be considered.
| Modifier and Type | Class and Description |
|---|---|
static class |
WeightedChoice.Choice<T>
A tuple of choice and score.
|
| Constructor and Description |
|---|
WeightedChoice(com.google.common.base.Function<T,? extends Number> function,
double target)
Create a new instance.
|
| Modifier and Type | Method and Description |
|---|---|
void |
consider(T object)
Consider the given object.
|
com.google.common.base.Optional<WeightedChoice.Choice<T>> |
getChoice()
Get the best choice.
|
public void consider(T object)
object - the choicepublic com.google.common.base.Optional<WeightedChoice.Choice<T>> getChoice()
Copyright © 2010-2014. All Rights Reserved.