Class Vector2L

java.lang.Object
com.io7m.jtensors.core.unparameterized.vectors.Vector2L
All Implemented Interfaces:
Vector2LType, VectorReadable2LType, VectorComputationalType

public final class Vector2L extends Object implements Vector2LType
The type of 2D long-typed vectors.
  • Method Details

    • x

      public long x()
      Specified by:
      x in interface Vector2LType
      Specified by:
      x in interface VectorReadable2LType
      Returns:
      The value of the x attribute
    • y

      public long y()
      Specified by:
      y in interface Vector2LType
      Specified by:
      y in interface VectorReadable2LType
      Returns:
      The value of the y attribute
    • withX

      public final Vector2L withX(long value)
      Copy the current immutable object by setting a value for the x attribute. A value equality check is used to prevent copying of the same value by returning this.
      Parameters:
      value - A new value for x
      Returns:
      A modified copy or the this object
    • withY

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

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

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

      public static Vector2L of(long x, long y)
      Construct a new immutable Vector2L instance.
      Parameters:
      x - The value for the x attribute
      y - The value for the y attribute
      Returns:
      An immutable Vector2L instance
    • copyOf

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

      public static Vector2L.Builder builder()
      Creates a builder for Vector2L.
      Vector2L.builder()
         .setX(long) // required x
         .setY(long) // required y
         .build();
      
      Returns:
      A new Vector2L builder