Package javax.vecmath

Class Tuple4b

java.lang.Object
javax.vecmath.Tuple4b
All Implemented Interfaces:
Serializable, Cloneable
Direct Known Subclasses:
Color4b

public abstract class Tuple4b extends Object implements Serializable, Cloneable
A four byte tuple. Note that Java defines a byte as a signed integer in the range [-128, 127]. However, colors are more typically represented by values in the range [0, 255]. Java 3D recognizes this and, in those cases where Tuple4b is used to represent color, treats the bytes as if the range were [0, 255]---in other words, as if the bytes were unsigned. Values greater than 127 can be assigned to a byte variable using a type cast. For example:
byteVariable = (byte) intValue; // intValue can be > 127
If intValue is greater than 127, then byteVariable will be negative. The correct value will be extracted when it is used (by masking off the upper bits).
See Also:
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    byte
    The fourth value.
    byte
    The first value.
    byte
    The second value.
    byte
    The third value.
  • Constructor Summary

    Constructors
    Constructor
    Description
    Constructs and initializes a Tuple4b to (0,0,0,0).
    Tuple4b(byte[] t)
    Constructs and initializes a Tuple4b from the array of length 4.
    Tuple4b(byte b1, byte b2, byte b3, byte b4)
    Constructs and initializes a Tuple4b from the specified four values.
    Constructs and initializes a Tuple4b from the specified Tuple4b.
  • Method Summary

    Modifier and Type
    Method
    Description
    Creates a new object of the same class as this object.
    boolean
    Returns true if the Object t1 is of type Tuple4b and all of the data members of t1 are equal to the corresponding data members in this Tuple4b.
    boolean
    Returns true if all of the data members of tuple t1 are equal to the corresponding data members in this tuple.
    final void
    get(byte[] b)
    Places the value of the x,y,z,w components of this Tuple4b into the array of length 4.
    final void
    Places the value of the x,y,z,w components of this Tuple4b into the tuple t1.
    final byte
    Get w, the fourth value.
    final byte
    Get x, the first value.
    final byte
    Get y, the second value.
    final byte
    Get z, the third value.
    int
    Returns a hash code value based on the data values in this object.
    final void
    set(byte[] b)
    Sets the value of the data members of this tuple to the value of the array b of length 4.
    final void
    Sets the value of the data members of this tuple to the value of the argument tuple t1.
    final void
    setW(byte w)
    Set w, the fourth value.
    final void
    setX(byte x)
    Set x, the first value.
    final void
    setY(byte y)
    Set y, the second value.
    final void
    setZ(byte z)
    Set z, the third value.
    Returns a string that contains the values of this Tuple4b.

    Methods inherited from class java.lang.Object

    finalize, getClass, notify, notifyAll, wait, wait, wait
  • Field Details

    • x

      public byte x
      The first value.
    • y

      public byte y
      The second value.
    • z

      public byte z
      The third value.
    • w

      public byte w
      The fourth value.
  • Constructor Details

    • Tuple4b

      public Tuple4b(byte b1, byte b2, byte b3, byte b4)
      Constructs and initializes a Tuple4b from the specified four values.
      Parameters:
      b1 - the first value
      b2 - the second value
      b3 - the third value
      b4 - the fourth value
    • Tuple4b

      public Tuple4b(byte[] t)
      Constructs and initializes a Tuple4b from the array of length 4.
      Parameters:
      t - the array of length 4 containing b1 b2 b3 b4 in order
    • Tuple4b

      public Tuple4b(Tuple4b t1)
      Constructs and initializes a Tuple4b from the specified Tuple4b.
      Parameters:
      t1 - the Tuple4b containing the initialization x y z w data
    • Tuple4b

      public Tuple4b()
      Constructs and initializes a Tuple4b to (0,0,0,0).
  • Method Details

    • toString

      public String toString()
      Returns a string that contains the values of this Tuple4b.
      Overrides:
      toString in class Object
      Returns:
      the String representation
    • get

      public final void get(byte[] b)
      Places the value of the x,y,z,w components of this Tuple4b into the array of length 4.
      Parameters:
      b - array of length 4 into which the values are placed
    • get

      public final void get(Tuple4b t1)
      Places the value of the x,y,z,w components of this Tuple4b into the tuple t1.
      Parameters:
      t1 - tuple into which the values are placed
    • set

      public final void set(Tuple4b t1)
      Sets the value of the data members of this tuple to the value of the argument tuple t1.
      Parameters:
      t1 - the source tuple
    • set

      public final void set(byte[] b)
      Sets the value of the data members of this tuple to the value of the array b of length 4.
      Parameters:
      b - the source array of length 4
    • equals

      public boolean equals(Tuple4b t1)
      Returns true if all of the data members of tuple t1 are equal to the corresponding data members in this tuple.
      Parameters:
      t1 - the tuple with which the comparison is made
    • equals

      public boolean equals(Object t1)
      Returns true if the Object t1 is of type Tuple4b and all of the data members of t1 are equal to the corresponding data members in this Tuple4b.
      Overrides:
      equals in class Object
      Parameters:
      t1 - the object with which the comparison is made
    • hashCode

      public int hashCode()
      Returns a hash code value based on the data values in this object. Two different Tuple4b objects with identical data values (i.e., Tuple4b.equals returns true) will return the same hash code value. Two objects with different data members may return the same hash value, although this is not likely.
      Overrides:
      hashCode in class Object
      Returns:
      the integer hash code value
    • clone

      public Object clone()
      Creates a new object of the same class as this object.
      Overrides:
      clone in class Object
      Returns:
      a clone of this instance.
      Throws:
      OutOfMemoryError - if there is not enough memory.
      Since:
      vecmath 1.3
      See Also:
    • getX

      public final byte getX()
      Get x, the first value.
      Returns:
      Returns x, the first value.
      Since:
      vecmath 1.5
    • setX

      public final void setX(byte x)
      Set x, the first value.
      Parameters:
      x - the first value.
      Since:
      vecmath 1.5
    • getY

      public final byte getY()
      Get y, the second value.
      Returns:
      Returns y, the second value.
      Since:
      vecmath 1.5
    • setY

      public final void setY(byte y)
      Set y, the second value.
      Parameters:
      y - the second value.
      Since:
      vecmath 1.5
    • getZ

      public final byte getZ()
      Get z, the third value.
      Returns:
      Returns z, the third value.
      Since:
      vecmath 1.5
    • setZ

      public final void setZ(byte z)
      Set z, the third value.
      Parameters:
      z - the third value.
      Since:
      vecmath 1.5
    • getW

      public final byte getW()
      Get w, the fourth value.
      Returns:
      Returns w - the fourth value.
      Since:
      vecmath 1.5
    • setW

      public final void setW(byte w)
      Set w, the fourth value.
      Parameters:
      w - the fourth value.
      Since:
      vecmath 1.5