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

import java.util.Objects;

public class Vec4bMutable implements Vec4b
{
	byte x;
	byte y;
	byte z;
	byte w;
	
	public Vec4bMutable()
	{
	}
	
	public Vec4bMutable(byte value)
	{
		x = value;
		y = value;
		z = value;
		w = value;
	}
	
	public Vec4bMutable(byte x, byte y, byte z, byte w)
	{
		this.x = x;
		this.y = y;
		this.z = z;
		this.w = w;
	}

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

}
