Class Vector3D
java.lang.Object
com.io7m.jtensors.core.unparameterized.vectors.Vector3D
- All Implemented Interfaces:
Vector3DType,VectorReadable2DType,VectorReadable3DType,VectorComputationalType
The type of 3D
double-typed vectors.-
Nested Class Summary
Nested Classes -
Method Summary
Modifier and TypeMethodDescriptionstatic Vector3D.Builderbuilder()Creates a builder forVector3D.static Vector3DcopyOf(Vector3DType instance) Creates an immutable copy of aVector3DTypevalue.booleanThis instance is equal to all instances ofVector3Dthat have equal attribute values.inthashCode()Computes a hash code from attributes:x,y,z.static Vector3Dof(double x, double y, double z) Construct a new immutableVector3Dinstance.toString()Prints the immutable valueVector3Dwith attribute values.final Vector3DwithX(double value) Copy the current immutable object by setting a value for thexattribute.final Vector3DwithY(double value) Copy the current immutable object by setting a value for theyattribute.final Vector3DwithZ(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 interfaceVector3DType- Specified by:
xin interfaceVectorReadable2DType- Returns:
- The value of the
xattribute
-
y
public double y()- Specified by:
yin interfaceVector3DType- Specified by:
yin interfaceVectorReadable2DType- Returns:
- The value of the
yattribute
-
z
public double z()- Specified by:
zin interfaceVector3DType- Specified by:
zin interfaceVectorReadable3DType- Returns:
- The value of the
zattribute
-
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
-
equals
This instance is equal to all instances ofVector3Dthat have equal attribute values. -
hashCode
public int hashCode()Computes a hash code from attributes:x,y,z. -
toString
Prints the immutable valueVector3Dwith attribute values. -
of
Construct a new immutableVector3Dinstance.- Parameters:
x- The value for thexattributey- The value for theyattributez- The value for thezattribute- Returns:
- An immutable Vector3D instance
-
copyOf
Creates an immutable copy of aVector3DTypevalue. 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 Vector3D instance
-
builder
Creates a builder forVector3D.Vector3D.builder() .setX(double) // requiredx.setY(double) // requiredy.setZ(double) // requiredz.build();- Returns:
- A new Vector3D builder
-