From 672239535a56a56199545fdfe66b84c3d63653a5 Mon Sep 17 00:00:00 2001 From: Kevin Ruland Date: Wed, 16 May 2012 06:18:54 +0000 Subject: [PATCH] Added clone() implementation to support the ThrustCurveMotor copy constructor. Added serialVersionUID constant from the previous implementation to provide backwards compatibility with serialzied data in the android database. --- core/src/net/sf/openrocket/util/Coordinate.java | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/core/src/net/sf/openrocket/util/Coordinate.java b/core/src/net/sf/openrocket/util/Coordinate.java index 3bc981aaa..0f65ffa49 100644 --- a/core/src/net/sf/openrocket/util/Coordinate.java +++ b/core/src/net/sf/openrocket/util/Coordinate.java @@ -12,8 +12,11 @@ import net.sf.openrocket.startup.Application; * * @author Sampo Niskanen */ -public final class Coordinate implements Serializable { +public final class Coordinate implements Cloneable, Serializable { private static final LogHelper log = Application.getLogger(); + + // Defined for backwards compatibility after adding clone(). + static final long serialVersionUID = 585574649794259293L; //////// Debug section /* @@ -68,8 +71,6 @@ public final class Coordinate implements Serializable { private double length = -1; /* Cached when calculated */ - - public Coordinate() { this(0, 0, 0, 0); } @@ -315,6 +316,10 @@ public final class Coordinate implements Serializable { else return String.format("(%.3f,%.3f,%.3f)", x, y, z); } - + + @Override + public Coordinate clone() { + return new Coordinate( this.x, this.y, this.z, this.weight ); + } }