From 551ca92201e3fceb622e4750d0578b900adff9df Mon Sep 17 00:00:00 2001 From: Johannes Mockenhaupt Date: Tue, 24 Oct 2017 23:13:29 +0200 Subject: [PATCH] Remove cast to DetermineBasalResultAMA for predictions. --- .../plugins/Overview/OverviewFragment.java | 2 +- .../plugins/Overview/graphData/GraphData.java | 15 ++++++--------- 2 files changed, 7 insertions(+), 10 deletions(-) diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/Overview/OverviewFragment.java b/app/src/main/java/info/nightscout/androidaps/plugins/Overview/OverviewFragment.java index d2e5a6943d..a7567508a8 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/Overview/OverviewFragment.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/Overview/OverviewFragment.java @@ -1323,7 +1323,7 @@ public class OverviewFragment extends Fragment implements View.OnClickListener, // **** BG **** if (showPrediction) - graphData.addBgReadings(bgGraph, fromTime, toTime, lowLine, highLine, (DetermineBasalResultAMA) finalLastRun.constraintsProcessed); + graphData.addBgReadings(bgGraph, fromTime, toTime, lowLine, highLine, finalLastRun.constraintsProcessed); else graphData.addBgReadings(bgGraph, fromTime, toTime, lowLine, highLine, null); diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/Overview/graphData/GraphData.java b/app/src/main/java/info/nightscout/androidaps/plugins/Overview/graphData/GraphData.java index dec8da3334..10e7179483 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/Overview/graphData/GraphData.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/Overview/graphData/GraphData.java @@ -12,7 +12,6 @@ import com.jjoe64.graphview.series.LineGraphSeries; import com.jjoe64.graphview.series.Series; import java.util.ArrayList; -import java.util.Iterator; import java.util.List; import info.nightscout.androidaps.Constants; @@ -27,7 +26,7 @@ import info.nightscout.androidaps.db.Treatment; import info.nightscout.androidaps.plugins.IobCobCalculator.AutosensData; import info.nightscout.androidaps.plugins.IobCobCalculator.IobCobCalculatorPlugin; import info.nightscout.androidaps.plugins.IobCobCalculator.events.BasalData; -import info.nightscout.androidaps.plugins.OpenAPSAMA.DetermineBasalResultAMA; +import info.nightscout.androidaps.plugins.Loop.APSResult; import info.nightscout.androidaps.plugins.Overview.graphExtensions.AreaGraphSeries; import info.nightscout.androidaps.plugins.Overview.graphExtensions.DataPointWithLabelInterface; import info.nightscout.androidaps.plugins.Overview.graphExtensions.DoubleDataPoint; @@ -52,7 +51,7 @@ public class GraphData { private List bgReadingsArray; private String units; - public void addBgReadings(GraphView bgGraph, long fromTime, long toTime, double lowLine, double highLine, DetermineBasalResultAMA amaResult) { + public void addBgReadings(GraphView bgGraph, long fromTime, long toTime, double lowLine, double highLine, APSResult apsResult) { double maxBgValue = 0d; bgReadingsArray = MainApp.getDbHelper().getBgreadingsDataFromTime(fromTime, true); List bgListArray = new ArrayList<>(); @@ -61,14 +60,12 @@ public class GraphData { return; } - Iterator it = bgReadingsArray.iterator(); - while (it.hasNext()) { - BgReading bg = it.next(); + for (BgReading bg : bgReadingsArray) { if (bg.value > maxBgValue) maxBgValue = bg.value; bgListArray.add(bg); } - if (amaResult != null) { - List predArray = amaResult.getPredictions(); + if (apsResult != null) { + List predArray = apsResult.getPredictions(); bgListArray.addAll(predArray); } @@ -266,7 +263,7 @@ public class GraphData { } } - double getNearestBg(long date) { + private double getNearestBg(long date) { double bg = 0; for (int r = bgReadingsArray.size() - 1; r >= 0; r--) { BgReading reading = bgReadingsArray.get(r);