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 getX()
	{
		return x;
	}
	
	@Override
	public short getY()
	{
		return y;
	}
	
	@Override
	public short getZ()
	{
		return z;
	}
	
	@Override
	public short getW()
	{
		return w;
	}
	
	@Override
	public Vec4s setX(short x)
	{
		this.x = x;
		return this;
	}
	
	@Override
	public Vec4s setY(short y)
	{
		this.y = y;
		return this;
	}
	
	@Override
	public Vec4s setZ(short z)
	{
		this.z = z;
		return this;
	}
	
	@Override
	public Vec4s setW(short w)
	{
		this.w = w;
		return this;
	}
	
	@Override
	public Vec4s copy()
	{
		return Vec4s.newMutable(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.getX() == x && vec.getY() == y && vec.getZ() == z && vec.getW() == w;
		}
		return false;
	}
	
	@Override
	public String toString()
	{
		return "Vec4s[x="+x+", y="+y+", z="+z+", w="+w+"]";
	}
}
