|
RuneHive-Game
|
Handles a random chance. More...
Classes | |
| enum | ChanceType |
Public Member Functions | |
| final void | add (ChanceType type, T t) |
Adds a new WeightedObject to the #object list. | |
| final void | add (double weight, T t) |
Adds a new WeightedObject to the #object list. | |
| Chance () | |
| Creates a new instance of the class. | |
| Chance (List< WeightedObject< T > > objects) | |
| Creates a new instance of the class. | |
| T | next () |
Generates a WeightedObject. | |
| WeightedObject< T > | next (double boost) |
Generates a WeightedObject. | |
| Item[] | toItemArray () |
| String | toString () |
Private Attributes | |
| final List< WeightedObject< T > > | objects |
| The list of weighted object. | |
| double | sum |
| The sum of the weights. | |
Handles a random chance.
| <T> | - The representation type. |
Definition at line 14 of file Chance.java.
| com.runehive.util.chance.Chance< T >.Chance | ( | List< WeightedObject< T > > | objects | ) |
Creates a new instance of the class.
Definition at line 41 of file Chance.java.
References com.runehive.util.chance.WeightedObject< T >.getWeight(), objects, and sum.
| com.runehive.util.chance.Chance< T >.Chance | ( | ) |
Creates a new instance of the class.
Definition at line 48 of file Chance.java.
References sum.
| final void com.runehive.util.chance.Chance< T >.add | ( | ChanceType | type, |
| T | t ) |
Adds a new WeightedObject to the #object list.
Definition at line 61 of file Chance.java.
References add(), and com.runehive.util.chance.Chance< T >.ChanceType.getWeight().
| final void com.runehive.util.chance.Chance< T >.add | ( | double | weight, |
| T | t ) |
Adds a new WeightedObject to the #object list.
Definition at line 54 of file Chance.java.
Referenced by add().
| T com.runehive.util.chance.Chance< T >.next | ( | ) |
Generates a WeightedObject.
Definition at line 66 of file Chance.java.
| WeightedObject< T > com.runehive.util.chance.Chance< T >.next | ( | double | boost | ) |
Generates a WeightedObject.
Definition at line 82 of file Chance.java.
| Item[] com.runehive.util.chance.Chance< T >.toItemArray | ( | ) |
Definition at line 101 of file Chance.java.
References objects.
| String com.runehive.util.chance.Chance< T >.toString | ( | ) |
Definition at line 112 of file Chance.java.
References objects.
|
private |
The list of weighted object.
Definition at line 35 of file Chance.java.
Referenced by add(), Chance(), next(), next(), toItemArray(), and toString().
|
private |