Class PVector4D<T>
java.lang.Object
com.io7m.jtensors.core.parameterized.vectors.PVector4D<T>
- Type Parameters:
T- A phantom type parameter
- All Implemented Interfaces:
PVector4DType<T>,PVectorReadable2DType<T>,PVectorReadable3DType<T>,PVectorReadable4DType<T>,VectorReadable2DType,VectorReadable3DType,VectorReadable4DType,VectorComputationalType
public final class PVector4D<T> extends java.lang.Object implements PVector4DType<T>
The type of 4D
double-typed vectors.-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classPVector4D.Builder<T>Builds instances of typePVector4D. -
Method Summary
Modifier and Type Method Description static <T> PVector4D.Builder<T>builder()Creates a builder forPVector4D.static <T> PVector4D<T>copyOf(PVector4DType<T> instance)Creates an immutable copy of aPVector4DTypevalue.booleanequals(java.lang.Object another)This instance is equal to all instances ofPVector4Dthat have equal attribute values.inthashCode()Computes a hash code from attributes:x,y,z,w.static <T> PVector4D<T>of(double x, double y, double z, double w)Construct a new immutablePVector4Dinstance.java.lang.StringtoString()Prints the immutable valuePVector4Dwith attribute values.doublew()PVector4D<T>withW(double value)Copy the current immutable object by setting a value for thewattribute.PVector4D<T>withX(double value)Copy the current immutable object by setting a value for thexattribute.PVector4D<T>withY(double value)Copy the current immutable object by setting a value for theyattribute.PVector4D<T>withZ(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 interfacePVector4DType<T>- Specified by:
xin interfaceVectorReadable2DType- Returns:
- The value of the
xattribute
-
y
public double y()- Specified by:
yin interfacePVector4DType<T>- Specified by:
yin interfaceVectorReadable2DType- Returns:
- The value of the
yattribute
-
z
public double z()- Specified by:
zin interfacePVector4DType<T>- Specified by:
zin interfaceVectorReadable3DType- Returns:
- The value of the
zattribute
-
w
public double w()- Specified by:
win interfacePVector4DType<T>- 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 ofPVector4Dthat 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 valuePVector4Dwith attribute values.- Overrides:
toStringin classjava.lang.Object- Returns:
- A string representation of the value
-
of
Construct a new immutablePVector4Dinstance.- Type Parameters:
T- generic parameter T- Parameters:
x- The value for thexattributey- The value for theyattributez- The value for thezattributew- The value for thewattribute- Returns:
- An immutable PVector4D instance
-
copyOf
Creates an immutable copy of aPVector4DTypevalue. Uses accessors to get values to initialize the new immutable instance. If an instance is already immutable, it is returned as is.- Type Parameters:
T- generic parameter T- Parameters:
instance- The instance to copy- Returns:
- A copied immutable PVector4D instance
-
builder
Creates a builder forPVector4D.PVector4D.<T>builder() .setX(double) // requiredx.setY(double) // requiredy.setZ(double) // requiredz.setW(double) // requiredw.build();- Type Parameters:
T- generic parameter T- Returns:
- A new PVector4D builder
-