java.lang.Object
com.github.stephengold.joltjni.UVec4
All Implemented Interfaces:
UVec4Arg

public final class UVec4 extends Object implements UVec4Arg
A vector composed of 4 unsigned integer components.
  • Constructor Summary

    Constructors
    Constructor
    Description
    Instantiate an all-zero vector (0,0,0,0).
    UVec4(int x, int y, int z, int w)
    Instantiate a vector with specified components.
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    equals(Object other)
    Tests for exact equality with the argument.
    int
    Return the 4th (W) component.
    int
    Return the first (X) component.
    int
    Return the 2nd (Y) component.
    int
    Return the 3rd (Z) component.
    int
    Return a hash code.
    void
    set(int x, int y, int z, int w)
    Set all 4 components to specified values.
    void
    setW(int w)
    Alter the 4th (W) component.
    void
    setX(int x)
    Alter the first (X) component.
    void
    setY(int y)
    Alter the 2nd (Y) component.
    void
    setZ(int z)
    Alter the 3rd (Z) component.
    Return a string representation of the vector, which is unaffected.

    Methods inherited from class java.lang.Object

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

    • UVec4

      public UVec4()
      Instantiate an all-zero vector (0,0,0,0).
    • UVec4

      public UVec4(int x, int y, int z, int w)
      Instantiate a vector with specified components.
      Parameters:
      x - the desired X component
      y - the desired Y component
      z - the desired Z component
      w - the desired W component
  • Method Details

    • set

      public void set(int x, int y, int z, int w)
      Set all 4 components to specified values.
      Parameters:
      x - the desired X component
      y - the desired Y component
      z - the desired Z component
      w - the desired W component
    • setW

      public void setW(int w)
      Alter the 4th (W) component.
      Parameters:
      w - the desired value
    • setX

      public void setX(int x)
      Alter the first (X) component.
      Parameters:
      x - the desired value
    • setY

      public void setY(int y)
      Alter the 2nd (Y) component.
      Parameters:
      y - the desired value
    • setZ

      public void setZ(int z)
      Alter the 3rd (Z) component.
      Parameters:
      z - the desired value
    • getW

      public int getW()
      Return the 4th (W) component. The vector is unaffected.
      Specified by:
      getW in interface UVec4Arg
      Returns:
      the component value
    • getX

      public int getX()
      Return the first (X) component. The vector is unaffected.
      Specified by:
      getX in interface UVec4Arg
      Returns:
      the component value
    • getY

      public int getY()
      Return the 2nd (Y) component. The vector is unaffected.
      Specified by:
      getY in interface UVec4Arg
      Returns:
      the component value
    • getZ

      public int getZ()
      Return the 3rd (Z) component. The vector is unaffected.
      Specified by:
      getZ in interface UVec4Arg
      Returns:
      the component value
    • equals

      public boolean equals(Object other)
      Tests for exact equality with the argument. If other is null, false is returned. Either way, the current instance is unaffected.
      Overrides:
      equals in class Object
      Parameters:
      other - the object to compare (unaffected) or null
      Returns:
      true if this and other have identical values, otherwise false
    • hashCode

      public int hashCode()
      Return a hash code. If two vectors have identical values, they will have the same hash code. The vector is unaffected.
      Overrides:
      hashCode in class Object
      Returns:
      a 32-bit value for use in hashing
    • toString

      public String toString()
      Return a string representation of the vector, which is unaffected. For example, a zero vector is represented by:
       UVec4(0 0 0 0)
       
      Overrides:
      toString in class Object
      Returns:
      the string representation (not null, not empty)