Class Vector4D
java.lang.Object
com.io7m.jtensors.core.unparameterized.vectors.Vector4D
- All Implemented Interfaces:
Vector4DType
,VectorReadable2DType
,VectorReadable3DType
,VectorReadable4DType
,VectorComputationalType
The type of 4D
double
-typed vectors.-
Nested Class Summary
Nested Classes -
Method Summary
Modifier and TypeMethodDescriptionstatic Vector4D.Builder
builder()
Creates a builder forVector4D
.static Vector4D
copyOf
(Vector4DType instance) Creates an immutable copy of aVector4DType
value.boolean
This instance is equal to all instances ofVector4D
that have equal attribute values.int
hashCode()
Computes a hash code from attributes:x
,y
,z
,w
.static Vector4D
of
(double x, double y, double z, double w) Construct a new immutableVector4D
instance.toString()
Prints the immutable valueVector4D
with attribute values.double
w()
final Vector4D
withW
(double value) Copy the current immutable object by setting a value for thew
attribute.final Vector4D
withX
(double value) Copy the current immutable object by setting a value for thex
attribute.final Vector4D
withY
(double value) Copy the current immutable object by setting a value for they
attribute.final Vector4D
withZ
(double value) Copy the current immutable object by setting a value for thez
attribute.double
x()
double
y()
double
z()
-
Method Details
-
x
public double x()- Specified by:
x
in interfaceVector4DType
- Specified by:
x
in interfaceVectorReadable2DType
- Returns:
- The value of the
x
attribute
-
y
public double y()- Specified by:
y
in interfaceVector4DType
- Specified by:
y
in interfaceVectorReadable2DType
- Returns:
- The value of the
y
attribute
-
z
public double z()- Specified by:
z
in interfaceVector4DType
- Specified by:
z
in interfaceVectorReadable3DType
- Returns:
- The value of the
z
attribute
-
w
public double w()- Specified by:
w
in interfaceVector4DType
- Specified by:
w
in interfaceVectorReadable4DType
- Returns:
- The value of the
w
attribute
-
withX
Copy the current immutable object by setting a value for thex
attribute. A value strict bits equality 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 strict bits equality 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 strict bits equality 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 strict bits equality 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
This instance is equal to all instances ofVector4D
that have equal attribute values. -
hashCode
public int hashCode()Computes a hash code from attributes:x
,y
,z
,w
. -
toString
Prints the immutable valueVector4D
with attribute values. -
of
Construct a new immutableVector4D
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 Vector4D instance
-
copyOf
Creates an immutable copy of aVector4DType
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 Vector4D instance
-
builder
Creates a builder forVector4D
.Vector4D.builder() .setX(double) // required
x
.setY(double) // requiredy
.setZ(double) // requiredz
.setW(double) // requiredw
.build();- Returns:
- A new Vector4D builder
-