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 java.lang.Object implements Vector4IType
The type of 4D
int
-typed vectors.-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
Vector4I.Builder
Builds instances of typeVector4I
. -
Method Summary
Modifier and Type Method Description static Vector4I.Builder
builder()
Creates a builder forVector4I
.static Vector4I
copyOf(Vector4IType instance)
Creates an immutable copy of aVector4IType
value.boolean
equals(java.lang.Object another)
This instance is equal to all instances ofVector4I
that have equal attribute values.int
hashCode()
Computes a hash code from attributes:x
,y
,z
,w
.static Vector4I
of(int x, int y, int z, int w)
Construct a new immutableVector4I
instance.java.lang.String
toString()
Prints the immutable valueVector4I
with attribute values.int
w()
Vector4I
withW(int value)
Copy the current immutable object by setting a value for thew
attribute.Vector4I
withX(int value)
Copy the current immutable object by setting a value for thex
attribute.Vector4I
withY(int value)
Copy the current immutable object by setting a value for they
attribute.Vector4I
withZ(int value)
Copy the current immutable object by setting a value for thez
attribute.int
x()
int
y()
int
z()
-
Method Details
-
x
public int x()- Specified by:
x
in interfaceVector4IType
- Specified by:
x
in interfaceVectorReadable2IType
- Returns:
- The value of the
x
attribute
-
y
public int y()- Specified by:
y
in interfaceVector4IType
- Specified by:
y
in interfaceVectorReadable2IType
- Returns:
- The value of the
y
attribute
-
z
public int z()- Specified by:
z
in interfaceVector4IType
- Specified by:
z
in interfaceVectorReadable3IType
- Returns:
- The value of the
z
attribute
-
w
public int w()- Specified by:
w
in interfaceVector4IType
- Specified by:
w
in interfaceVectorReadable4IType
- Returns:
- The value of the
w
attribute
-
withX
Copy the current immutable object by setting a value for thex
attribute. A value equality check is used to prevent copying of the same value by returningthis
.- Parameters:
value
- A new value for x- Returns:
- A modified copy of the
this
object
-
withY
Copy the current immutable object by setting a value for they
attribute. A value equality check is used to prevent copying of the same value by returningthis
.- Parameters:
value
- A new value for y- Returns:
- A modified copy of the
this
object
-
withZ
Copy the current immutable object by setting a value for thez
attribute. A value equality check is used to prevent copying of the same value by returningthis
.- Parameters:
value
- A new value for z- Returns:
- A modified copy of the
this
object
-
withW
Copy the current immutable object by setting a value for thew
attribute. A value equality check is used to prevent copying of the same value by returningthis
.- Parameters:
value
- A new value for w- Returns:
- A modified copy of the
this
object
-
equals
public boolean equals(java.lang.Object another)This instance is equal to all instances ofVector4I
that have equal attribute values.- Overrides:
equals
in classjava.lang.Object
- Returns:
true
ifthis
is equal toanother
instance
-
hashCode
public int hashCode()Computes a hash code from attributes:x
,y
,z
,w
.- Overrides:
hashCode
in classjava.lang.Object
- Returns:
- hashCode value
-
toString
public java.lang.String toString()Prints the immutable valueVector4I
with attribute values.- Overrides:
toString
in classjava.lang.Object
- Returns:
- A string representation of the value
-
of
Construct a new immutableVector4I
instance.- Parameters:
x
- The value for thex
attributey
- The value for they
attributez
- The value for thez
attributew
- The value for thew
attribute- Returns:
- An immutable Vector4I instance
-
copyOf
Creates an immutable copy of aVector4IType
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
Creates a builder forVector4I
.Vector4I.builder() .setX(int) // required
x
.setY(int) // requiredy
.setZ(int) // requiredz
.setW(int) // requiredw
.build();- Returns:
- A new Vector4I builder
-