use default functions in constraint interface
This commit is contained in:
parent
76ee3c51e4
commit
ae57241833
5 changed files with 27 additions and 140 deletions
|
@ -7,23 +7,41 @@ import info.nightscout.androidaps.data.Profile;
|
||||||
*/
|
*/
|
||||||
public interface ConstraintsInterface {
|
public interface ConstraintsInterface {
|
||||||
|
|
||||||
Constraint<Boolean> isLoopInvokationAllowed(Constraint<Boolean> value);
|
default Constraint<Boolean> isLoopInvokationAllowed(Constraint<Boolean> value) {
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
|
||||||
Constraint<Boolean> isClosedLoopAllowed(Constraint<Boolean> value);
|
default Constraint<Boolean> isClosedLoopAllowed(Constraint<Boolean> value) {
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
|
||||||
Constraint<Boolean> isAutosensModeEnabled(Constraint<Boolean> value);
|
default Constraint<Boolean> isAutosensModeEnabled(Constraint<Boolean> value) {
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
|
||||||
Constraint<Boolean> isAMAModeEnabled(Constraint<Boolean> value);
|
default Constraint<Boolean> isAMAModeEnabled(Constraint<Boolean> value) {
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
|
||||||
Constraint<Boolean> isSMBModeEnabled(Constraint<Boolean> value);
|
default Constraint<Boolean> isSMBModeEnabled(Constraint<Boolean> value) {
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
|
||||||
Constraint<Double> applyBasalConstraints(Constraint<Double> absoluteRate, Profile profile);
|
default Constraint<Double> applyBasalConstraints(Constraint<Double> absoluteRate, Profile profile) {
|
||||||
|
return absoluteRate;
|
||||||
|
}
|
||||||
|
|
||||||
Constraint<Integer> applyBasalPercentConstraints(Constraint<Integer> percentRate, Profile profile);
|
default Constraint<Integer> applyBasalPercentConstraints(Constraint<Integer> percentRate, Profile profile) {
|
||||||
|
return percentRate;
|
||||||
|
}
|
||||||
|
|
||||||
Constraint<Double> applyBolusConstraints(Constraint<Double> insulin);
|
default Constraint<Double> applyBolusConstraints(Constraint<Double> insulin) {
|
||||||
|
return insulin;
|
||||||
|
}
|
||||||
|
|
||||||
Constraint<Integer> applyCarbsConstraints(Constraint<Integer> carbs);
|
default Constraint<Integer> applyCarbsConstraints(Constraint<Integer> carbs) {
|
||||||
|
return carbs;
|
||||||
|
}
|
||||||
|
|
||||||
default Constraint<Double> applyMaxIOBConstraints(Constraint<Double> maxIob) {
|
default Constraint<Double> applyMaxIOBConstraints(Constraint<Double> maxIob) {
|
||||||
return maxIob;
|
return maxIob;
|
||||||
|
|
|
@ -1432,46 +1432,6 @@ public class ComboPlugin implements PluginBase, PumpInterface, ConstraintsInterf
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public Constraint<Boolean> isClosedLoopAllowed(Constraint<Boolean> value) {
|
|
||||||
return value;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Constraint<Boolean> isAutosensModeEnabled(Constraint<Boolean> value) {
|
|
||||||
return value;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Constraint<Boolean> isAMAModeEnabled(Constraint<Boolean> value) {
|
|
||||||
return value;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Constraint<Boolean> isSMBModeEnabled(Constraint<Boolean> value) {
|
|
||||||
return value;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Constraint<Double> applyBasalConstraints(Constraint<Double> absoluteRate, Profile profile) {
|
|
||||||
return absoluteRate;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Constraint<Integer> applyBasalPercentConstraints(Constraint<Integer> percentRate, Profile profile) {
|
|
||||||
return percentRate;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Constraint<Double> applyBolusConstraints(Constraint<Double> insulin) {
|
|
||||||
return insulin;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Constraint<Integer> applyCarbsConstraints(Constraint<Integer> carbs) {
|
|
||||||
return carbs;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Constraint<Double> applyMaxIOBConstraints(Constraint<Double> maxIob) {
|
public Constraint<Double> applyMaxIOBConstraints(Constraint<Double> maxIob) {
|
||||||
if (lowSuspendOnlyLoopEnforcedUntil > System.currentTimeMillis())
|
if (lowSuspendOnlyLoopEnforcedUntil > System.currentTimeMillis())
|
||||||
|
|
|
@ -433,31 +433,6 @@ public abstract class AbstractDanaRPlugin implements PluginBase, PumpInterface,
|
||||||
* Constraint interface
|
* Constraint interface
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@Override
|
|
||||||
public Constraint<Boolean> isLoopInvokationAllowed(Constraint<Boolean> value) {
|
|
||||||
return value;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Constraint<Boolean> isClosedLoopAllowed(Constraint<Boolean> value) {
|
|
||||||
return value;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Constraint<Boolean> isAutosensModeEnabled(Constraint<Boolean> value) {
|
|
||||||
return value;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Constraint<Boolean> isAMAModeEnabled(Constraint<Boolean> value) {
|
|
||||||
return value;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Constraint<Boolean> isSMBModeEnabled(Constraint<Boolean> value) {
|
|
||||||
return value;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Constraint<Double> applyBasalConstraints(Constraint<Double> absoluteRate, Profile profile) {
|
public Constraint<Double> applyBasalConstraints(Constraint<Double> absoluteRate, Profile profile) {
|
||||||
if (pump != null)
|
if (pump != null)
|
||||||
|
@ -480,11 +455,6 @@ public abstract class AbstractDanaRPlugin implements PluginBase, PumpInterface,
|
||||||
return insulin;
|
return insulin;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public Constraint<Integer> applyCarbsConstraints(Constraint<Integer> carbs) {
|
|
||||||
return carbs;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
@Override
|
@Override
|
||||||
public ProfileStore getProfile() {
|
public ProfileStore getProfile() {
|
||||||
|
|
|
@ -272,31 +272,6 @@ public class DanaRSPlugin implements PluginBase, PumpInterface, DanaRInterface,
|
||||||
|
|
||||||
// Constraints interface
|
// Constraints interface
|
||||||
|
|
||||||
@Override
|
|
||||||
public Constraint<Boolean> isLoopInvokationAllowed(Constraint<Boolean> value) {
|
|
||||||
return value;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Constraint<Boolean> isClosedLoopAllowed(Constraint<Boolean> value) {
|
|
||||||
return value;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Constraint<Boolean> isAutosensModeEnabled(Constraint<Boolean> value) {
|
|
||||||
return value;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Constraint<Boolean> isAMAModeEnabled(Constraint<Boolean> value) {
|
|
||||||
return value;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Constraint<Boolean> isSMBModeEnabled(Constraint<Boolean> value) {
|
|
||||||
return value;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Constraint<Double> applyBasalConstraints(Constraint<Double> absoluteRate, Profile profile) {
|
public Constraint<Double> applyBasalConstraints(Constraint<Double> absoluteRate, Profile profile) {
|
||||||
if (pump != null)
|
if (pump != null)
|
||||||
|
@ -320,11 +295,6 @@ public class DanaRSPlugin implements PluginBase, PumpInterface, DanaRInterface,
|
||||||
return insulin;
|
return insulin;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public Constraint<Integer> applyCarbsConstraints(Constraint<Integer> carbs) {
|
|
||||||
return carbs;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Profile interface
|
// Profile interface
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
|
|
|
@ -1088,31 +1088,6 @@ public class InsightPumpPlugin implements PluginBase, PumpInterface, Constraints
|
||||||
|
|
||||||
// Constraints
|
// Constraints
|
||||||
|
|
||||||
@Override
|
|
||||||
public Constraint<Boolean> isLoopInvokationAllowed(Constraint<Boolean> value) {
|
|
||||||
return value;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Constraint<Boolean> isClosedLoopAllowed(Constraint<Boolean> value) {
|
|
||||||
return value;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Constraint<Boolean> isAutosensModeEnabled(Constraint<Boolean> value) {
|
|
||||||
return value;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Constraint<Boolean> isAMAModeEnabled(Constraint<Boolean> value) {
|
|
||||||
return value;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Constraint<Boolean> isSMBModeEnabled(Constraint<Boolean> value) {
|
|
||||||
return value;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Constraint<Double> applyBasalConstraints(Constraint<Double> absoluteRate, Profile profile) {
|
public Constraint<Double> applyBasalConstraints(Constraint<Double> absoluteRate, Profile profile) {
|
||||||
if (statusResult != null) {
|
if (statusResult != null) {
|
||||||
|
@ -1136,10 +1111,4 @@ public class InsightPumpPlugin implements PluginBase, PumpInterface, Constraints
|
||||||
return insulin;
|
return insulin;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public Constraint<Integer> applyCarbsConstraints(Constraint<Integer> carbs) {
|
|
||||||
return carbs;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue