AutosensResult -> kt

This commit is contained in:
Milos Kozak 2021-05-26 16:00:35 +02:00
parent 6e19d60796
commit 867e205ab6
4 changed files with 23 additions and 55 deletions

View file

@ -1,15 +0,0 @@
package info.nightscout.androidaps.db;
import java.util.concurrent.ScheduledFuture;
/**
* Created by triplem on 05.01.18.
*/
public interface ICallback {
void setPost(ScheduledFuture<?> post);
ScheduledFuture<?> getPost();
}

View file

@ -1,39 +0,0 @@
package info.nightscout.androidaps.plugins.iob.iobCobCalculator;
import org.json.JSONException;
import org.json.JSONObject;
import org.slf4j.LoggerFactory;
import info.nightscout.androidaps.logging.LTag;
/**
* Created by mike on 06.01.2017.
*/
public class AutosensResult {
//default values to show when autosens algorithm is not called
public double ratio = 1d;
public double carbsAbsorbed = 0d;
public String sensResult = "autosens not available";
public String pastSensitivity = "";
public String ratioLimit = "";
public JSONObject json() {
JSONObject ret = new JSONObject();
try {
ret.put("ratio", ratio);
ret.put("ratioLimit", ratioLimit);
ret.put("pastSensitivity", pastSensitivity);
ret.put("sensResult", sensResult);
ret.put("ratio", ratio);
} catch (JSONException e) {
LoggerFactory.getLogger(LTag.CORE.getTag()).error("Unhandled exception", e);
}
return ret;
}
@Override
public String toString() {
return json().toString();
}
}

View file

@ -0,0 +1,22 @@
package info.nightscout.androidaps.plugins.iob.iobCobCalculator
import org.json.JSONObject
class AutosensResult {
//default values to show when autosens algorithm is not called
var ratio = 1.0
var carbsAbsorbed = 0.0
var sensResult = "autosens not available"
var pastSensitivity = ""
var ratioLimit = ""
fun json(): JSONObject = JSONObject()
.put("ratio", ratio)
.put("ratioLimit", ratioLimit)
.put("pastSensitivity", pastSensitivity)
.put("sensResult", sensResult)
.put("ratio", ratio)
override fun toString(): String = json().toString()
}

View file

@ -108,7 +108,7 @@ public class AutosensData implements DataPointWithLabelInterface {
@NonNull @Override
public String toString() {
return String.format(Locale.ENGLISH, "AutosensData: %s pastSensitivity=%s delta=%.02f avgDelta=%.02f bgi=%.02f deviation=%.02f avgDeviation=%.02f absorbed=%.02f carbsFromBolus=%.02f cob=%.02f autosensRatio=%.02f slopeFromMaxDeviation=%.02f slopeFromMinDeviation=%.02f activeCarbsList=%s",
dateUtil.dateAndTimeString(time), pastSensitivity, delta, avgDelta, bgi, deviation, avgDeviation, absorbed, carbsFromBolus, cob, autosensResult.ratio, slopeFromMaxDeviation, slopeFromMinDeviation, activeCarbsList.toString());
dateUtil.dateAndTimeString(time), pastSensitivity, delta, avgDelta, bgi, deviation, avgDeviation, absorbed, carbsFromBolus, cob, autosensResult.getRatio(), slopeFromMaxDeviation, slopeFromMinDeviation, activeCarbsList.toString());
}
public List<CarbsInPast> cloneCarbsList() {