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

import java.util.Objects;

public class Vec4dMutable implements Vec4d
{
	double x;
	double y;
	double z;
	double w;
	
	public Vec4dMutable()
	{
	}
	
	public Vec4dMutable(double value)
	{
		x = value;
		y = value;
		z = value;
		w = value;
	}
	
	public Vec4dMutable(double x, double y, double z, double w)
	{
		this.x = x;
		this.y = y;
		this.z = z;
		this.w = w;
	}

	@Override
	public boolean isMutable()
	{
		return true;
	}
	
	@Override
	public double getX()
	{
		return x;
	}
	
	@Override
	public double getY()
	{
		return y;
	}
	
	@Override
	public double getZ()
	{
		return z;
	}
	
	@Override
	public double getW()
	{
		return w;
	}
	
	@Override
	public Vec4d setX(double x)
	{
		this.x = x;
		return this;
	}
	
	@Override
	public Vec4d setY(double y)
	{
		this.y = y;
		return this;
	}
	
	@Override
	public Vec4d setZ(double z)
	{
		this.z = z;
		return this;
	}
	
	@Override
	public Vec4d setW(double w)
	{
		this.w = w;
		return this;
	}
	
	@Override
	public Vec4d copy()
	{
		return Vec4d.newMutable(this);
	}
	
	@Override
	public Vec4d set(double x, double y, double z, double w)
	{
		this.x = x;
		this.y = y;
		this.z = z;
		this.w = w;
		return this;
	}
	
	@Override
	public int hashCode()
	{
		return Objects.hash(x, y, z, w);
	}
	
	@Override
	public boolean equals(Object obj)
	{
		if(obj instanceof Vec4d)
		{
			Vec4d vec = (Vec4d)obj;
			return vec.getX() == x && vec.getY() == y && vec.getZ() == z && vec.getW() == w;
		}
		return false;
	}
	
	@Override
	public String toString()
	{
		return "Vec4d[x="+x+", y="+y+", z="+z+", w="+w+"]";
	}
}