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

import java.util.Objects;

public class Vec3lMutable implements Vec3l {
	long x;
	long y;
	long z;
	
	public Vec3lMutable() {}
	
	public Vec3lMutable(long value) {
		x = value;
		y = value;
		z = value;
	}
	
	public Vec3lMutable(long x, long y, long z) {
		this.x = x;
		this.y = y;
		this.z = z;
	}
	
	@Override
	public boolean isMutable() { return true; }
	@Override
	public long x() { return x; }
	@Override
	public long y() { return y; }
	@Override
	public long z() { return z; }
	
	@Override
	public Vec3l x(long x) {
		this.x = x;
		return this;
	}
	
	@Override
	public Vec3l y(long y) {
		this.y = y;
		return this;
	}
	
	@Override
	public Vec3l z(long z) {
		this.z = z;
		return this;
	}
	
	@Override
	public Vec3l copy() { return Vec3l.mutable(this); }
	
	@Override
	public Vec3l set(long x, long y, long z) {
		this.x = x;
		this.y = y;
		this.z = z;
		return this;
	}
	
	@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+"]"; }
}
