Package com.sk89q.worldedit.util
Class WeightedChoice<T>
java.lang.Object
com.sk89q.worldedit.util.WeightedChoice<T>
- Type Parameters:
- T- the type of choice
Returns the best choice given a weighting function and a target weight.
 
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.
- 
Nested Class SummaryNested ClassesModifier and TypeClassDescriptionstatic classA tuple of choice and score.
- 
Constructor SummaryConstructorsConstructorDescriptionWeightedChoice(Function<T, ? extends Number> function, double target) Create a new instance.
- 
Method Summary
- 
Constructor Details- 
WeightedChoiceCreate a new instance.- Parameters:
- function- a function that assigns a score for each choice
- target- the target score that the best choice should be closest to
 
 
- 
- 
Method Details- 
considerConsider the given object.- Parameters:
- object- the choice
 
- 
getChoiceGet the best choice.- Returns:
- the best choice
 
 
-