Package io.github.ai4ci.util
Class ImmutableEmpiricalDistribution
java.lang.Object
io.github.ai4ci.util.ImmutableEmpiricalDistribution
- All Implemented Interfaces:
Abstraction.Distribution
,EmpiricalDistribution
,Serializable
@ParametersAreNonnullByDefault
@Generated("org.immutables.processor.ProxyProcessor")
@Immutable
@CheckReturnValue
public final class ImmutableEmpiricalDistribution
extends Object
implements EmpiricalDistribution
Immutable implementation of
EmpiricalDistribution
.
Use the builder to create immutable instances:
ImmutableEmpiricalDistribution.builder()
.
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final class
Builds instances of typeImmutableEmpiricalDistribution
. -
Field Summary
Fields inherited from interface io.github.ai4ci.abm.mechanics.Abstraction.Distribution
DX, PRECISION
Fields inherited from interface io.github.ai4ci.util.EmpiricalDistribution
KNOTS
-
Method Summary
Modifier and TypeMethodDescriptionbuilder()
Creates a builder forImmutableEmpiricalDistribution
.copyOf
(EmpiricalDistribution instance) Creates an immutable copy of aEmpiricalDistribution
value.boolean
This instance is equal to all instances ofImmutableEmpiricalDistribution
that have equal attribute values.double
double[]
double
double
double[]
getX()
int
hashCode()
Computes a hash code from attributes:minimum
,maximum
,x
,cumulativeProbability
,quantile
.Creates a builder forImmutableEmpiricalDistribution
.prefilled with attibute values ofthis
instance to easily create modified copies.toString()
Prints the immutable valueEmpiricalDistribution
with attribute values.withCumulativeProbability
(double... elements) Copy the current immutable object with elements that replace the content ofcumulativeProbability
.withMaximum
(double value) Copy the current immutable object by setting a value for themaximum
attribute.withMinimum
(double value) Copy the current immutable object by setting a value for theminimum
attribute.withX
(double... elements) Copy the current immutable object with elements that replace the content ofx
.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, transform, transform, transform
Methods inherited from interface io.github.ai4ci.util.EmpiricalDistribution
getCDF, getCumulative, getDensity, getMedian, getSortedX, getY, sample, sample
-
Method Details
-
getMinimum
public double getMinimum()- Specified by:
getMinimum
in interfaceEmpiricalDistribution
- Returns:
- The value of the
minimum
attribute
-
getMaximum
public double getMaximum()- Specified by:
getMaximum
in interfaceEmpiricalDistribution
- Returns:
- The value of the
maximum
attribute
-
getX
public double[] getX()- Specified by:
getX
in interfaceEmpiricalDistribution
- Returns:
- A cloned
x
array
-
getCumulativeProbability
public double[] getCumulativeProbability()- Specified by:
getCumulativeProbability
in interfaceEmpiricalDistribution
- Returns:
- A cloned
cumulativeProbability
array
-
getQuantile
- Specified by:
getQuantile
in interfaceEmpiricalDistribution
- Returns:
- The computed-at-construction value of the
quantile
attribute
-
withMinimum
Copy the current immutable object by setting a value for theminimum
attribute. A value strict bits equality used to prevent copying of the same value by returningthis
.- Parameters:
value
- A new value for minimum- Returns:
- A modified copy of the
this
object
-
withMaximum
Copy the current immutable object by setting a value for themaximum
attribute. A value strict bits equality used to prevent copying of the same value by returningthis
.- Parameters:
value
- A new value for maximum- Returns:
- A modified copy of the
this
object
-
withX
Copy the current immutable object with elements that replace the content ofx
. The array is cloned before being saved as attribute values.- Parameters:
elements
- The non-null elements for x- Returns:
- A modified copy of
this
object
-
withCumulativeProbability
Copy the current immutable object with elements that replace the content ofcumulativeProbability
. The array is cloned before being saved as attribute values.- Parameters:
elements
- The non-null elements for cumulativeProbability- Returns:
- A modified copy of
this
object
-
equals
This instance is equal to all instances ofImmutableEmpiricalDistribution
that have equal attribute values. -
hashCode
public int hashCode()Computes a hash code from attributes:minimum
,maximum
,x
,cumulativeProbability
,quantile
. -
toString
Prints the immutable valueEmpiricalDistribution
with attribute values. -
getCentral
public double getCentral()Returns a lazily initialized value of the
central
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:
getCentral
in interfaceAbstraction.Distribution
- Specified by:
getCentral
in interfaceEmpiricalDistribution
- Returns:
- A lazily initialized value of the
central
attribute
-
copyOf
Creates an immutable copy of aEmpiricalDistribution
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 EmpiricalDistribution instance
-
toBuilder
Creates a builder forImmutableEmpiricalDistribution
.prefilled with attibute values ofthis
instance to easily create modified copies.- Returns:
- A new ImmutableEmpiricalDistribution builder with attributes of
this
instance
-
builder
Creates a builder forImmutableEmpiricalDistribution
.ImmutableEmpiricalDistribution.builder() .setMinimum(double) // required
minimum
.setMaximum(double) // requiredmaximum
.setX(double) // requiredx
.setCumulativeProbability(double) // requiredcumulativeProbability
.build();- Returns:
- A new ImmutableEmpiricalDistribution builder
-