AndroidAPS/app/src/main/java/info/nightscout/androidaps/db/TDD.java

60 lines
1.3 KiB
Java
Raw Normal View History

2018-03-14 00:57:48 +01:00
package info.nightscout.androidaps.db;
import com.j256.ormlite.field.DatabaseField;
import com.j256.ormlite.table.DatabaseTable;
2018-03-14 00:57:48 +01:00
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
2018-07-30 15:46:20 +02:00
import info.nightscout.androidaps.logging.L;
import info.nightscout.androidaps.plugins.pump.common.utils.DateTimeUtil;
2018-07-30 15:46:20 +02:00
2018-03-14 00:57:48 +01:00
/**
* Created by mike on 20.09.2017.
*/
2018-03-14 00:57:48 +01:00
@DatabaseTable(tableName = DatabaseHelper.DATABASE_TDDS)
public class TDD {
2018-07-30 15:46:20 +02:00
private static Logger log = LoggerFactory.getLogger(L.DATABASE);
2018-03-14 00:57:48 +01:00
@DatabaseField(id = true)
public long date;
@DatabaseField
public double bolus;
@DatabaseField
public double basal;
@DatabaseField
public double total;
public double getTotal(){
return (total > 0d) ? total:(bolus+basal);
2018-03-14 00:57:48 +01:00
}
public TDD() { }
2018-03-14 00:57:48 +01:00
public TDD(long date, double bolus, double basal, double total){
2018-03-14 00:57:48 +01:00
this.date = date;
this.bolus = bolus;
this.basal = basal;
this.total = total;
}
@Override
public String toString() {
return "TDD [" +
"date=" + date +
"date(str)=" + DateTimeUtil.toStringFromTimeInMillis(date) +
", bolus=" + bolus +
", basal=" + basal +
", total=" + total +
']';
}
}