Skip to content

Commit

Permalink
Implement Cloneable for all classes (#279)
Browse files Browse the repository at this point in the history
  • Loading branch information
httpdigest committed Feb 12, 2021
1 parent b6f3bf9 commit 2236936
Show file tree
Hide file tree
Showing 31 changed files with 195 additions and 24 deletions.
6 changes: 5 additions & 1 deletion src/org/joml/AxisAngle4d.java
Expand Up @@ -38,7 +38,7 @@
*
* @author Kai Burjack
*/
public class AxisAngle4d implements Externalizable {
public class AxisAngle4d implements Externalizable, Cloneable {

private static final long serialVersionUID = 1L;

Expand Down Expand Up @@ -899,4 +899,8 @@ public boolean equals(Object obj) {
return true;
}

public Object clone() throws CloneNotSupportedException {
return super.clone();
}

}
6 changes: 5 additions & 1 deletion src/org/joml/AxisAngle4f.java
Expand Up @@ -38,7 +38,7 @@
*
* @author Kai Burjack
*/
public class AxisAngle4f implements Externalizable {
public class AxisAngle4f implements Externalizable, Cloneable {

private static final long serialVersionUID = 1L;

Expand Down Expand Up @@ -806,4 +806,8 @@ public boolean equals(Object obj) {
return true;
}

public Object clone() throws CloneNotSupportedException {
return super.clone();
}

}
6 changes: 5 additions & 1 deletion src/org/joml/Matrix2d.java
Expand Up @@ -46,7 +46,7 @@
*
* @author Joseph Burton
*/
public class Matrix2d implements Externalizable, Matrix2dc {
public class Matrix2d implements Externalizable, Cloneable, Matrix2dc {

private static final long serialVersionUID = 1L;

Expand Down Expand Up @@ -1523,4 +1523,8 @@ public boolean isFinite() {
Math.isFinite(m10) && Math.isFinite(m11);
}

public Object clone() throws CloneNotSupportedException {
return super.clone();
}

}
6 changes: 5 additions & 1 deletion src/org/joml/Matrix2f.java
Expand Up @@ -46,7 +46,7 @@
*
* @author Joseph Burton
*/
public class Matrix2f implements Externalizable, Matrix2fc {
public class Matrix2f implements Externalizable, Cloneable, Matrix2fc {

private static final long serialVersionUID = 1L;

Expand Down Expand Up @@ -1416,4 +1416,8 @@ public boolean isFinite() {
Math.isFinite(m10) && Math.isFinite(m11);
}

public Object clone() throws CloneNotSupportedException {
return super.clone();
}

}
6 changes: 5 additions & 1 deletion src/org/joml/Matrix3d.java
Expand Up @@ -46,7 +46,7 @@
* @author Richard Greenlees
* @author Kai Burjack
*/
public class Matrix3d implements Externalizable, Matrix3dc {
public class Matrix3d implements Externalizable, Cloneable, Matrix3dc {

private static final long serialVersionUID = 1L;

Expand Down Expand Up @@ -4722,4 +4722,8 @@ public double quadraticFormProduct(Vector3fc v) {
return quadraticFormProduct(v.x(), v.y(), v.z());
}

public Object clone() throws CloneNotSupportedException {
return super.clone();
}

}
9 changes: 9 additions & 0 deletions src/org/joml/Matrix3dStack.java
Expand Up @@ -174,4 +174,13 @@ public void readExternal(ObjectInput in) throws IOException {
}
}

public Object clone() throws CloneNotSupportedException {
Matrix3dStack cloned = (Matrix3dStack) super.clone();
Matrix3d[] clonedMats = new Matrix3d[mats.length];
for (int i = 0; i < mats.length; i++)
clonedMats[i] = (Matrix3d) mats[i].clone();
cloned.mats = clonedMats;
return cloned;
}

}
6 changes: 5 additions & 1 deletion src/org/joml/Matrix3f.java
Expand Up @@ -49,7 +49,7 @@
* @author Richard Greenlees
* @author Kai Burjack
*/
public class Matrix3f implements Externalizable, Matrix3fc {
public class Matrix3f implements Externalizable, Cloneable, Matrix3fc {

private static final long serialVersionUID = 1L;

Expand Down Expand Up @@ -4127,4 +4127,8 @@ public float quadraticFormProduct(Vector3fc v) {
return quadraticFormProduct(v.x(), v.y(), v.z());
}

public Object clone() throws CloneNotSupportedException {
return super.clone();
}

}
9 changes: 9 additions & 0 deletions src/org/joml/Matrix3fStack.java
Expand Up @@ -174,4 +174,13 @@ public void readExternal(ObjectInput in) throws IOException {
}
}

public Object clone() throws CloneNotSupportedException {
Matrix3fStack cloned = (Matrix3fStack) super.clone();
Matrix3f[] clonedMats = new Matrix3f[mats.length];
for (int i = 0; i < mats.length; i++)
clonedMats[i] = (Matrix3f) mats[i].clone();
cloned.mats = clonedMats;
return cloned;
}

}
6 changes: 5 additions & 1 deletion src/org/joml/Matrix3x2d.java
Expand Up @@ -47,7 +47,7 @@
*
* @author Kai Burjack
*/
public class Matrix3x2d implements Matrix3x2dc, Externalizable {
public class Matrix3x2d implements Matrix3x2dc, Cloneable, Externalizable {

private static final long serialVersionUID = 1L;

Expand Down Expand Up @@ -2488,4 +2488,8 @@ public boolean isFinite() {
Math.isFinite(m20) && Math.isFinite(m21);
}

public Object clone() throws CloneNotSupportedException {
return super.clone();
}

}
11 changes: 10 additions & 1 deletion src/org/joml/Matrix3x2dStack.java
Expand Up @@ -37,7 +37,7 @@
*
* @author Kai Burjack
*/
public class Matrix3x2dStack extends Matrix3x2d {
public class Matrix3x2dStack extends Matrix3x2d implements Cloneable {

private static final long serialVersionUID = 1L;

Expand Down Expand Up @@ -174,4 +174,13 @@ public void readExternal(ObjectInput in) throws IOException {
}
}

public Object clone() throws CloneNotSupportedException {
Matrix3x2dStack cloned = (Matrix3x2dStack) super.clone();
Matrix3x2d[] clonedMats = new Matrix3x2d[mats.length];
for (int i = 0; i < mats.length; i++)
clonedMats[i] = (Matrix3x2d) mats[i].clone();
cloned.mats = clonedMats;
return cloned;
}

}
6 changes: 5 additions & 1 deletion src/org/joml/Matrix3x2f.java
Expand Up @@ -47,7 +47,7 @@
*
* @author Kai Burjack
*/
public class Matrix3x2f implements Matrix3x2fc, Externalizable {
public class Matrix3x2f implements Matrix3x2fc, Externalizable, Cloneable {

private static final long serialVersionUID = 1L;

Expand Down Expand Up @@ -2485,4 +2485,8 @@ public boolean isFinite() {
Math.isFinite(m20) && Math.isFinite(m21);
}

public Object clone() throws CloneNotSupportedException {
return super.clone();
}

}
9 changes: 9 additions & 0 deletions src/org/joml/Matrix3x2fStack.java
Expand Up @@ -174,4 +174,13 @@ public void readExternal(ObjectInput in) throws IOException {
}
}

public Object clone() throws CloneNotSupportedException {
Matrix3x2fStack cloned = (Matrix3x2fStack) super.clone();
Matrix3x2f[] clonedMats = new Matrix3x2f[mats.length];
for (int i = 0; i < mats.length; i++)
clonedMats[i] = (Matrix3x2f) mats[i].clone();
cloned.mats = clonedMats;
return cloned;
}

}
6 changes: 5 additions & 1 deletion src/org/joml/Matrix4d.java
Expand Up @@ -47,7 +47,7 @@
* @author Richard Greenlees
* @author Kai Burjack
*/
public class Matrix4d implements Externalizable, Matrix4dc {
public class Matrix4d implements Externalizable, Cloneable, Matrix4dc {

private static final long serialVersionUID = 1L;

Expand Down Expand Up @@ -15585,4 +15585,8 @@ public boolean isFinite() {
Math.isFinite(m30) && Math.isFinite(m31) && Math.isFinite(m32) && Math.isFinite(m33);
}

public Object clone() throws CloneNotSupportedException {
return super.clone();
}

}
9 changes: 9 additions & 0 deletions src/org/joml/Matrix4dStack.java
Expand Up @@ -173,4 +173,13 @@ public void readExternal(ObjectInput in) throws IOException {
}
}

public Object clone() throws CloneNotSupportedException {
Matrix4dStack cloned = (Matrix4dStack) super.clone();
Matrix4d[] clonedMats = new Matrix4d[mats.length];
for (int i = 0; i < mats.length; i++)
clonedMats[i] = (Matrix4d) mats[i].clone();
cloned.mats = clonedMats;
return cloned;
}

}
6 changes: 5 additions & 1 deletion src/org/joml/Matrix4f.java
Expand Up @@ -50,7 +50,7 @@
* @author Richard Greenlees
* @author Kai Burjack
*/
public class Matrix4f implements Externalizable, Matrix4fc {
public class Matrix4f implements Externalizable, Cloneable, Matrix4fc {

private static final long serialVersionUID = 1L;

Expand Down Expand Up @@ -14415,4 +14415,8 @@ public boolean isFinite() {
Math.isFinite(m30) && Math.isFinite(m31) && Math.isFinite(m32) && Math.isFinite(m33);
}

public Object clone() throws CloneNotSupportedException {
return super.clone();
}

}
9 changes: 9 additions & 0 deletions src/org/joml/Matrix4fStack.java
Expand Up @@ -173,4 +173,13 @@ public void readExternal(ObjectInput in) throws IOException {
}
}

public Object clone() throws CloneNotSupportedException {
Matrix4fStack cloned = (Matrix4fStack) super.clone();
Matrix4f[] clonedMats = new Matrix4f[mats.length];
for (int i = 0; i < mats.length; i++)
clonedMats[i] = (Matrix4f) mats[i].clone();
cloned.mats = clonedMats;
return cloned;
}

}
6 changes: 5 additions & 1 deletion src/org/joml/Matrix4x3d.java
Expand Up @@ -46,7 +46,7 @@
* @author Richard Greenlees
* @author Kai Burjack
*/
public class Matrix4x3d implements Externalizable, Matrix4x3dc {
public class Matrix4x3d implements Externalizable, Cloneable, Matrix4x3dc {

private static final long serialVersionUID = 1L;

Expand Down Expand Up @@ -9760,4 +9760,8 @@ public boolean isFinite() {
Math.isFinite(m30) && Math.isFinite(m31) && Math.isFinite(m32);
}

public Object clone() throws CloneNotSupportedException {
return super.clone();
}

}
9 changes: 9 additions & 0 deletions src/org/joml/Matrix4x3dStack.java
Expand Up @@ -174,4 +174,13 @@ public void readExternal(ObjectInput in) throws IOException {
}
}

public Object clone() throws CloneNotSupportedException {
Matrix4x3dStack cloned = (Matrix4x3dStack) super.clone();
Matrix4x3d[] clonedMats = new Matrix4x3d[mats.length];
for (int i = 0; i < mats.length; i++)
clonedMats[i] = (Matrix4x3d) mats[i].clone();
cloned.mats = clonedMats;
return cloned;
}

}
6 changes: 5 additions & 1 deletion src/org/joml/Matrix4x3f.java
Expand Up @@ -49,7 +49,7 @@
* @author Richard Greenlees
* @author Kai Burjack
*/
public class Matrix4x3f implements Externalizable, Matrix4x3fc {
public class Matrix4x3f implements Externalizable, Cloneable, Matrix4x3fc {

private static final long serialVersionUID = 1L;

Expand Down Expand Up @@ -8974,4 +8974,8 @@ public boolean isFinite() {
Math.isFinite(m30) && Math.isFinite(m31) && Math.isFinite(m32);
}

public Object clone() throws CloneNotSupportedException {
return super.clone();
}

}
9 changes: 9 additions & 0 deletions src/org/joml/Matrix4x3fStack.java
Expand Up @@ -174,4 +174,13 @@ public void readExternal(ObjectInput in) throws IOException {
}
}

public Object clone() throws CloneNotSupportedException {
Matrix4x3fStack cloned = (Matrix4x3fStack) super.clone();
Matrix4x3f[] clonedMats = new Matrix4x3f[mats.length];
for (int i = 0; i < mats.length; i++)
clonedMats[i] = (Matrix4x3f) mats[i].clone();
cloned.mats = clonedMats;
return cloned;
}

}
7 changes: 6 additions & 1 deletion src/org/joml/Quaterniond.java
Expand Up @@ -36,7 +36,7 @@
* @author Richard Greenlees
* @author Kai Burjack
*/
public class Quaterniond implements Externalizable, Quaterniondc {
public class Quaterniond implements Externalizable, Cloneable, Quaterniondc {

private static final long serialVersionUID = 1L;

Expand Down Expand Up @@ -2970,4 +2970,9 @@ public boolean equals(double x, double y, double z, double w) {
return false;
return true;
}

public Object clone() throws CloneNotSupportedException {
return super.clone();
}

}
7 changes: 6 additions & 1 deletion src/org/joml/Quaternionf.java
Expand Up @@ -40,7 +40,7 @@
* @author Richard Greenlees
* @author Kai Burjack
*/
public class Quaternionf implements Externalizable, Quaternionfc {
public class Quaternionf implements Externalizable, Cloneable, Quaternionfc {

private static final long serialVersionUID = 1L;

Expand Down Expand Up @@ -3055,4 +3055,9 @@ public boolean equals(float x, float y, float z, float w) {
return false;
return true;
}

public Object clone() throws CloneNotSupportedException {
return super.clone();
}

}
7 changes: 6 additions & 1 deletion src/org/joml/Vector2d.java
Expand Up @@ -41,7 +41,7 @@
* @author Kai Burjack
* @author F. Neurath
*/
public class Vector2d implements Externalizable, Vector2dc {
public class Vector2d implements Externalizable, Cloneable, Vector2dc {

private static final long serialVersionUID = 1L;

Expand Down Expand Up @@ -1368,4 +1368,9 @@ public Vector2d absolute(Vector2d dest) {
dest.y = Math.abs(this.y);
return dest;
}

public Object clone() throws CloneNotSupportedException {
return super.clone();
}

}

0 comments on commit 2236936

Please sign in to comment.