Package software.kes.kraftwerk.weights
Class MaybeWeights
- java.lang.Object
-
- software.kes.kraftwerk.weights.MaybeWeights
-
public final class MaybeWeights extends java.lang.ObjectA pair of weights that express the frequencies ofjusts vs.nothings in the context of generatingMaybevalues.Either the
justweight or thenothingweight can be zero; however, the sum of the weights will always be >= 1.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classMaybeWeights.MaybeWeightsBuilderJustsA partially constructedMaybeWeights, with thejustweight already provided.static classMaybeWeights.MaybeWeightsBuilderNothingsA partially constructedMaybeWeights, with thenothingweight already provided.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanequals(java.lang.Object o)intgetJustWeight()intgetNothingWeight()BinaryWeightsgetWeights()inthashCode()static MaybeWeights.MaybeWeightsBuilderJustsjusts(int weight)Partially constructs aMaybeWeightswith thejustweight.static MaybeWeightsmaybeWeights(int nothingWeight, int justWeight)Creates aMaybeWeights.static MaybeWeights.MaybeWeightsBuilderNothingsnothings(int weight)Partially constructs aMaybeWeightswith thenothingweight.java.lang.StringtoString()
-
-
-
Method Detail
-
justs
public static MaybeWeights.MaybeWeightsBuilderJusts justs(int weight)
Partially constructs aMaybeWeightswith thejustweight.- Parameters:
weight- the weight forjusts; must be >= 0- Returns:
- a
MaybeWeights.MaybeWeightsBuilderJusts
-
nothings
public static MaybeWeights.MaybeWeightsBuilderNothings nothings(int weight)
Partially constructs aMaybeWeightswith thenothingweight.- Parameters:
weight- the weight fornothings; must be >= 0- Returns:
- a
MaybeWeights.MaybeWeightsBuilderNothings
-
maybeWeights
public static MaybeWeights maybeWeights(int nothingWeight, int justWeight)
Creates aMaybeWeights. The sum of the weights for both choices must be >= 1.- Parameters:
nothingWeight- the weight fornothings; must be >= 0justWeight- the weight forjusts; must be >= 0- Returns:
- a
MaybeWeights
-
getNothingWeight
public int getNothingWeight()
-
getJustWeight
public int getJustWeight()
-
getWeights
public BinaryWeights getWeights()
-
equals
public boolean equals(java.lang.Object o)
- Overrides:
equalsin classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-