95 lines
1.1 KiB
Java
95 lines
1.1 KiB
Java
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 getX()
|
|
{
|
|
return x;
|
|
}
|
|
|
|
@Override
|
|
public long getY()
|
|
{
|
|
return y;
|
|
}
|
|
|
|
@Override
|
|
public Vec2l setX(long x)
|
|
{
|
|
this.x = x;
|
|
return this;
|
|
}
|
|
|
|
@Override
|
|
public Vec2l setY(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.getX() == x && vec.getY() == y;
|
|
}
|
|
return false;
|
|
}
|
|
|
|
@Override
|
|
public String toString()
|
|
{
|
|
return "Vec2l[x="+x+", y="+y+"]";
|
|
}
|
|
}
|