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

import java.util.Objects;

public class Vec3bMutable implements Vec3b
{
	byte x;
	byte y;
	byte z;
	
	public Vec3bMutable()
	{
	}
	
	public Vec3bMutable(byte value)
	{
		x = value;
		y = value;
		z = value;
	}
	
	public Vec3bMutable(byte x, byte y, byte z)
	{
		this.x = x;
		this.y = y;
		this.z = z;
	}

	@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 Vec3b setX(byte x)
	{
		this.x = x;
		return this;
	}
	
	@Override
	public Vec3b setY(byte y)
	{
		this.y = y;
		return this;
	}
	
	@Override
	public Vec3b setZ(byte z)
	{
		this.z = z;
		return this;
	}
	
	@Override
	public Vec3b copy()
	{
		return Vec3b.newMutable(this);
	}
	
	@Override
	public Vec3b set(byte x, byte y, byte 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 Vec3b)
		{
			Vec3b vec = (Vec3b)obj;
			return vec.getX() == x && vec.getY() == y && vec.getZ() == z;
		}
		return false;
	}

	@Override
	public String toString()
	{
		return "Vec3b[x="+x+", y="+y+", z="+z+"]";
	}
}
