Class ImmutableExposure

java.lang.Object
io.github.ai4ci.abm.ImmutableExposure
All Implemented Interfaces:
Exposure

@ParametersAreNonnullByDefault @Generated("org.immutables.processor.ProxyProcessor") @Immutable @CheckReturnValue public final class ImmutableExposure extends Object implements Exposure
Immutable implementation of Exposure.

Use the builder to create immutable instances: ImmutableExposure.builder().

  • Method Details

    • getExposure

      public double getExposure()
      Specified by:
      getExposure in interface Exposure
      Returns:
      The value of the exposure attribute
    • getExposerId

      public int getExposerId()
      Specified by:
      getExposerId in interface Exposure
      Returns:
      The value of the exposerId attribute
    • withExposure

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

      public final ImmutableExposure withExposerId(int value)
      Copy the current immutable object by setting a value for the exposerId attribute. A value equality check is used to prevent copying of the same value by returning this.
      Parameters:
      value - A new value for exposerId
      Returns:
      A modified copy of the this object
    • equals

      public boolean equals(@Nullable Object another)
      This instance is equal to all instances of ImmutableExposure 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: exposure, exposerId.
      Overrides:
      hashCode in class Object
      Returns:
      hashCode value
    • toString

      public String toString()
      Prints the immutable value Exposure with attribute values.
      Overrides:
      toString in class Object
      Returns:
      A string representation of the value
    • copyOf

      public static ImmutableExposure copyOf(Exposure instance)
      Creates an immutable copy of a Exposure 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 Exposure instance
    • toBuilder

      public ImmutableExposure.Builder toBuilder()
      Creates a builder for ImmutableExposure.prefilled with attibute values of this instance to easily create modified copies.
      Returns:
      A new ImmutableExposure builder with attributes of this instance
    • builder

      public static ImmutableExposure.Builder builder()
      Creates a builder for ImmutableExposure.
       ImmutableExposure.builder()
          .setExposure(double) // required exposure
          .setExposerId(int) // required exposerId
          .build();
       
      Returns:
      A new ImmutableExposure builder