95 lines
1.1 KiB
Java
95 lines
1.1 KiB
Java
package speiger.src.coreengine.math.vector.shorts;
|
|
|
|
import java.util.Objects;
|
|
|
|
public class Vec2sMutable implements Vec2s
|
|
{
|
|
short x;
|
|
short y;
|
|
|
|
public Vec2sMutable()
|
|
{
|
|
}
|
|
|
|
public Vec2sMutable(short value)
|
|
{
|
|
x = value;
|
|
y = value;
|
|
}
|
|
|
|
public Vec2sMutable(short x, short y)
|
|
{
|
|
this.x = x;
|
|
this.y = y;
|
|
}
|
|
|
|
@Override
|
|
public boolean isMutable()
|
|
{
|
|
return true;
|
|
}
|
|
|
|
@Override
|
|
public short getX()
|
|
{
|
|
return x;
|
|
}
|
|
|
|
@Override
|
|
public short getY()
|
|
{
|
|
return y;
|
|
}
|
|
|
|
@Override
|
|
public Vec2s setX(short x)
|
|
{
|
|
this.x = x;
|
|
return this;
|
|
}
|
|
|
|
@Override
|
|
public Vec2s setY(short y)
|
|
{
|
|
this.y = y;
|
|
return this;
|
|
}
|
|
|
|
@Override
|
|
public Vec2s copy()
|
|
{
|
|
return Vec2s.mutable(this);
|
|
}
|
|
|
|
@Override
|
|
public Vec2s set(short x, short 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 Vec2s)
|
|
{
|
|
Vec2s vec = (Vec2s)obj;
|
|
return vec.getX() == x && vec.getY() == y;
|
|
}
|
|
return false;
|
|
}
|
|
|
|
@Override
|
|
public String toString()
|
|
{
|
|
return "Vec2s[x="+x+", y="+y+"]";
|
|
}
|
|
}
|