Package io.github.ai4ci.util
Class ImmutableHistogramDistribution
java.lang.Object
io.github.ai4ci.util.ImmutableHistogramDistribution
- All Implemented Interfaces:
Abstraction.Distribution
,HistogramDistribution
,Serializable
@ParametersAreNonnullByDefault
@Generated("org.immutables.processor.ProxyProcessor")
@Immutable
@CheckReturnValue
public final class ImmutableHistogramDistribution
extends Object
implements HistogramDistribution
Immutable implementation of
HistogramDistribution
.
Use the builder to create immutable instances:
ImmutableHistogramDistribution.builder()
.
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final class
Builds instances of typeImmutableHistogramDistribution
. -
Field Summary
Fields inherited from interface io.github.ai4ci.abm.mechanics.Abstraction.Distribution
DX, PRECISION
-
Method Summary
Modifier and TypeMethodDescriptionbuilder()
Creates a builder forImmutableHistogramDistribution
.copyOf
(HistogramDistribution instance) Creates an immutable copy of aHistogramDistribution
value.boolean
This instance is equal to all instances ofImmutableHistogramDistribution
that have equal attribute values.double
double
getMax()
double
getMin()
double[]
double[]
getX()
int
hashCode()
Computes a hash code from attributes:samples
,x
,min
,max
.Creates a builder forImmutableHistogramDistribution
.prefilled with attibute values ofthis
instance to easily create modified copies.toString()
Prints the immutable valueHistogramDistribution
with attribute values.withSamples
(double... elements) Copy the current immutable object with elements that replace the content ofsamples
.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, sample, transform, transform, transform
Methods inherited from interface io.github.ai4ci.util.HistogramDistribution
getCumulative, getDensity, getMedian, getQuantile, sample
-
Method Details
-
getSamples
public double[] getSamples()- Specified by:
getSamples
in interfaceHistogramDistribution
- Returns:
- A cloned
samples
array
-
getX
public double[] getX()- Specified by:
getX
in interfaceHistogramDistribution
- Returns:
- The computed-at-construction value of the
x
attribute
-
getMin
public double getMin()- Specified by:
getMin
in interfaceHistogramDistribution
- Returns:
- The computed-at-construction value of the
min
attribute
-
getMax
public double getMax()- Specified by:
getMax
in interfaceHistogramDistribution
- Returns:
- The computed-at-construction value of the
max
attribute
-
withSamples
Copy the current immutable object with elements that replace the content ofsamples
. The array is cloned before being saved as attribute values.- Parameters:
elements
- The non-null elements for samples- Returns:
- A modified copy of
this
object
-
equals
This instance is equal to all instances ofImmutableHistogramDistribution
that have equal attribute values. -
hashCode
public int hashCode()Computes a hash code from attributes:samples
,x
,min
,max
. -
toString
Prints the immutable valueHistogramDistribution
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 interfaceHistogramDistribution
- Returns:
- A lazily initialized value of the
central
attribute
-
copyOf
Creates an immutable copy of aHistogramDistribution
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 HistogramDistribution instance
-
toBuilder
Creates a builder forImmutableHistogramDistribution
.prefilled with attibute values ofthis
instance to easily create modified copies.- Returns:
- A new ImmutableHistogramDistribution builder with attributes of
this
instance
-
builder
Creates a builder forImmutableHistogramDistribution
.ImmutableHistogramDistribution.builder() .setSamples(double) // required
samples
.build();- Returns:
- A new ImmutableHistogramDistribution builder
-