Package squidpony.squidmath
Class IDistribution.SimpleDistribution
java.lang.Object
squidpony.squidmath.IDistribution.SimpleDistribution
- All Implemented Interfaces:
IDistribution
- Direct Known Subclasses:
BathtubDistribution,CurvedBoundedDistribution,SpikeDistribution.SimpleSpikeDistribution
- Enclosing interface:
- IDistribution
public abstract static class IDistribution.SimpleDistribution extends Object implements IDistribution
-
Nested Class Summary
Nested classes/interfaces inherited from interface squidpony.squidmath.IDistribution
IDistribution.SimpleDistribution -
Constructor Summary
Constructors Constructor Description SimpleDistribution() -
Method Summary
Modifier and Type Method Description static IDistribution.SimpleDistributionclampedDistribution(IDistribution otherDistribution)Makes a new SimpleDistribution implementation given any IDistribution (typically one with large or infinite bounds) by simply clamping results that are below 0 to 0 and at least 1 to 0.9999999999999999 (the largest double less than 1.0 than can be represented).static IDistribution.SimpleDistributionfractionalDistribution(IDistribution otherDistribution)Makes a new SimpleDistribution implementation given any IDistribution (typically one with large or infinite bounds) by getting the fractional component of a result fromotherDistribution.static IDistribution.SimpleDistributionfractionalOffsetDistribution(IDistribution otherDistribution, double offset)Makes a new SimpleDistribution implementation given any IDistribution (typically one with large or infinite bounds) by getting the fractional component ofoffsetplus a result fromotherDistribution.doublegetLowerBound()Gets the lower inclusive bound, which is 0.0.doublegetUpperBound()Gets the upper exclusive bound of the distribution, which is 1.0.
-
Constructor Details
-
SimpleDistribution
public SimpleDistribution()
-
-
Method Details
-
fractionalDistribution
public static IDistribution.SimpleDistribution fractionalDistribution(IDistribution otherDistribution)Makes a new SimpleDistribution implementation given any IDistribution (typically one with large or infinite bounds) by getting the fractional component of a result fromotherDistribution.- Parameters:
otherDistribution- any other IDistribution- Returns:
- a new anonymous implementation of SimpleDistribution that gets the fractional part of
otherDistribution.
-
fractionalOffsetDistribution
public static IDistribution.SimpleDistribution fractionalOffsetDistribution(IDistribution otherDistribution, double offset)Makes a new SimpleDistribution implementation given any IDistribution (typically one with large or infinite bounds) by getting the fractional component ofoffsetplus a result fromotherDistribution. Using the offset allows distributions likeGaussianDistributionto become centered halfway on 0.5, making the result of this distribution have a Gaussian-like peak on 0.5 instead of of peaking at the bounds when offset is 0.0.- Parameters:
otherDistribution- any other IDistribution- Returns:
- a new anonymous implementation of SimpleDistribution that gets the fractional part of
otherDistribution.
-
clampedDistribution
public static IDistribution.SimpleDistribution clampedDistribution(IDistribution otherDistribution)Makes a new SimpleDistribution implementation given any IDistribution (typically one with large or infinite bounds) by simply clamping results that are below 0 to 0 and at least 1 to 0.9999999999999999 (the largest double less than 1.0 than can be represented). This will behave very oddly for distributions that are centered on 0.0.- Parameters:
otherDistribution- any other IDistribution- Returns:
- a new anonymous implementation of SimpleDistribution that clamps
otherDistributionin range.
-
getLowerBound
Gets the lower inclusive bound, which is 0.0.- Specified by:
getLowerBoundin interfaceIDistribution- Returns:
- the lower inclusive bound of the distribution, 0.0
-
getUpperBound
Gets the upper exclusive bound of the distribution, which is 1.0.- Specified by:
getUpperBoundin interfaceIDistribution- Returns:
- the upper exclusive bound of the distribution, 1.0
-