Class Vector4I

java.lang.Object
com.io7m.jtensors.core.unparameterized.vectors.Vector4I
All Implemented Interfaces:
Vector4IType, VectorReadable2IType, VectorReadable3IType, VectorReadable4IType, VectorComputationalType

public final class Vector4I extends Object implements Vector4IType
The type of 4D int-typed vectors.
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static final class 
    Builds instances of type Vector4I.
  • Method Summary

    Modifier and Type
    Method
    Description
    Creates a builder for Vector4I.
    static Vector4I
    copyOf(Vector4IType instance)
    Creates an immutable copy of a Vector4IType value.
    boolean
    equals(Object another)
    This instance is equal to all instances of Vector4I that have equal attribute values.
    int
    Computes a hash code from attributes: x, y, z, w.
    static Vector4I
    of(int x, int y, int z, int w)
    Construct a new immutable Vector4I instance.
    Prints the immutable value Vector4I with attribute values.
    int
    w()
     
    final Vector4I
    withW(int value)
    Copy the current immutable object by setting a value for the w attribute.
    final Vector4I
    withX(int value)
    Copy the current immutable object by setting a value for the x attribute.
    final Vector4I
    withY(int value)
    Copy the current immutable object by setting a value for the y attribute.
    final Vector4I
    withZ(int value)
    Copy the current immutable object by setting a value for the z attribute.
    int
    x()
     
    int
    y()
     
    int
    z()
     

    Methods inherited from class Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Method Details

    • x

      public int x()
      Specified by:
      x in interface Vector4IType
      Specified by:
      x in interface VectorReadable2IType
      Returns:
      The value of the x attribute
    • y

      public int y()
      Specified by:
      y in interface Vector4IType
      Specified by:
      y in interface VectorReadable2IType
      Returns:
      The value of the y attribute
    • z

      public int z()
      Specified by:
      z in interface Vector4IType
      Specified by:
      z in interface VectorReadable3IType
      Returns:
      The value of the z attribute
    • w

      public int w()
      Specified by:
      w in interface Vector4IType
      Specified by:
      w in interface VectorReadable4IType
      Returns:
      The value of the w attribute
    • withX

      public final Vector4I withX(int 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 Vector4I withY(int 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
    • withZ

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

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

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

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

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

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

      public static Vector4I.Builder builder()
      Creates a builder for Vector4I.
      Vector4I.builder()
         .setX(int) // required x
         .setY(int) // required y
         .setZ(int) // required z
         .setW(int) // required w
         .build();
      
      Returns:
      A new Vector4I builder