toString, equals.
This commit is contained in:
parent
7b7bc6efb6
commit
f2bfc73b88
7 changed files with 23 additions and 13 deletions
|
@ -65,7 +65,7 @@ public class CommandResult {
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return "CommandResult{" +
|
return "CommandResult{" +
|
||||||
", success=" + success +
|
"success=" + success +
|
||||||
", exception=" + exception +
|
", exception=" + exception +
|
||||||
", state=" + state +
|
", state=" + state +
|
||||||
", history=" + history +
|
", history=" + history +
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
package de.jotomo.ruffy.spi.history;
|
package de.jotomo.ruffy.spi.history;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
public class Bolus extends HistoryRecord {
|
public class Bolus extends HistoryRecord {
|
||||||
public final double amount;
|
public final double amount;
|
||||||
public final boolean isValid;
|
public final boolean isValid;
|
||||||
|
@ -20,7 +22,7 @@ public class Bolus extends HistoryRecord {
|
||||||
|
|
||||||
if (timestamp != bolus.timestamp) return false;
|
if (timestamp != bolus.timestamp) return false;
|
||||||
if (isValid != bolus.isValid) return false;
|
if (isValid != bolus.isValid) return false;
|
||||||
return Double.compare(bolus.amount, amount) == 0;
|
return Math.abs(bolus.amount - amount) <= 0.05;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -37,7 +39,7 @@ public class Bolus extends HistoryRecord {
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return "Bolus{" +
|
return "Bolus{" +
|
||||||
"timestamp=" + timestamp +
|
"timestamp=" + timestamp + "(" + new Date(timestamp) + ")" +
|
||||||
", amount=" + amount +
|
", amount=" + amount +
|
||||||
'}';
|
'}';
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
package de.jotomo.ruffy.spi.history;
|
package de.jotomo.ruffy.spi.history;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
public class PumpError extends HistoryRecord {
|
public class PumpError extends HistoryRecord {
|
||||||
public final Integer warningCode;
|
public final Integer warningCode;
|
||||||
public final Integer errorCode;
|
public final Integer errorCode;
|
||||||
|
@ -40,7 +42,7 @@ public class PumpError extends HistoryRecord {
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return "PumpError{" +
|
return "PumpError{" +
|
||||||
"timestamp=" + timestamp +
|
"timestamp=" + timestamp + "(" + new Date(timestamp) + ")" +
|
||||||
", warningCode=" + warningCode +
|
", warningCode=" + warningCode +
|
||||||
", errorCode=" + errorCode +
|
", errorCode=" + errorCode +
|
||||||
", message='" + message + '\'' +
|
", message='" + message + '\'' +
|
||||||
|
|
|
@ -41,7 +41,7 @@ public class PumpHistory {
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return "PumpHistory{" +
|
return "PumpHistory{" +
|
||||||
", bolusHistory=" + bolusHistory.size() +
|
"bolusHistory=" + bolusHistory.size() +
|
||||||
", tbrHistory=" + tbrHistory.size() +
|
", tbrHistory=" + tbrHistory.size() +
|
||||||
", pumpErrorHistory=" + pumpErrorHistory.size() +
|
", pumpErrorHistory=" + pumpErrorHistory.size() +
|
||||||
", tddHistory=" + tddHistory.size() +
|
", tddHistory=" + tddHistory.size() +
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
package de.jotomo.ruffy.spi.history;
|
package de.jotomo.ruffy.spi.history;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
/** What data a 'read history' request should return. */
|
/** What data a 'read history' request should return. */
|
||||||
public class PumpHistoryRequest {
|
public class PumpHistoryRequest {
|
||||||
/* History to read:
|
/* History to read:
|
||||||
|
@ -38,10 +40,10 @@ public class PumpHistoryRequest {
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return "PumpHistoryRequest{" +
|
return "PumpHistoryRequest{" +
|
||||||
", bolusHistory=" + bolusHistory +
|
"bolusHistory=" + bolusHistory + (bolusHistory > 0 ? ("(" + new Date(bolusHistory) + ")") : "") +
|
||||||
", tbrHistory=" + tbrHistory +
|
", tbrHistory=" + tbrHistory + (tbrHistory > 0 ? ("(" + new Date(tbrHistory) + ")") : "") +
|
||||||
", pumpErrorHistory=" + pumpErrorHistory +
|
", pumpErrorHistory=" + pumpErrorHistory + (pumpErrorHistory > 0 ? ("(" + new Date(pumpErrorHistory) + ")") : "") +
|
||||||
", tddHistory=" + tddHistory +
|
", tddHistory=" + tddHistory + (tddHistory > 0 ? ("(" + new Date(tddHistory) + ")") : "") +
|
||||||
'}';
|
'}';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,9 @@
|
||||||
package de.jotomo.ruffy.spi.history;
|
package de.jotomo.ruffy.spi.history;
|
||||||
|
|
||||||
/** Note: the timestamp is the time the TBR **ended**, not started .*/
|
import java.util.Date;
|
||||||
|
|
||||||
public class Tbr extends HistoryRecord {
|
public class Tbr extends HistoryRecord {
|
||||||
|
/** Duration in minutes */
|
||||||
public final int duration;
|
public final int duration;
|
||||||
public final int percent;
|
public final int percent;
|
||||||
|
|
||||||
|
@ -34,7 +36,7 @@ public class Tbr extends HistoryRecord {
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return "Tbr{" +
|
return "Tbr{" +
|
||||||
"timestamp=" + timestamp +
|
"timestamp=" + timestamp + "(" + new Date(timestamp) + ")" +
|
||||||
", duration=" + duration +
|
", duration=" + duration +
|
||||||
", percent=" + percent +
|
", percent=" + percent +
|
||||||
'}';
|
'}';
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
package de.jotomo.ruffy.spi.history;
|
package de.jotomo.ruffy.spi.history;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
/** Total daily dosage; amount of insulin delivered over a full day. */
|
/** Total daily dosage; amount of insulin delivered over a full day. */
|
||||||
public class Tdd extends HistoryRecord {
|
public class Tdd extends HistoryRecord {
|
||||||
public final double total;
|
public final double total;
|
||||||
|
@ -17,7 +19,7 @@ public class Tdd extends HistoryRecord {
|
||||||
Tdd tdd = (Tdd) o;
|
Tdd tdd = (Tdd) o;
|
||||||
|
|
||||||
if (timestamp != tdd.timestamp) return false;
|
if (timestamp != tdd.timestamp) return false;
|
||||||
return Double.compare(tdd.total, total) == 0;
|
return Math.abs(tdd.total - total) <= 0.05;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -33,7 +35,7 @@ public class Tdd extends HistoryRecord {
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return "Tdd{" +
|
return "Tdd{" +
|
||||||
"timestamp=" + timestamp +
|
"timestamp=" + timestamp + "(" + new Date(timestamp) + ")" +
|
||||||
", total=" + total +
|
", total=" + total +
|
||||||
'}';
|
'}';
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue