SimpleJavaEngine/src/main/java/speiger/src/coreengine/math/vector/longs/Vec4lMutable.java

89 lines
1.5 KiB
Java

package speiger.src.coreengine.math.vector.longs;
import java.util.Objects;
public class Vec4lMutable implements Vec4l {
long x;
long y;
long z;
long w;
public Vec4lMutable() {}
public Vec4lMutable(long value) {
x = value;
y = value;
z = value;
w = value;
}
public Vec4lMutable(long x, long y, long z, long w) {
this.x = x;
this.y = y;
this.z = z;
this.w = w;
}
@Override
public boolean isMutable() { return true; }
@Override
public long getX() { return x; }
@Override
public long getY() { return y; }
@Override
public long getZ() { return z; }
@Override
public long getW() { return w; }
@Override
public Vec4l setX(long x) {
this.x = x;
return this;
}
@Override
public Vec4l setY(long y) {
this.y = y;
return this;
}
@Override
public Vec4l setZ(long z) {
this.z = z;
return this;
}
@Override
public Vec4l setW(long w) {
this.w = w;
return this;
}
@Override
public Vec4l copy() { return Vec4l.mutable(this); }
@Override
public Vec4l set(long x, long y, long z, long 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 Vec4l) {
Vec4l vec = (Vec4l)obj;
return vec.getX() == x && vec.getY() == y && vec.getZ() == z && vec.getW() == w;
}
return false;
}
@Override
public String toString() { return "Vec4l[x="+x+", y="+y+", z="+z+", w="+w+"]"; }
}