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 x() { return x; }
	@Override
	public byte y() { return y; }
	@Override
	public byte z() { return z; }
	
	@Override
	public Vec3b x(byte x) {
		this.x = x;
		return this;
	}
	
	@Override
	public Vec3b y(byte y) {
		this.y = y;
		return this;
	}
	
	@Override
	public Vec3b z(byte z) {
		this.z = z;
		return this;
	}
	
	@Override
	public Vec3b copy() { return Vec3b.mutable(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.x() == x && vec.y() == y && vec.z() == z;
		}
		return false;
	}
	
	@Override
	public String toString() { return "Vec3b[x="+x+", y="+y+", z="+z+"]"; }
}
