Package com.io7m.jspatial.api.octtrees
Class OctTreeRaycastResultI<T>
- java.lang.Object
-
- com.io7m.jspatial.api.octtrees.OctTreeRaycastResultI<T>
-
- Type Parameters:
T- The precise type of objects
- All Implemented Interfaces:
OctTreeRaycastResultIType<T>,java.lang.Comparable<OctTreeRaycastResultIType<T>>
public final class OctTreeRaycastResultI<T> extends java.lang.Object implements OctTreeRaycastResultIType<T>
The type of octtree raycast results.- Since:
- 3.0.0
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classOctTreeRaycastResultI.Builder<T>Builds instances of typeOctTreeRaycastResultI.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static <T> OctTreeRaycastResultI.Builder<T>builder()Creates a builder forOctTreeRaycastResultI.static <T> OctTreeRaycastResultI<T>copyOf(OctTreeRaycastResultIType<T> instance)Creates an immutable copy of aOctTreeRaycastResultITypevalue.doubledistance()booleanequals(java.lang.Object another)This instance is equal to all instances ofOctTreeRaycastResultIthat have equal attribute values.inthashCode()Computes a hash code from attributes:distance,volume,item.Titem()static <T> OctTreeRaycastResultI<T>of(double distance, com.io7m.jregions.core.unparameterized.volumes.VolumeI volume, T item)Construct a new immutableOctTreeRaycastResultIinstance.java.lang.StringtoString()Prints the immutable valueOctTreeRaycastResultIwith attribute values.com.io7m.jregions.core.unparameterized.volumes.VolumeIvolume()OctTreeRaycastResultI<T>withDistance(double value)Copy the current immutable object by setting a value for thedistanceattribute.OctTreeRaycastResultI<T>withItem(T value)Copy the current immutable object by setting a value for theitemattribute.OctTreeRaycastResultI<T>withVolume(com.io7m.jregions.core.unparameterized.volumes.VolumeI value)Copy the current immutable object by setting a value for thevolumeattribute.-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface com.io7m.jspatial.api.octtrees.OctTreeRaycastResultIType
compareTo
-
-
-
-
Method Detail
-
distance
public double distance()
- Specified by:
distancein interfaceOctTreeRaycastResultIType<T>- Returns:
- The distance to the object
-
volume
public com.io7m.jregions.core.unparameterized.volumes.VolumeI volume()
- Specified by:
volumein interfaceOctTreeRaycastResultIType<T>- Returns:
- The object volume
-
item
public T item()
- Specified by:
itemin interfaceOctTreeRaycastResultIType<T>- Returns:
- The object
-
withDistance
public final OctTreeRaycastResultI<T> withDistance(double value)
Copy the current immutable object by setting a value for thedistanceattribute. A value strict bits equality used to prevent copying of the same value by returningthis.- Parameters:
value- A new value for distance- Returns:
- A modified copy of the
thisobject
-
withVolume
public final OctTreeRaycastResultI<T> withVolume(com.io7m.jregions.core.unparameterized.volumes.VolumeI value)
Copy the current immutable object by setting a value for thevolumeattribute. A shallow reference equality check is used to prevent copying of the same value by returningthis.- Parameters:
value- A new value for volume- Returns:
- A modified copy of the
thisobject
-
withItem
public final OctTreeRaycastResultI<T> withItem(T value)
Copy the current immutable object by setting a value for theitemattribute. A shallow reference equality check is used to prevent copying of the same value by returningthis.- Parameters:
value- A new value for item- Returns:
- A modified copy of the
thisobject
-
equals
public boolean equals(java.lang.Object another)
This instance is equal to all instances ofOctTreeRaycastResultIthat have equal attribute values.- Overrides:
equalsin classjava.lang.Object- Returns:
trueifthisis equal toanotherinstance
-
hashCode
public int hashCode()
Computes a hash code from attributes:distance,volume,item.- Overrides:
hashCodein classjava.lang.Object- Returns:
- hashCode value
-
toString
public java.lang.String toString()
Prints the immutable valueOctTreeRaycastResultIwith attribute values.- Overrides:
toStringin classjava.lang.Object- Returns:
- A string representation of the value
-
of
public static <T> OctTreeRaycastResultI<T> of(double distance, com.io7m.jregions.core.unparameterized.volumes.VolumeI volume, T item)
Construct a new immutableOctTreeRaycastResultIinstance.- Parameters:
distance- The value for thedistanceattributevolume- The value for thevolumeattributeitem- The value for theitemattribute- Returns:
- An immutable OctTreeRaycastResultI instance
-
copyOf
public static <T> OctTreeRaycastResultI<T> copyOf(OctTreeRaycastResultIType<T> instance)
Creates an immutable copy of aOctTreeRaycastResultITypevalue. 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 OctTreeRaycastResultI instance
-
builder
public static <T> OctTreeRaycastResultI.Builder<T> builder()
Creates a builder forOctTreeRaycastResultI.- Type Parameters:
T- generic parameter T- Returns:
- A new OctTreeRaycastResultI builder
-
-