IobTotal implements DataPointWithLabelInterface { public IobTotal round() { this.iob = Round.roundTo(this.iob, 0.001); this.activity = Round.roundTo(this.activity, 0.0001); this.bolussnooze = Round.roundTo(this.bolussnooze, 0.0001); this.basaliob = Round.roundTo(this.basaliob, 0.001); this.netbasalinsulin = Round.roundTo(this.netbasalinsulin, 0.001); this.hightempinsulin = Round.roundTo(this.hightempinsulin, 0.001); this.netInsulin = Round.roundTo(this.netInsulin, 0.001); this.extendedBolusInsulin = Round.roundTo(this.extendedBolusInsulin, 0.001); return this; } IobTotal(long time); IobTotal copy(); IobTotal plus(IobTotal other); static IobTotal combine(IobTotal bolusIOB, IobTotal basalIob); IobTotal round(); JSONObject json(); JSONObject determineBasalJson(); @Override double getX(); @Override double getY(); @Override void setY(double y); @Override String getLabel(); @Override long getDuration(); @Override PointsWithLabelGraphSeries.Shape getShape(); @Override float getSize(); @Override int getColor(); IobTotal setColor(int color); public double iob; public double activity; public double bolussnooze; public double basaliob; public double netbasalinsulin; public double hightempinsulin; public long lastBolusTime; public IobTotal iobWithZeroTemp; public double netInsulin; public double netRatio; public double extendedBolusInsulin; }
@Test public void roundTest() { IobTotal a = new IobTotal(now); a.iob = 1.1111111111111; a.activity = 1.1111111111111; a.bolussnooze = 1.1111111111111; a.basaliob = 1.1111111111111; a.netbasalinsulin = 1.1111111111111; a.hightempinsulin = 1.1111111111111; a.netInsulin = 1.1111111111111; a.extendedBolusInsulin = 1.1111111111111; a.round(); Assert.assertEquals(1.111d, a.iob, 0.00001d); Assert.assertEquals(1.1111d, a.activity, 0.00001d); Assert.assertEquals(1.1111d, a.bolussnooze, 0.00001d); Assert.assertEquals(1.111d, a.basaliob, 0.00001d); Assert.assertEquals(1.111d, a.netbasalinsulin, 0.00001d); Assert.assertEquals(1.111d, a.hightempinsulin, 0.00001d); Assert.assertEquals(1.111d, a.netInsulin, 0.00001d); Assert.assertEquals(1.111d, a.extendedBolusInsulin, 0.00001d); }