109 lines
1.4 KiB
Java
109 lines
1.4 KiB
Java
package speiger.src.coreengine.math.vector.longs;
|
|
|
|
import java.util.Objects;
|
|
|
|
public class Vec3lImmutable implements Vec3l
|
|
{
|
|
final long x;
|
|
final long y;
|
|
final long z;
|
|
|
|
public Vec3lImmutable()
|
|
{
|
|
x = 0;
|
|
y = 0;
|
|
z = 0;
|
|
}
|
|
|
|
public Vec3lImmutable(long value)
|
|
{
|
|
x = value;
|
|
y = value;
|
|
z = value;
|
|
}
|
|
|
|
public Vec3lImmutable(long x, long y, long z)
|
|
{
|
|
this.x = x;
|
|
this.y = y;
|
|
this.z = z;
|
|
}
|
|
|
|
@Override
|
|
public boolean isMutable()
|
|
{
|
|
return false;
|
|
}
|
|
|
|
@Override
|
|
public long getX()
|
|
{
|
|
return x;
|
|
}
|
|
|
|
@Override
|
|
public long getY()
|
|
{
|
|
return y;
|
|
}
|
|
|
|
@Override
|
|
public long getZ()
|
|
{
|
|
return z;
|
|
}
|
|
|
|
@Override
|
|
public Vec3l setX(long x)
|
|
{
|
|
return this.x == x ? this : Vec3l.of(x, y, z);
|
|
}
|
|
|
|
@Override
|
|
public Vec3l setY(long y)
|
|
{
|
|
return this.y == y ? this : Vec3l.of(x, y, z);
|
|
}
|
|
|
|
@Override
|
|
public Vec3l setZ(long z)
|
|
{
|
|
return this.z == z ? this : Vec3l.of(x, y, z);
|
|
}
|
|
|
|
@Override
|
|
public Vec3l copy()
|
|
{
|
|
return Vec3l.of(this);
|
|
}
|
|
|
|
@Override
|
|
public Vec3l set(long x, long y, long z)
|
|
{
|
|
return this.x == x && this.y == y && this.z == z ? this : Vec3l.of(x, y, z);
|
|
}
|
|
|
|
@Override
|
|
public int hashCode()
|
|
{
|
|
return Objects.hash(x, y, z);
|
|
}
|
|
|
|
@Override
|
|
public boolean equals(Object obj)
|
|
{
|
|
if(obj instanceof Vec3l)
|
|
{
|
|
Vec3l vec = (Vec3l)obj;
|
|
return vec.getX() == x && vec.getY() == y && vec.getZ() == z;
|
|
}
|
|
return false;
|
|
}
|
|
|
|
@Override
|
|
public String toString()
|
|
{
|
|
return "Vec3l[x="+x+", y="+y+", z="+z+"]";
|
|
}
|
|
}
|