Package com.io7m.jspatial.api.quadtrees
Class QuadTreeRaycastResultI<T>
- java.lang.Object
-
- com.io7m.jspatial.api.quadtrees.QuadTreeRaycastResultI<T>
-
- Type Parameters:
T
- The precise type of objects
- All Implemented Interfaces:
QuadTreeRaycastResultIType<T>
,java.lang.Comparable<QuadTreeRaycastResultIType<T>>
public final class QuadTreeRaycastResultI<T> extends java.lang.Object implements QuadTreeRaycastResultIType<T>
The type of quadtree raycast results.- Since:
- 3.0.0
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
QuadTreeRaycastResultI.Builder<T>
Builds instances of typeQuadTreeRaycastResultI
.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description com.io7m.jregions.core.unparameterized.areas.AreaI
area()
static <T> QuadTreeRaycastResultI.Builder<T>
builder()
Creates a builder forQuadTreeRaycastResultI
.static <T> QuadTreeRaycastResultI<T>
copyOf(QuadTreeRaycastResultIType<T> instance)
Creates an immutable copy of aQuadTreeRaycastResultIType
value.double
distance()
boolean
equals(java.lang.Object another)
This instance is equal to all instances ofQuadTreeRaycastResultI
that have equal attribute values.int
hashCode()
Computes a hash code from attributes:distance
,area
,item
.T
item()
static <T> QuadTreeRaycastResultI<T>
of(double distance, com.io7m.jregions.core.unparameterized.areas.AreaI area, T item)
Construct a new immutableQuadTreeRaycastResultI
instance.java.lang.String
toString()
Prints the immutable valueQuadTreeRaycastResultI
with attribute values.QuadTreeRaycastResultI<T>
withArea(com.io7m.jregions.core.unparameterized.areas.AreaI value)
Copy the current immutable object by setting a value for thearea
attribute.QuadTreeRaycastResultI<T>
withDistance(double value)
Copy the current immutable object by setting a value for thedistance
attribute.QuadTreeRaycastResultI<T>
withItem(T value)
Copy the current immutable object by setting a value for theitem
attribute.-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface com.io7m.jspatial.api.quadtrees.QuadTreeRaycastResultIType
compareTo
-
-
-
-
Method Detail
-
distance
public double distance()
- Specified by:
distance
in interfaceQuadTreeRaycastResultIType<T>
- Returns:
- The distance to the object
-
area
public com.io7m.jregions.core.unparameterized.areas.AreaI area()
- Specified by:
area
in interfaceQuadTreeRaycastResultIType<T>
- Returns:
- The object area
-
item
public T item()
- Specified by:
item
in interfaceQuadTreeRaycastResultIType<T>
- Returns:
- The object
-
withDistance
public final QuadTreeRaycastResultI<T> withDistance(double value)
Copy the current immutable object by setting a value for thedistance
attribute. 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
this
object
-
withArea
public final QuadTreeRaycastResultI<T> withArea(com.io7m.jregions.core.unparameterized.areas.AreaI value)
Copy the current immutable object by setting a value for thearea
attribute. A shallow reference equality check is used to prevent copying of the same value by returningthis
.- Parameters:
value
- A new value for area- Returns:
- A modified copy of the
this
object
-
withItem
public final QuadTreeRaycastResultI<T> withItem(T value)
Copy the current immutable object by setting a value for theitem
attribute. 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
this
object
-
equals
public boolean equals(java.lang.Object another)
This instance is equal to all instances ofQuadTreeRaycastResultI
that have equal attribute values.- Overrides:
equals
in classjava.lang.Object
- Returns:
true
ifthis
is equal toanother
instance
-
hashCode
public int hashCode()
Computes a hash code from attributes:distance
,area
,item
.- Overrides:
hashCode
in classjava.lang.Object
- Returns:
- hashCode value
-
toString
public java.lang.String toString()
Prints the immutable valueQuadTreeRaycastResultI
with attribute values.- Overrides:
toString
in classjava.lang.Object
- Returns:
- A string representation of the value
-
of
public static <T> QuadTreeRaycastResultI<T> of(double distance, com.io7m.jregions.core.unparameterized.areas.AreaI area, T item)
Construct a new immutableQuadTreeRaycastResultI
instance.- Parameters:
distance
- The value for thedistance
attributearea
- The value for thearea
attributeitem
- The value for theitem
attribute- Returns:
- An immutable QuadTreeRaycastResultI instance
-
copyOf
public static <T> QuadTreeRaycastResultI<T> copyOf(QuadTreeRaycastResultIType<T> instance)
Creates an immutable copy of aQuadTreeRaycastResultIType
value. 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 QuadTreeRaycastResultI instance
-
builder
public static <T> QuadTreeRaycastResultI.Builder<T> builder()
Creates a builder forQuadTreeRaycastResultI
.- Type Parameters:
T
- generic parameter T- Returns:
- A new QuadTreeRaycastResultI builder
-
-