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.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).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
.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 ofoffset
plus a result fromotherDistribution
.double
getLowerBound()
Gets the lower inclusive bound, which is 0.0.double
getUpperBound()
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 ofoffset
plus a result fromotherDistribution
. Using the offset allows distributions likeGaussianDistribution
to 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
otherDistribution
in range.
-
getLowerBound
Gets the lower inclusive bound, which is 0.0.- Specified by:
getLowerBound
in 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:
getUpperBound
in interfaceIDistribution
- Returns:
- the upper exclusive bound of the distribution, 1.0
-