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:
  • Method Details

    • getProfile

      public double[] getProfile()
      Specified by:
      getProfile in class DelayDistribution
      Returns:
      A cloned profile array
    • total

      public double total()
      Overrides:
      total in class DelayDistribution
      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 class DelayDistribution
    • density

      public double[] density()
      the improper probability density - which will sum to pAffected
      Overrides:
      density in class DelayDistribution
    • condDensity

      public double[] condDensity()
      the conditional probability density - which will sum to 1
      Overrides:
      condDensity in class DelayDistribution
    • survival

      public double[] survival()
      the unconditional survival function
      Overrides:
      survival in class DelayDistribution
    • 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 class DelayDistribution
    • withProfile

      public final ImmutableDelayDistribution withProfile(double... elements)
      Copy the current immutable object with elements that replace the content of profile. 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

      public final ImmutableDelayDistribution withPAffected(double value)
      Copy the current immutable object by setting a value for the pAffected attribute. A value strict bits equality used to prevent copying of the same value by returning this.
      Parameters:
      value - A new value for pAffected
      Returns:
      A modified copy of the this object
    • equals

      public boolean equals(@Nullable Object another)
      This instance is equal to all instances of ImmutableDelayDistribution that have equal attribute values.
      Overrides:
      equals in class Object
      Returns:
      true if this is equal to another instance
    • hashCode

      public int hashCode()
      Computes a hash code from attributes: profile, total, pAffected, density, condDensity, survival, hazard.
      Overrides:
      hashCode in class Object
      Returns:
      hashCode value
    • copyOf

      public static ImmutableDelayDistribution copyOf(DelayDistribution instance)
      Creates an immutable copy of a DelayDistribution 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 for ImmutableDelayDistribution.prefilled with attibute values of this instance to easily create modified copies.
      Returns:
      A new ImmutableDelayDistribution builder with attributes of this instance
    • builder

      public static ImmutableDelayDistribution.Builder builder()
      Creates a builder for ImmutableDelayDistribution.
       ImmutableDelayDistribution.builder()
          .setProfile(double) // required profile
          .setPAffected(double) // optional pAffected
          .build();
       
      Returns:
      A new ImmutableDelayDistribution builder