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

import java.util.Objects;

public class Vec2lMutable implements Vec2l {
	long x;
	long y;
	
	public Vec2lMutable() {}
	
	public Vec2lMutable(long value) {
		x = value;
		y = value;
	}
	
	public Vec2lMutable(long x, long y) {
		this.x = x;
		this.y = y;
	}
	
	@Override
	public boolean isMutable() { return true; }
	@Override
	public long x() { return x; }
	@Override
	public long y() { return y; }
	
	@Override
	public Vec2l x(long x) {
		this.x = x;
		return this;
	}
	
	@Override
	public Vec2l y(long y) {
		this.y = y;
		return this;
	}
	
	@Override
	public Vec2l copy() { return Vec2l.mutable(this); }
	
	@Override
	public Vec2l set(long x, long y) {
		this.x = x;
		this.y = y;
		return this;
	}
	
	@Override
	public int hashCode() { return Objects.hash(x, y); }
	
	@Override
	public boolean equals(Object obj) {
		if(obj instanceof Vec2l) {
			Vec2l vec = (Vec2l)obj;
			return vec.x() == x && vec.y() == y;
		}
		return false;
	}
	
	@Override
	public String toString() { return "Vec2l[x="+x+", y="+y+"]"; }
}
