Add clone method to vector data types
This commit is contained in:
parent
805574f677
commit
2f963e86ef
4 changed files with 53 additions and 1 deletions
|
@ -21,6 +21,7 @@ package de.staropensource.sosengine.base.types.vectors;
|
|||
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import lombok.SneakyThrows;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
/**
|
||||
|
@ -82,6 +83,18 @@ public class Vec2 {
|
|||
this.y = y;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates an identical copy of this vector.
|
||||
*
|
||||
* @return identical copy
|
||||
* @since v1-alpha2
|
||||
*/
|
||||
@SneakyThrows
|
||||
@NotNull
|
||||
public Vec2 clone() {
|
||||
return (Vec2) super.clone();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a string representation of this vector.
|
||||
*
|
||||
|
|
|
@ -21,6 +21,7 @@ package de.staropensource.sosengine.base.types.vectors;
|
|||
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import lombok.SneakyThrows;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
/**
|
||||
|
@ -31,7 +32,7 @@ import org.jetbrains.annotations.NotNull;
|
|||
@SuppressWarnings({ "unused", "JavadocDeclaration", "JavadocBlankLines" })
|
||||
@Getter
|
||||
@Setter
|
||||
public class Vec2i {
|
||||
public class Vec2i implements Cloneable {
|
||||
/**
|
||||
* The X axis value.
|
||||
*
|
||||
|
@ -82,6 +83,18 @@ public class Vec2i {
|
|||
this.y = y;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates an identical copy of this vector.
|
||||
*
|
||||
* @return identical copy
|
||||
* @since v1-alpha2
|
||||
*/
|
||||
@SneakyThrows
|
||||
@NotNull
|
||||
public Vec2i clone() {
|
||||
return (Vec2i) super.clone();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a string representation of this vector.
|
||||
*
|
||||
|
|
|
@ -21,6 +21,7 @@ package de.staropensource.sosengine.base.types.vectors;
|
|||
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import lombok.SneakyThrows;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
/**
|
||||
|
@ -103,6 +104,18 @@ public class Vec3 {
|
|||
this.z = z;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates an identical copy of this vector.
|
||||
*
|
||||
* @return identical copy
|
||||
* @since v1-alpha2
|
||||
*/
|
||||
@SneakyThrows
|
||||
@NotNull
|
||||
public Vec3 clone() {
|
||||
return (Vec3) super.clone();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a string representation of this vector.
|
||||
*
|
||||
|
|
|
@ -21,6 +21,7 @@ package de.staropensource.sosengine.base.types.vectors;
|
|||
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import lombok.SneakyThrows;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
/**
|
||||
|
@ -103,6 +104,18 @@ public class Vec3i {
|
|||
this.z = z;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates an identical copy of this vector.
|
||||
*
|
||||
* @return identical copy
|
||||
* @since v1-alpha2
|
||||
*/
|
||||
@SneakyThrows
|
||||
@NotNull
|
||||
public Vec3i clone() {
|
||||
return (Vec3i) super.clone();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a string representation of this vector.
|
||||
*
|
||||
|
|
Loading…
Reference in a new issue