112 lines
1.3 KiB
Java
112 lines
1.3 KiB
Java
package speiger.src.coreengine.math.vector.ints;
|
|
|
|
import java.util.Objects;
|
|
|
|
public class Vec3iMutable implements Vec3i
|
|
{
|
|
int x;
|
|
int y;
|
|
int z;
|
|
|
|
public Vec3iMutable()
|
|
{
|
|
}
|
|
|
|
public Vec3iMutable(int value)
|
|
{
|
|
x = value;
|
|
y = value;
|
|
z = value;
|
|
}
|
|
|
|
public Vec3iMutable(int x, int y, int z)
|
|
{
|
|
this.x = x;
|
|
this.y = y;
|
|
this.z = z;
|
|
}
|
|
|
|
@Override
|
|
public boolean isMutable()
|
|
{
|
|
return true;
|
|
}
|
|
|
|
@Override
|
|
public int getX()
|
|
{
|
|
return x;
|
|
}
|
|
|
|
@Override
|
|
public int getY()
|
|
{
|
|
return y;
|
|
}
|
|
|
|
@Override
|
|
public int getZ()
|
|
{
|
|
return z;
|
|
}
|
|
|
|
@Override
|
|
public Vec3i setX(int x)
|
|
{
|
|
this.x = x;
|
|
return this;
|
|
}
|
|
|
|
@Override
|
|
public Vec3i setY(int y)
|
|
{
|
|
this.y = y;
|
|
return this;
|
|
}
|
|
|
|
@Override
|
|
public Vec3i setZ(int z)
|
|
{
|
|
this.z = z;
|
|
return this;
|
|
}
|
|
|
|
@Override
|
|
public Vec3i copy()
|
|
{
|
|
return Vec3i.mutable(this);
|
|
}
|
|
|
|
@Override
|
|
public Vec3i set(int x, int y, int z)
|
|
{
|
|
this.x = x;
|
|
this.y = y;
|
|
this.z = z;
|
|
return this;
|
|
}
|
|
|
|
@Override
|
|
public int hashCode()
|
|
{
|
|
return Objects.hash(x, y, z);
|
|
}
|
|
|
|
@Override
|
|
public boolean equals(Object obj)
|
|
{
|
|
if(obj instanceof Vec3i)
|
|
{
|
|
Vec3i vec = (Vec3i)obj;
|
|
return vec.getX() == x && vec.getY() == y && vec.getZ() == z;
|
|
}
|
|
return false;
|
|
}
|
|
|
|
@Override
|
|
public String toString()
|
|
{
|
|
return "Vec3i[x="+x+", y="+y+", z="+z+"]";
|
|
}
|
|
}
|