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

import java.util.Objects;

public class Vec4iImmutable implements Vec4i {
	final int x;
	final int y;
	final int z;
	final int w;
	
	public Vec4iImmutable() {
		x = 0;
		y = 0;
		z = 0;
		w = 0;
	}
	
	public Vec4iImmutable(int value) {
		x = value;
		y = value;
		z = value;
		w = value;
	}
	
	public Vec4iImmutable(int x, int y, int z, int w) {
		this.x = x;
		this.y = y;
		this.z = z;
		this.w = w;
	}
	
	@Override
	public boolean isMutable() { return false; }
	@Override
	public int x() { return x; }
	@Override
	public int y() { return y; }
	@Override
	public int z() { return z; }
	@Override
	public int w() { return w; }
	@Override
	public Vec4i x(int x) { return this.x == x ? this : Vec4i.of(x, y, z, w); }
	@Override
	public Vec4i y(int y) { return this.y == y ? this : Vec4i.of(x, y, z, w); }
	@Override
	public Vec4i z(int z) { return this.z == z ? this : Vec4i.of(x, y, z, w); }
	@Override
	public Vec4i w(int w) { return this.w == w ? this : Vec4i.of(x, y, z, w); }
	@Override
	public Vec4i copy() { return Vec4i.of(this); }
	@Override
	public Vec4i set(int x, int y, int z, int w) { return this.x == x && this.y == y && this.z == z && this.w == w ? this : Vec4i.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 Vec4i) {
			Vec4i vec = (Vec4i)obj;
			return vec.x() == x && vec.y() == y && vec.z() == z && vec.w() == w;
		}
		return false;
	}
	
	@Override
	public String toString() { return "Vec4i[x="+x+", y="+y+", z="+z+", w="+w+"]"; }
}
