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

import java.util.Objects;

public class Vec4bImmutable implements Vec4b {
	final byte x;
	final byte y;
	final byte z;
	final byte w;
	
	public Vec4bImmutable() {
		x = 0;
		y = 0;
		z = 0;
		w = 0;
	}
	
	public Vec4bImmutable(byte value) {
		x = value;
		y = value;
		z = value;
		w = value;
	}
	
	public Vec4bImmutable(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 false; }
	@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) { return this.x == x ? this : Vec4b.of(x, y, z, w); }
	@Override
	public Vec4b y(byte y) { return this.y == y ? this : Vec4b.of(x, y, z, w); }
	@Override
	public Vec4b z(byte z) { return this.z == z ? this : Vec4b.of(x, y, z, w); }
	@Override
	public Vec4b w(byte w) { return this.w == w ? this : Vec4b.of(x, y, z, w); }
	@Override
	public Vec4b copy() { return Vec4b.of(this); }
	@Override
	public Vec4b set(byte x, byte y, byte z, byte w) { return this.x == x && this.y == y && this.z == z && this.w == w ? this : Vec4b.of(x, y, z, w); }
	@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+"]"; }
}
