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