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

import java.util.Objects;

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