use primitives in inner loops
This commit is contained in:
parent
fb7af2f317
commit
26daffa692
|
@ -9,17 +9,17 @@ import info.nightscout.utils.DateUtil;
|
|||
import info.nightscout.utils.Round;
|
||||
|
||||
public class IobTotal {
|
||||
public Double iob;
|
||||
public Double activity;
|
||||
public Double bolussnooze;
|
||||
public Double basaliob;
|
||||
public Double netbasalinsulin;
|
||||
public Double hightempinsulin;
|
||||
public double iob;
|
||||
public double activity;
|
||||
public double bolussnooze;
|
||||
public double basaliob;
|
||||
public double netbasalinsulin;
|
||||
public double hightempinsulin;
|
||||
|
||||
public Double netInsulin = 0d; // for calculations from temp basals only
|
||||
public Double netRatio = 0d; // net ratio at start of temp basal
|
||||
public double netInsulin = 0d; // for calculations from temp basals only
|
||||
public double netRatio = 0d; // net ratio at start of temp basal
|
||||
|
||||
public Double extendedBolusInsulin = 0d; // total insulin for extended bolus
|
||||
public double extendedBolusInsulin = 0d; // total insulin for extended bolus
|
||||
|
||||
long time;
|
||||
|
||||
|
|
|
@ -176,13 +176,13 @@ public class ExtendedBolus implements Interval, DataPointWithLabelInterface {
|
|||
int realDuration = getDurationToTime(time);
|
||||
|
||||
if (realDuration > 0) {
|
||||
Double dia_ago = time - dia * 60 * 60 * 1000;
|
||||
double dia_ago = time - dia * 60 * 60 * 1000;
|
||||
int aboutFiveMinIntervals = (int) Math.ceil(realDuration / 5d);
|
||||
double spacing = realDuration / aboutFiveMinIntervals;
|
||||
|
||||
for (Long j = 0L; j < aboutFiveMinIntervals; j++) {
|
||||
for (long j = 0L; j < aboutFiveMinIntervals; j++) {
|
||||
// find middle of the interval
|
||||
Long calcdate = (long) (date + j * spacing * 60 * 1000 + 0.5d * spacing * 60 * 1000);
|
||||
long calcdate = (long) (date + j * spacing * 60 * 1000 + 0.5d * spacing * 60 * 1000);
|
||||
|
||||
if (calcdate > dia_ago && calcdate <= time) {
|
||||
double tempBolusSize = absoluteRate() * spacing / 60d;
|
||||
|
|
|
@ -175,18 +175,18 @@ public class TemporaryBasal implements Interval {
|
|||
InsulinInterface insulinInterface = ConfigBuilderPlugin.getActiveInsulin();
|
||||
|
||||
int realDuration = getDurationToTime(time);
|
||||
Double netBasalAmount = 0d;
|
||||
double netBasalAmount = 0d;
|
||||
|
||||
if (realDuration > 0) {
|
||||
Double netBasalRate = 0d;
|
||||
double netBasalRate = 0d;
|
||||
double dia = profile.getDia();
|
||||
Double dia_ago = time - dia * 60 * 60 * 1000;
|
||||
double dia_ago = time - dia * 60 * 60 * 1000;
|
||||
int aboutFiveMinIntervals = (int) Math.ceil(realDuration / 5d);
|
||||
double tempBolusSpacing = realDuration / aboutFiveMinIntervals;
|
||||
|
||||
for (Long j = 0L; j < aboutFiveMinIntervals; j++) {
|
||||
for (long j = 0L; j < aboutFiveMinIntervals; j++) {
|
||||
// find middle of the interval
|
||||
Long calcdate = (long) (date + j * tempBolusSpacing * 60 * 1000 + 0.5d * tempBolusSpacing * 60 * 1000);
|
||||
long calcdate = (long) (date + j * tempBolusSpacing * 60 * 1000 + 0.5d * tempBolusSpacing * 60 * 1000);
|
||||
|
||||
Double basalRate = profile.getBasal(calcdate);
|
||||
|
||||
|
|
|
@ -151,9 +151,9 @@ public class OpenAPSAMAPlugin implements PluginBase, APSInterface {
|
|||
|
||||
String units = profile.getUnits();
|
||||
|
||||
Double maxBgDefault = Constants.MAX_BG_DEFAULT_MGDL;
|
||||
Double minBgDefault = Constants.MIN_BG_DEFAULT_MGDL;
|
||||
Double targetBgDefault = Constants.TARGET_BG_DEFAULT_MGDL;
|
||||
double maxBgDefault = Constants.MAX_BG_DEFAULT_MGDL;
|
||||
double minBgDefault = Constants.MIN_BG_DEFAULT_MGDL;
|
||||
double targetBgDefault = Constants.TARGET_BG_DEFAULT_MGDL;
|
||||
if (!units.equals(Constants.MGDL)) {
|
||||
maxBgDefault = Constants.MAX_BG_DEFAULT_MMOL;
|
||||
minBgDefault = Constants.MIN_BG_DEFAULT_MMOL;
|
||||
|
|
|
@ -17,8 +17,8 @@ import info.nightscout.utils.SP;
|
|||
*/
|
||||
public class OverviewPlugin implements PluginBase {
|
||||
|
||||
public static Double bgTargetLow = 80d;
|
||||
public static Double bgTargetHigh = 180d;
|
||||
public static double bgTargetLow = 80d;
|
||||
public static double bgTargetHigh = 180d;
|
||||
|
||||
public QuickWizard quickWizard = new QuickWizard();
|
||||
|
||||
|
|
|
@ -20,7 +20,7 @@ public class MsgStatus_k extends MessageBase {
|
|||
pump.isExtendedInProgress = intFromBuff(bytes, 3, 1) == 1;
|
||||
pump.extendedBolusMinutes = intFromBuff(bytes, 4, 2);
|
||||
pump.extendedBolusAmount = intFromBuff(bytes, 6, 2) / 100d;
|
||||
Double lastBolusAmount = intFromBuff(bytes, 13, 2) / 100d;
|
||||
double lastBolusAmount = intFromBuff(bytes, 13, 2) / 100d;
|
||||
// if (lastBolusAmount != 0d) {
|
||||
// pump.lastBolusTime = dateTimeFromBuff(bytes, 8);
|
||||
// pump.lastBolusAmount = lastBolusAmount;
|
||||
|
|
|
@ -174,7 +174,7 @@ public class TreatmentsPlugin implements PluginBase, TreatmentsInterface {
|
|||
if (profile == null)
|
||||
return total;
|
||||
|
||||
Double dia = profile.getDia();
|
||||
double dia = profile.getDia();
|
||||
|
||||
for (Integer pos = 0; pos < treatments.size(); pos++) {
|
||||
Treatment t = treatments.get(pos);
|
||||
|
@ -360,8 +360,8 @@ public class TreatmentsPlugin implements PluginBase, TreatmentsInterface {
|
|||
if (tb.isAbsolute) {
|
||||
return tb.absoluteRate;
|
||||
} else {
|
||||
Double baseRate = pump.getBaseBasalRate();
|
||||
Double tempRate = baseRate * (tb.percentRate / 100d);
|
||||
double baseRate = pump.getBaseBasalRate();
|
||||
double tempRate = baseRate * (tb.percentRate / 100d);
|
||||
return tempRate;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,7 +4,7 @@ package info.nightscout.utils;
|
|||
* Created by mike on 20.06.2016.
|
||||
*/
|
||||
public class Round {
|
||||
public static Double roundTo(Double x, Double step) {
|
||||
public static Double roundTo(double x, Double step) {
|
||||
if (x != 0d) {
|
||||
return Math.round(x / step) * step;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue