Class StableWeightedGeneList
java.lang.Object
com.hexagram2021.chromosomelib.registry.SimpleWeightedGeneList
com.hexagram2021.chromosomelib.registry.StableWeightedGeneList
- All Implemented Interfaces:
IWeightedGeneList
This list simulates the fact that homozygotes are more common in nature for some species.
-
Nested Class Summary
Nested ClassesNested classes/interfaces inherited from interface com.hexagram2021.chromosomelib.registry.IWeightedGeneList
IWeightedGeneList.Context, IWeightedGeneList.Entry, IWeightedGeneList.WeightedGeneListFactory -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final doubleThe possibility that we don't generate a random gene but directly return the generated one.Fields inherited from class com.hexagram2021.chromosomelib.registry.SimpleWeightedGeneList
entries, totalWeight, weightPrefixSumsFields inherited from interface com.hexagram2021.chromosomelib.registry.IWeightedGeneList
EMPTY -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedStableWeightedGeneList(double possibilityOfStable, com.google.common.collect.ImmutableList<IWeightedGeneList.Entry> entries) -
Method Summary
Modifier and TypeMethodDescriptionnet.minecraft.core.Holder<Gene>getRandomGene(IWeightedGeneList.Context context) Get a random gene from this list.Create a builder for StableWeightedGeneList.Methods inherited from class com.hexagram2021.chromosomelib.registry.SimpleWeightedGeneList
allGenes, builder, totalWeight
-
Field Details
-
possibilityOfStable
protected final double possibilityOfStableThe possibility that we don't generate a random gene but directly return the generated one.Notice that this is NOT the possibility of homozygotes - it should be
possibilityOfStable + (1 - possibilityOfStable) * p, wherepis the original possibility of choosing two same gene.
-
-
Constructor Details
-
StableWeightedGeneList
protected StableWeightedGeneList(double possibilityOfStable, com.google.common.collect.ImmutableList<IWeightedGeneList.Entry> entries)
-
-
Method Details
-
getRandomGene
Description copied from interface:IWeightedGeneListGet a random gene from this list.- Specified by:
getRandomGenein interfaceIWeightedGeneList- Overrides:
getRandomGenein classSimpleWeightedGeneList- Parameters:
context- the context- Returns:
- a random gene
-
stableBuilder
Create a builder for StableWeightedGeneList.- Returns:
- a builder
-