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

import java.util.Objects;

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