AndroidAPS/app/src/main/java/info/nightscout/androidaps/data/Iob.java

48 lines
1.2 KiB
Java
Raw Normal View History

2016-06-05 14:53:03 +02:00
package info.nightscout.androidaps.data;
/**
* Created by mike on 05.06.2016.
*/
public class Iob {
public double iobContrib = 0d;
public double activityContrib = 0d;
2018-03-27 14:36:43 +02:00
public Iob iobContrib(double iobContrib) {
this.iobContrib = iobContrib;
return this;
}
public Iob activityContrib(double activityContrib) {
this.activityContrib = activityContrib;
return this;
}
2016-06-05 14:53:03 +02:00
public Iob plus(Iob iob) {
iobContrib += iob.iobContrib;
activityContrib += iob.activityContrib;
return this;
}
2018-01-10 22:11:20 +01:00
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
Iob iob = (Iob) o;
if (Double.compare(iob.iobContrib, iobContrib) != 0) return false;
return Double.compare(iob.activityContrib, activityContrib) == 0;
}
@Override
public int hashCode() {
int result;
long temp;
temp = Double.doubleToLongBits(iobContrib);
result = (int) (temp ^ (temp >>> 32));
temp = Double.doubleToLongBits(activityContrib);
result = 31 * result + (int) (temp ^ (temp >>> 32));
return result;
}
2016-06-05 14:53:03 +02:00
}