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

import java.util.Objects;

public class Vec3iMutable implements Vec3i {
	int x;
	int y;
	int z;
	
	public Vec3iMutable() {}
	
	public Vec3iMutable(int value) {
		x = value;
		y = value;
		z = value;
	}
	
	public Vec3iMutable(int x, int y, int z) {
		this.x = x;
		this.y = y;
		this.z = z;
	}
	
	@Override
	public boolean isMutable() { return true; }
	@Override
	public int x() { return x; }
	@Override
	public int y() { return y; }
	@Override
	public int z() { return z; }
	
	@Override
	public Vec3i x(int x) {
		this.x = x;
		return this;
	}
	
	@Override
	public Vec3i y(int y) {
		this.y = y;
		return this;
	}
	
	@Override
	public Vec3i z(int z) {
		this.z = z;
		return this;
	}
	
	@Override
	public Vec3i copy() { return Vec3i.mutable(this); }
	
	@Override
	public Vec3i set(int x, int y, int 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 Vec3i) {
			Vec3i vec = (Vec3i)obj;
			return vec.x() == x && vec.y() == y && vec.z() == z;
		}
		return false;
	}
	
	@Override
	public String toString() { return "Vec3i[x="+x+", y="+y+", z="+z+"]"; }
}
