Class ImmutableAngle

java.lang.Object
pl.poznan.put.circular.Angle
pl.poznan.put.circular.ImmutableAngle
All Implemented Interfaces:
Comparable<Angle>

@ParametersAreNonnullByDefault @Generated("org.immutables.processor.ProxyProcessor") @Immutable public final class ImmutableAngle extends Angle
Immutable implementation of Angle.

Use the builder to create immutable instances: ImmutableAngle.builder(). Use the static factory method to create immutable instances: ImmutableAngle.of().

  • Method Details

    • radians

      public double radians()
      Specified by:
      radians in class Angle
      Returns:
      Value in radians in range (-pi; pi].
    • withRadians

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

      public int hashCode()
      Computes a hash code from attributes: radians.
      Overrides:
      hashCode in class Object
      Returns:
      hashCode value
    • of

      public static ImmutableAngle of(double radians)
      Construct a new immutable Angle instance.
      Parameters:
      radians - The value for the radians attribute
      Returns:
      An immutable Angle instance
    • copyOf

      public static ImmutableAngle copyOf(Angle instance)
      Creates an immutable copy of a Angle 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 Angle instance
    • builder

      public static ImmutableAngle.Builder builder()
      Creates a builder for ImmutableAngle.
       ImmutableAngle.builder()
          .radians(double) // required radians
          .build();
       
      Returns:
      A new ImmutableAngle builder