IobTotal implements DataPointWithLabelInterface { public IobTotal plus(IobTotal other) { iob += other.iob; activity += other.activity; bolussnooze += other.bolussnooze; basaliob += other.basaliob; netbasalinsulin += other.netbasalinsulin; hightempinsulin += other.hightempinsulin; netInsulin += other.netInsulin; extendedBolusInsulin += other.extendedBolusInsulin; 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 plusTest() { IobTotal a = new IobTotal(now); a.iob = 10; a.activity = 10; a.bolussnooze = 10; a.basaliob = 10; a.netbasalinsulin = 10; a.hightempinsulin = 10; a.netInsulin = 10; a.extendedBolusInsulin = 10; a.plus(a.copy()); Assert.assertEquals(20, a.iob, 0.01d); Assert.assertEquals(20, a.activity, 0.01d); Assert.assertEquals(20, a.bolussnooze, 0.01d); Assert.assertEquals(20, a.basaliob, 0.01d); Assert.assertEquals(20, a.netbasalinsulin, 0.01d); Assert.assertEquals(20, a.hightempinsulin, 0.01d); Assert.assertEquals(20, a.netInsulin, 0.01d); Assert.assertEquals(20, a.extendedBolusInsulin, 0.01d); }