From 1ba3a85655386feed51394bae5399fe5eac09e71 Mon Sep 17 00:00:00 2001 From: Johannes Mockenhaupt Date: Wed, 31 Jan 2018 13:54:15 +0100 Subject: [PATCH] Add DetailedBolusInfo.copy() method. --- .../androidaps/data/DetailedBolusInfo.java | 22 ++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/info/nightscout/androidaps/data/DetailedBolusInfo.java b/app/src/main/java/info/nightscout/androidaps/data/DetailedBolusInfo.java index 7720b03d3e..07dd1c9ed3 100644 --- a/app/src/main/java/info/nightscout/androidaps/data/DetailedBolusInfo.java +++ b/app/src/main/java/info/nightscout/androidaps/data/DetailedBolusInfo.java @@ -6,16 +6,14 @@ import org.json.JSONObject; import java.util.Date; -import info.nightscout.androidaps.MainApp; import info.nightscout.androidaps.db.CareportalEvent; import info.nightscout.androidaps.db.Source; -import info.nightscout.androidaps.interfaces.InsulinInterface; /** * Created by mike on 29.05.2017. */ -public class DetailedBolusInfo { +public class DetailedBolusInfo implements Cloneable { public long date = System.currentTimeMillis(); public String eventType = CareportalEvent.MEALBOLUS; public double insulin = 0; @@ -30,6 +28,24 @@ public class DetailedBolusInfo { public long pumpId = 0; // id of record if comming from pump history (not a newly created treatment) public boolean isSMB = false; // is a Super-MicroBolus + public DetailedBolusInfo copy() { + DetailedBolusInfo copy = new DetailedBolusInfo(); + copy.date = this.date; + copy.eventType = this.eventType; + copy.insulin = this.insulin; + copy.carbs = this.carbs; + copy.source = this.source; + copy.isValid = this.isValid; + copy.glucose = this.glucose; + copy.glucoseType = this.glucoseType; + copy.carbTime = this.carbTime; + copy.boluscalc = this.boluscalc; + copy.context = this.context; + copy.pumpId = this.pumpId; + copy.isSMB = this.isSMB; + return copy; + } + @Override public String toString() { return new Date(date).toLocaleString() +