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

import java.util.Objects;

public class Vec3lImmutable implements Vec3l {
	final long x;
	final long y;
	final long z;
	
	public Vec3lImmutable() {
		x = 0;
		y = 0;
		z = 0;
	}
	
	public Vec3lImmutable(long value) {
		x = value;
		y = value;
		z = value;
	}
	
	public Vec3lImmutable(long x, long y, long z) {
		this.x = x;
		this.y = y;
		this.z = z;
	}
	
	@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 Vec3l x(long x) { return this.x == x ? this : Vec3l.of(x, y, z); }
	@Override
	public Vec3l y(long y) { return this.y == y ? this : Vec3l.of(x, y, z); }
	@Override
	public Vec3l z(long z) { return this.z == z ? this : Vec3l.of(x, y, z); }
	@Override
	public Vec3l copy() { return Vec3l.of(this); }
	@Override
	public Vec3l set(long x, long y, long z) { return this.x == x && this.y == y && this.z == z ? this : Vec3l.of(x, y, z); }
	@Override
	public int hashCode() { return Objects.hash(x, y, z); }
	
	@Override
	public boolean equals(Object obj) {
		if(obj instanceof Vec3l) {
			Vec3l vec = (Vec3l)obj;
			return vec.x() == x && vec.y() == y && vec.z() == z;
		}
		return false;
	}
	
	@Override
	public String toString() { return "Vec3l[x="+x+", y="+y+", z="+z+"]"; }
}
