Package io.github.ai4ci.util
Class ImmutableSimpleDistribution
java.lang.Object
io.github.ai4ci.util.ImmutableSimpleDistribution
- All Implemented Interfaces:
Abstraction.Distribution
,SimpleDistribution
,Serializable
@ParametersAreNonnullByDefault
@Generated("org.immutables.processor.ProxyProcessor")
@Immutable
@CheckReturnValue
public final class ImmutableSimpleDistribution
extends Object
implements SimpleDistribution
Immutable implementation of
SimpleDistribution
.
Use the builder to create immutable instances:
ImmutableSimpleDistribution.builder()
.
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final class
Builds instances of typeImmutableSimpleDistribution
.Nested classes/interfaces inherited from interface io.github.ai4ci.util.SimpleDistribution
SimpleDistribution.Type
-
Field Summary
Fields inherited from interface io.github.ai4ci.abm.mechanics.Abstraction.Distribution
DX, PRECISION
-
Method Summary
Modifier and TypeMethodDescriptionbuilder()
Creates a builder forImmutableSimpleDistribution
.static ImmutableSimpleDistribution
copyOf
(SimpleDistribution instance) Creates an immutable copy of aSimpleDistribution
value.boolean
This instance is equal to all instances ofImmutableSimpleDistribution
that have equal attribute values.double
double
double[]
getType()
int
hashCode()
Computes a hash code from attributes:type
,central
,dispersion
,samples
,median
.Creates a builder forImmutableSimpleDistribution
.prefilled with attibute values ofthis
instance to easily create modified copies.toString()
Prints the immutable valueSimpleDistribution
with attribute values.withCentral
(double value) Copy the current immutable object by setting a value for thecentral
attribute.withDispersion
(Double value) Copy the current immutable object by setting a value for thedispersion
attribute.withType
(SimpleDistribution.Type value) Copy the current immutable object by setting a value for thetype
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, transform, transform, transform
Methods inherited from interface io.github.ai4ci.util.SimpleDistribution
getCumulative, sample, sample
-
Method Details
-
getType
- Specified by:
getType
in interfaceSimpleDistribution
- Returns:
- The value of the
type
attribute
-
getCentral
public double getCentral()- Specified by:
getCentral
in interfaceAbstraction.Distribution
- Specified by:
getCentral
in interfaceSimpleDistribution
- Returns:
- The value of the
central
attribute
-
getDispersion
- Specified by:
getDispersion
in interfaceSimpleDistribution
- Returns:
- The value of the
dispersion
attribute
-
getSamples
public double[] getSamples()- Specified by:
getSamples
in interfaceSimpleDistribution
- Returns:
- The computed-at-construction value of the
samples
attribute
-
getMedian
public double getMedian()- Specified by:
getMedian
in interfaceAbstraction.Distribution
- Specified by:
getMedian
in interfaceSimpleDistribution
- Returns:
- The computed-at-construction value of the
median
attribute
-
withType
Copy the current immutable object by setting a value for thetype
attribute. A value equality check is used to prevent copying of the same value by returningthis
.- Parameters:
value
- A new value for type- Returns:
- A modified copy of the
this
object
-
withCentral
Copy the current immutable object by setting a value for thecentral
attribute. A value strict bits equality used to prevent copying of the same value by returningthis
.- Parameters:
value
- A new value for central- Returns:
- A modified copy of the
this
object
-
withDispersion
Copy the current immutable object by setting a value for thedispersion
attribute. An equals check used to prevent copying of the same value by returningthis
.- Parameters:
value
- A new value for dispersion (can benull
)- Returns:
- A modified copy of the
this
object
-
equals
This instance is equal to all instances ofImmutableSimpleDistribution
that have equal attribute values. -
hashCode
public int hashCode()Computes a hash code from attributes:type
,central
,dispersion
,samples
,median
. -
toString
Prints the immutable valueSimpleDistribution
with attribute values. -
copyOf
Creates an immutable copy of aSimpleDistribution
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 SimpleDistribution instance
-
toBuilder
Creates a builder forImmutableSimpleDistribution
.prefilled with attibute values ofthis
instance to easily create modified copies.- Returns:
- A new ImmutableSimpleDistribution builder with attributes of
this
instance
-
builder
Creates a builder forImmutableSimpleDistribution
.ImmutableSimpleDistribution.builder() .setType(io.github.ai4ci.util.SimpleDistribution.Type) // required
type
.setCentral(double) // requiredcentral
.setDispersion(Double | null) // nullabledispersion
.build();- Returns:
- A new ImmutableSimpleDistribution builder
-