Package io.github.ai4ci.util
Class ImmutableResampledDistribution
java.lang.Object
io.github.ai4ci.util.ImmutableResampledDistribution
- All Implemented Interfaces:
Abstraction.Distribution
,ResampledDistribution
,Serializable
@ParametersAreNonnullByDefault
@Generated("org.immutables.processor.ProxyProcessor")
@Immutable
@CheckReturnValue
public final class ImmutableResampledDistribution
extends Object
implements ResampledDistribution
Immutable implementation of
ResampledDistribution
.
Use the builder to create immutable instances:
ImmutableResampledDistribution.builder()
.
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final class
Builds instances of typeImmutableResampledDistribution
. -
Field Summary
Fields inherited from interface io.github.ai4ci.abm.mechanics.Abstraction.Distribution
DX
Fields inherited from interface io.github.ai4ci.util.ResampledDistribution
KNOTS, PRECISION
-
Method Summary
Modifier and TypeMethodDescriptionbuilder()
Creates a builder forImmutableResampledDistribution
.copyOf
(ResampledDistribution instance) Creates an immutable copy of aResampledDistribution
value.boolean
This instance is equal to all instances ofImmutableResampledDistribution
that have equal attribute values.double
getFirst()
double
double[]
int
hashCode()
Computes a hash code from attributes:first
,second
,combiner
,samples
,central
,median
.Creates a builder forImmutableResampledDistribution
.prefilled with attibute values ofthis
instance to easily create modified copies.toString()
Prints the immutable valueResampledDistribution
with attribute values.Copy the current immutable object by setting a value for thecombiner
attribute.Copy the current immutable object by setting a value for thefirst
attribute.Copy the current immutable object by setting a value for thesecond
attribute.Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface io.github.ai4ci.abm.mechanics.Abstraction.Distribution
combine, getDensity, sample, transform, transform, transform
Methods inherited from interface io.github.ai4ci.util.ResampledDistribution
getCumulative, sample
-
Method Details
-
getFirst
- Specified by:
getFirst
in interfaceResampledDistribution
- Returns:
- The value of the
first
attribute
-
getSecond
- Specified by:
getSecond
in interfaceResampledDistribution
- Returns:
- The value of the
second
attribute
-
getCombiner
- Specified by:
getCombiner
in interfaceResampledDistribution
- Returns:
- The value of the
combiner
attribute
-
getSamples
public double[] getSamples()- Specified by:
getSamples
in interfaceResampledDistribution
- Returns:
- The computed-at-construction value of the
samples
attribute
-
getCentral
public double getCentral()- Specified by:
getCentral
in interfaceAbstraction.Distribution
- Specified by:
getCentral
in interfaceResampledDistribution
- Returns:
- The computed-at-construction value of the
central
attribute
-
getMedian
public double getMedian()- Specified by:
getMedian
in interfaceAbstraction.Distribution
- Specified by:
getMedian
in interfaceResampledDistribution
- Returns:
- The computed-at-construction value of the
median
attribute
-
withFirst
Copy the current immutable object by setting a value for thefirst
attribute. A shallow reference equality check is used to prevent copying of the same value by returningthis
.- Parameters:
value
- A new value for first- Returns:
- A modified copy of the
this
object
-
withSecond
Copy the current immutable object by setting a value for thesecond
attribute. A shallow reference equality check is used to prevent copying of the same value by returningthis
.- Parameters:
value
- A new value for second- Returns:
- A modified copy of the
this
object
-
withCombiner
public final ImmutableResampledDistribution withCombiner(ModelOperation.BiFunction<Double, Double, Double> value) Copy the current immutable object by setting a value for thecombiner
attribute. A shallow reference equality check is used to prevent copying of the same value by returningthis
.- Parameters:
value
- A new value for combiner- Returns:
- A modified copy of the
this
object
-
equals
This instance is equal to all instances ofImmutableResampledDistribution
that have equal attribute values. -
hashCode
public int hashCode()Computes a hash code from attributes:first
,second
,combiner
,samples
,central
,median
. -
toString
Prints the immutable valueResampledDistribution
with attribute values. -
getInterpolation
Returns a lazily initialized value of the
interpolation
attribute. Initialized once and only once and stored for subsequent access with proper synchronization. In case of any exception or error thrown by the lazy value initializer, the result will not be memoised (i.e. remembered) and on next call computation will be attempted again.- Specified by:
getInterpolation
in interfaceResampledDistribution
- Returns:
- A lazily initialized value of the
interpolation
attribute
-
copyOf
Creates an immutable copy of aResampledDistribution
value. Uses accessors to get values to initialize the new immutable instance. If an instance is already immutable, it is returned as is.- Parameters:
instance
- The instance to copy- Returns:
- A copied immutable ResampledDistribution instance
-
toBuilder
Creates a builder forImmutableResampledDistribution
.prefilled with attibute values ofthis
instance to easily create modified copies.- Returns:
- A new ImmutableResampledDistribution builder with attributes of
this
instance
-
builder
Creates a builder forImmutableResampledDistribution
.ImmutableResampledDistribution.builder() .setFirst(io.github.ai4ci.abm.mechanics.Abstraction.Distribution) // required
first
.setSecond(io.github.ai4ci.abm.mechanics.Abstraction.Distribution) // requiredsecond
.setCombiner(io.github.ai4ci.abm.mechanics.ModelOperation.BiFunction<Double, Double, Double>) // requiredcombiner
.build();- Returns:
- A new ImmutableResampledDistribution builder
-