Package io.github.ai4ci.util
Class ImmutableDelayDistribution
java.lang.Object
io.github.ai4ci.util.DelayDistribution
io.github.ai4ci.util.ImmutableDelayDistribution
- All Implemented Interfaces:
Serializable
@ParametersAreNonnullByDefault
@Generated("org.immutables.processor.ProxyProcessor")
@Immutable
@CheckReturnValue
public final class ImmutableDelayDistribution
extends DelayDistribution
Immutable implementation of
DelayDistribution
.
Use the builder to create immutable instances:
ImmutableDelayDistribution.builder()
.
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final class
Builds instances of typeImmutableDelayDistribution
. -
Method Summary
Modifier and TypeMethodDescriptionbuilder()
Creates a builder forImmutableDelayDistribution
.double[]
the conditional probability density - which will sum to 1static ImmutableDelayDistribution
copyOf
(DelayDistribution instance) Creates an immutable copy of aDelayDistribution
value.double[]
density()
the improper probability density - which will sum to pAffectedboolean
This instance is equal to all instances ofImmutableDelayDistribution
that have equal attribute values.double
The probability of being affected at time infinity (1-survival_Inf)double[]
int
hashCode()
Computes a hash code from attributes:profile
,total
,pAffected
,density
,condDensity
,survival
,hazard
.double[]
hazard()
the unconditional hazard function.double[]
survival()
the unconditional survival functionCreates a builder forImmutableDelayDistribution
.prefilled with attibute values ofthis
instance to easily create modified copies.double
total()
withPAffected
(double value) Copy the current immutable object by setting a value for thepAffected
attribute.withProfile
(double... elements) Copy the current immutable object with elements that replace the content ofprofile
.Methods inherited from class io.github.ai4ci.util.DelayDistribution
affected, condDensity, conditionedOn, convolveDensity, convolveProfile, cumulative, density, discretisedGamma, discretisedGamma, empty, expected, expected, getQuantile, hazard, profile, size, toString, totalHazard, unnormalised
-
Method Details
-
getProfile
public double[] getProfile()- Specified by:
getProfile
in classDelayDistribution
- Returns:
- A cloned
profile
array
-
total
public double total()- Overrides:
total
in classDelayDistribution
- Returns:
- The computed-at-construction value of the
total
attribute
-
getPAffected
public double getPAffected()The probability of being affected at time infinity (1-survival_Inf)- Overrides:
getPAffected
in classDelayDistribution
-
density
public double[] density()the improper probability density - which will sum to pAffected- Overrides:
density
in classDelayDistribution
-
condDensity
public double[] condDensity()the conditional probability density - which will sum to 1- Overrides:
condDensity
in classDelayDistribution
-
survival
public double[] survival()the unconditional survival function- Overrides:
survival
in classDelayDistribution
-
hazard
public double[] hazard()the unconditional hazard function. If the affected total (i.e. the hazard at time=infinity) is known then what is the hazard on each day and this is the density on that day divided by the number that survived to that day.- Overrides:
hazard
in classDelayDistribution
-
withProfile
Copy the current immutable object with elements that replace the content ofprofile
. The array is cloned before being saved as attribute values.- Parameters:
elements
- The non-null elements for profile- Returns:
- A modified copy of
this
object
-
withPAffected
Copy the current immutable object by setting a value for thepAffected
attribute. A value strict bits equality used to prevent copying of the same value by returningthis
.- Parameters:
value
- A new value for pAffected- Returns:
- A modified copy of the
this
object
-
equals
This instance is equal to all instances ofImmutableDelayDistribution
that have equal attribute values. -
hashCode
public int hashCode()Computes a hash code from attributes:profile
,total
,pAffected
,density
,condDensity
,survival
,hazard
. -
copyOf
Creates an immutable copy of aDelayDistribution
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 DelayDistribution instance
-
toBuilder
Creates a builder forImmutableDelayDistribution
.prefilled with attibute values ofthis
instance to easily create modified copies.- Returns:
- A new ImmutableDelayDistribution builder with attributes of
this
instance
-
builder
Creates a builder forImmutableDelayDistribution
.ImmutableDelayDistribution.builder() .setProfile(double) // required
profile
.setPAffected(double) // optionalpAffected
.build();- Returns:
- A new ImmutableDelayDistribution builder
-