Class Vector4D
java.lang.Object
com.io7m.jtensors.core.unparameterized.vectors.Vector4D
- All Implemented Interfaces:
Vector4DType,VectorReadable2DType,VectorReadable3DType,VectorReadable4DType,VectorComputationalType
public final class Vector4D extends java.lang.Object implements Vector4DType
The type of 4D
double-typed vectors.-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classVector4D.BuilderBuilds instances of typeVector4D. -
Method Summary
Modifier and Type Method Description static Vector4D.Builderbuilder()Creates a builder forVector4D.static Vector4DcopyOf(Vector4DType instance)Creates an immutable copy of aVector4DTypevalue.booleanequals(java.lang.Object another)This instance is equal to all instances ofVector4Dthat have equal attribute values.inthashCode()Computes a hash code from attributes:x,y,z,w.static Vector4Dof(double x, double y, double z, double w)Construct a new immutableVector4Dinstance.java.lang.StringtoString()Prints the immutable valueVector4Dwith attribute values.doublew()Vector4DwithW(double value)Copy the current immutable object by setting a value for thewattribute.Vector4DwithX(double value)Copy the current immutable object by setting a value for thexattribute.Vector4DwithY(double value)Copy the current immutable object by setting a value for theyattribute.Vector4DwithZ(double value)Copy the current immutable object by setting a value for thezattribute.doublex()doubley()doublez()
-
Method Details
-
x
public double x()- Specified by:
xin interfaceVector4DType- Specified by:
xin interfaceVectorReadable2DType- Returns:
- The value of the
xattribute
-
y
public double y()- Specified by:
yin interfaceVector4DType- Specified by:
yin interfaceVectorReadable2DType- Returns:
- The value of the
yattribute
-
z
public double z()- Specified by:
zin interfaceVector4DType- Specified by:
zin interfaceVectorReadable3DType- Returns:
- The value of the
zattribute
-
w
public double w()- Specified by:
win interfaceVector4DType- Specified by:
win interfaceVectorReadable4DType- Returns:
- The value of the
wattribute
-
withX
Copy the current immutable object by setting a value for thexattribute. 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
thisobject
-
withY
Copy the current immutable object by setting a value for theyattribute. 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
thisobject
-
withZ
Copy the current immutable object by setting a value for thezattribute. 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
thisobject
-
withW
Copy the current immutable object by setting a value for thewattribute. 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
thisobject
-
equals
public boolean equals(java.lang.Object another)This instance is equal to all instances ofVector4Dthat have equal attribute values.- Overrides:
equalsin classjava.lang.Object- Returns:
trueifthisis equal toanotherinstance
-
hashCode
public int hashCode()Computes a hash code from attributes:x,y,z,w.- Overrides:
hashCodein classjava.lang.Object- Returns:
- hashCode value
-
toString
public java.lang.String toString()Prints the immutable valueVector4Dwith attribute values.- Overrides:
toStringin classjava.lang.Object- Returns:
- A string representation of the value
-
of
Construct a new immutableVector4Dinstance.- Parameters:
x- The value for thexattributey- The value for theyattributez- The value for thezattributew- The value for thewattribute- Returns:
- An immutable Vector4D instance
-
copyOf
Creates an immutable copy of aVector4DTypevalue. 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) // requiredx.setY(double) // requiredy.setZ(double) // requiredz.setW(double) // requiredw.build();- Returns:
- A new Vector4D builder
-