package speiger.src.coreengine.math.vector.shorts;

import java.util.Objects;

public class Vec4sMutable implements Vec4s {
	short x;
	short y;
	short z;
	short w;
	
	public Vec4sMutable() {}
	
	public Vec4sMutable(short value) {
		x = value;
		y = value;
		z = value;
		w = value;
	}
	
	public Vec4sMutable(short x, short y, short z, short w) {
		this.x = x;
		this.y = y;
		this.z = z;
		this.w = w;
	}
	
	@Override
	public boolean isMutable() { return true; }
	@Override
	public short x() { return x; }
	@Override
	public short y() { return y; }
	@Override
	public short z() { return z; }
	@Override
	public short w() { return w; }
	
	@Override
	public Vec4s x(short x) {
		this.x = x;
		return this;
	}
	
	@Override
	public Vec4s y(short y) {
		this.y = y;
		return this;
	}
	
	@Override
	public Vec4s z(short z) {
		this.z = z;
		return this;
	}
	
	@Override
	public Vec4s w(short w) {
		this.w = w;
		return this;
	}
	
	@Override
	public Vec4s copy() { return Vec4s.mutable(this); }
	
	@Override
	public Vec4s set(short x, short y, short z, short 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 Vec4s) {
			Vec4s vec = (Vec4s)obj;
			return vec.x() == x && vec.y() == y && vec.z() == z && vec.w() == w;
		}
		return false;
	}
	
	@Override
	public String toString() { return "Vec4s[x="+x+", y="+y+", z="+z+", w="+w+"]"; }
}
