From c978d47e7e619d5f73f71ce12e4cbf13b334398f Mon Sep 17 00:00:00 2001 From: kruland2607 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. git-svn-id: https://openrocket.svn.sourceforge.net/svnroot/openrocket/trunk@687 180e2498-e6e9-4542-8430-84ac67f01cd8 --- 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 3bc981aa..0f65ffa4 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 ); + } } -- 2.47.2