package speiger.src.coreengine.math.vector.floats; import java.util.Objects; public class Vec4fMutable implements Vec4f { float x; float y; float z; float w; public Vec4fMutable() { x = 0; y = 0; z = 0; w = 0; } public Vec4fMutable(float value) { x = value; y = value; z = value; w = value; } public Vec4fMutable(float x, float y, float z, float w) { this.x = x; this.y = y; this.z = z; this.w = w; } @Override public boolean isMutable() { return true; } @Override public float getX() { return x; } @Override public float getY() { return y; } @Override public float getZ() { return z; } @Override public float getW() { return w; } @Override public Vec4f setX(float x) { this.x = x; return this; } @Override public Vec4f setY(float y) { this.y = y; return this; } @Override public Vec4f setZ(float z) { this.z = z; return this; } @Override public Vec4f setW(float w) { this.w = w; return this; } @Override public Vec4f copy() { return Vec4f.newMutable(this); } @Override public Vec4f set(float x, float y, float z, float w) { this.x = x; this.y = y; this.z = z; this.w = w; return this; } @Override public int hashCode() { return Objects.hash(x, y, z, w); } @Override public boolean equals(Object obj) { if(obj instanceof Vec4f) { Vec4f vec = (Vec4f)obj; return vec.getX() == x && vec.getY() == y && vec.getZ() == z && vec.getW() == w; } return false; } @Override public String toString() { return "Vec4f[x="+x+", y="+y+", z="+z+", w="+w+"]"; } }