Class PVector2D.Builder<T>

java.lang.Object
com.io7m.jtensors.core.parameterized.vectors.PVector2D.Builder<T>
Enclosing class:
PVector2D<T>

public static final class PVector2D.Builder<T> extends Object
Builds instances of type PVector2D. Initialize attributes and then invoke the build() method to create an immutable instance.

Builder is not thread-safe and generally should not be stored in a field or collection, but instead used immediately to create instances.

  • Method Details

    • from

      public final PVector2D.Builder<T> from(PVector2DType<T> instance)
      Fill a builder with attribute values from the provided com.io7m.jtensors.core.parameterized.vectors.PVector2DType instance.
      Parameters:
      instance - The instance from which to copy values
      Returns:
      this builder for use in a chained invocation
    • from

      public final PVector2D.Builder<T> from(VectorReadable2DType instance)
      Fill a builder with attribute values from the provided com.io7m.jtensors.core.unparameterized.vectors.VectorReadable2DType instance.
      Parameters:
      instance - The instance from which to copy values
      Returns:
      this builder for use in a chained invocation
    • from

      public final PVector2D.Builder<T> from(PVectorReadable2DType<T> instance)
      Fill a builder with attribute values from the provided com.io7m.jtensors.core.parameterized.vectors.PVectorReadable2DType instance.
      Parameters:
      instance - The instance from which to copy values
      Returns:
      this builder for use in a chained invocation
    • setX

      public final PVector2D.Builder<T> setX(double x)
      Initializes the value for the x attribute.
      Parameters:
      x - The value for x
      Returns:
      this builder for use in a chained invocation
    • setY

      public final PVector2D.Builder<T> setY(double y)
      Initializes the value for the y attribute.
      Parameters:
      y - The value for y
      Returns:
      this builder for use in a chained invocation
    • build

      public PVector2D<T> build()
      Builds a new PVector2D.
      Returns:
      An immutable instance of PVector2D
      Throws:
      IllegalStateException - if any required attributes are missing