|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectsim.util.Int3D
Int3D stores three values (x, y, and z) but it is immutable: once the x and y and z values are set, they cannot be changed (they're final). Like the others, Int3D is immutable primarily to prevent hash tables from breaking.
One day in the far future, Int3D should also be HIGHLY efficient; since it is immutable, it can be passed by value rather than by pointer by a smart compiler. Not today, though. But it's not bad.
This class has an elaborate hash code generation that is much more random than Sun's standard generator, but takes more time. For very large numbers of objects, this is a good idea, but we may change it to a simpler version in the future.
Int3D.equals(...) can compare by value against other Int3Ds, MutableInt2Ds, and Double3Ds.
Field Summary | |
int |
x
|
int |
y
|
int |
z
|
Constructor Summary | |
Int3D()
|
|
Int3D(Int2D p)
Explicitly assumes the z value is set to 0 |
|
Int3D(Int2D p,
int z)
|
|
Int3D(int x,
int y,
int z)
|
|
Int3D(MutableInt2D p)
|
|
Int3D(MutableInt2D p,
int z)
|
Method Summary | |
double |
distance(Double3D p)
Returns the distance FROM this Int3D TO the specified point. |
double |
distance(double x,
double y,
double z)
Returns the distance FROM this Int3D TO the specified point |
double |
distance(Int3D p)
Returns the distance FROM this Int3D TO the specified point. |
double |
distance(MutableInt3D p)
Returns the distance FROM this Int3D TO the specified point. |
double |
distanceSq(Double3D p)
Returns the squared distance FROM this Int3D TO the specified point. |
double |
distanceSq(double x,
double y,
double z)
Returns the squared distance FROM this Int3D TO the specified point |
double |
distanceSq(Int3D p)
Returns the squared distance FROM this Int3D TO the specified point. |
double |
distanceSq(MutableInt3D p)
Returns the squared distance FROM this Int3D TO the specified point. |
boolean |
equals(java.lang.Object obj)
|
int |
getX()
|
int |
getY()
|
int |
getZ()
|
int |
hashCode()
|
long |
manhattanDistance(Int3D p)
Returns the manhattan distance FROM this Int3D TO the specified point. |
long |
manhattanDistance(int x,
int y,
int z)
Returns the manhattan distance FROM this Int3D TO the specified point. |
long |
manhattanDistance(MutableInt3D p)
Returns the manhattan distance FROM this Int3D TO the specified point. |
java.lang.String |
toCoordinates()
|
java.lang.String |
toString()
|
Methods inherited from class java.lang.Object |
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
public final int x
public final int y
public final int z
Constructor Detail |
public Int3D()
public Int3D(int x, int y, int z)
public Int3D(Int2D p)
public Int3D(Int2D p, int z)
public Int3D(MutableInt2D p)
public Int3D(MutableInt2D p, int z)
Method Detail |
public final int getX()
public final int getY()
public final int getZ()
public java.lang.String toString()
public java.lang.String toCoordinates()
public int hashCode()
public boolean equals(java.lang.Object obj)
public double distance(double x, double y, double z)
public double distance(Double3D p)
public double distance(MutableInt3D p)
public double distance(Int3D p)
public double distanceSq(double x, double y, double z)
public double distanceSq(Double3D p)
public double distanceSq(MutableInt3D p)
public double distanceSq(Int3D p)
public long manhattanDistance(int x, int y, int z)
public long manhattanDistance(MutableInt3D p)
public long manhattanDistance(Int3D p)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |