diff options
| author | bculkin2442 <bjculkin@mix.wvu.edu> | 2016-04-08 13:28:09 -0400 |
|---|---|---|
| committer | bculkin2442 <bjculkin@mix.wvu.edu> | 2016-04-08 13:28:09 -0400 |
| commit | 275a627719fc2231b16caea41130ff09f0f2b6a1 (patch) | |
| tree | 757e8ca2061ba6ed9b2063f7155edbe954b72bdb /BJC-Utils2/src/main/java/bjc/utils/gen/WeightedRandom.java | |
| parent | 79d3a4a47cbc1fcf17c77c6fc12ff826a3077bac (diff) | |
Switch functional data to use interfaces
Diffstat (limited to 'BJC-Utils2/src/main/java/bjc/utils/gen/WeightedRandom.java')
| -rw-r--r-- | BJC-Utils2/src/main/java/bjc/utils/gen/WeightedRandom.java | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/BJC-Utils2/src/main/java/bjc/utils/gen/WeightedRandom.java b/BJC-Utils2/src/main/java/bjc/utils/gen/WeightedRandom.java index 5157ee2..10da34e 100644 --- a/BJC-Utils2/src/main/java/bjc/utils/gen/WeightedRandom.java +++ b/BJC-Utils2/src/main/java/bjc/utils/gen/WeightedRandom.java @@ -2,9 +2,10 @@ package bjc.utils.gen; import java.util.Random; import bjc.utils.funcdata.FunctionalList; +import bjc.utils.funcdata.IFunctionalList; import bjc.utils.data.GenHolder; import bjc.utils.data.IHolder; -import bjc.utils.data.Pair; +import bjc.utils.data.IPair; /** * Represents a random number generator where certain results are weighted @@ -19,12 +20,12 @@ public class WeightedRandom<E> { /** * The list of probabilities for each result */ - private FunctionalList<Integer> probabilities; + private IFunctionalList<Integer> probabilities; /** * The list of possible results to pick from */ - private FunctionalList<E> results; + private IFunctionalList<E> results; /** * The source for any needed random numbers @@ -101,7 +102,7 @@ public class WeightedRandom<E> { * * @return A list of all the values that can be generated */ - public FunctionalList<E> getResults() { + public IFunctionalList<E> getResults() { return results; } @@ -111,7 +112,7 @@ public class WeightedRandom<E> { * * @return A list of pairs of values and value probabilities */ - public FunctionalList<Pair<Integer, E>> getValues() { + public IFunctionalList<IPair<Integer, E>> getValues() { return probabilities.pairWith(results); } }
\ No newline at end of file |
