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