diff --git a/app/src/main/java/info/nightscout/androidaps/interfaces/ConstraintsInterface.java b/app/src/main/java/info/nightscout/androidaps/interfaces/ConstraintsInterface.java deleted file mode 100644 index 14b2d549af..0000000000 --- a/app/src/main/java/info/nightscout/androidaps/interfaces/ConstraintsInterface.java +++ /dev/null @@ -1,66 +0,0 @@ -package info.nightscout.androidaps.interfaces; - -import info.nightscout.androidaps.data.Profile; - -/** - * Created by mike on 15.06.2016. - */ -public interface ConstraintsInterface { - - default Constraint isLoopInvocationAllowed(Constraint value) { - return value; - } - - default Constraint isClosedLoopAllowed(Constraint value) { - return value; - } - - default Constraint isAutosensModeEnabled(Constraint value) { - return value; - } - - default Constraint isAMAModeEnabled(Constraint value) { - return value; - } - - default Constraint isSMBModeEnabled(Constraint value) { - return value; - } - - default Constraint isUAMEnabled(Constraint value) { - return value; - } - - default Constraint isAdvancedFilteringEnabled(Constraint value) { - return value; - } - - default Constraint isSuperBolusEnabled(Constraint value) { - return value; - } - - default Constraint applyBasalConstraints(Constraint absoluteRate, Profile profile) { - return absoluteRate; - } - - default Constraint applyBasalPercentConstraints(Constraint percentRate, Profile profile) { - return percentRate; - } - - default Constraint applyBolusConstraints(Constraint insulin) { - return insulin; - } - - default Constraint applyExtendedBolusConstraints(Constraint insulin) { - return insulin; - } - - default Constraint applyCarbsConstraints(Constraint carbs) { - return carbs; - } - - default Constraint applyMaxIOBConstraints(Constraint maxIob) { - return maxIob; - } - -} diff --git a/app/src/main/java/info/nightscout/androidaps/interfaces/ConstraintsInterface.kt b/app/src/main/java/info/nightscout/androidaps/interfaces/ConstraintsInterface.kt new file mode 100644 index 0000000000..0634bbb139 --- /dev/null +++ b/app/src/main/java/info/nightscout/androidaps/interfaces/ConstraintsInterface.kt @@ -0,0 +1,79 @@ +package info.nightscout.androidaps.interfaces + +import info.nightscout.androidaps.data.Profile + +/** + * Created by mike on 15.06.2016. + */ +interface ConstraintsInterface { + + @JvmDefault + fun isLoopInvocationAllowed(value: Constraint): Constraint { + return value + } + + @JvmDefault + fun isClosedLoopAllowed(value: Constraint): Constraint { + return value + } + + @JvmDefault + fun isAutosensModeEnabled(value: Constraint): Constraint { + return value + } + + @JvmDefault + fun isAMAModeEnabled(value: Constraint): Constraint { + return value + } + + @JvmDefault + fun isSMBModeEnabled(value: Constraint): Constraint { + return value + } + + @JvmDefault + fun isUAMEnabled(value: Constraint): Constraint { + return value + } + + @JvmDefault + fun isAdvancedFilteringEnabled(value: Constraint): Constraint { + return value + } + + @JvmDefault + fun isSuperBolusEnabled(value: Constraint): Constraint { + return value + } + + @JvmDefault + fun applyBasalConstraints(absoluteRate: Constraint, profile: Profile): Constraint { + return absoluteRate + } + + @JvmDefault + fun applyBasalPercentConstraints(percentRate: Constraint, profile: Profile): Constraint { + return percentRate + } + + @JvmDefault + fun applyBolusConstraints(insulin: Constraint): Constraint { + return insulin + } + + @JvmDefault + fun applyExtendedBolusConstraints(insulin: Constraint): Constraint { + return insulin + } + + @JvmDefault + fun applyCarbsConstraints(carbs: Constraint): Constraint { + return carbs + } + + @JvmDefault + fun applyMaxIOBConstraints(maxIob: Constraint): Constraint { + return maxIob + } +} \ No newline at end of file diff --git a/build.gradle b/build.gradle index 3327014f1f..520a0dfa18 100644 --- a/build.gradle +++ b/build.gradle @@ -34,6 +34,13 @@ allprojects { } } } + //Support @JvmDefault + tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).all { + kotlinOptions { + freeCompilerArgs = ['-Xjvm-default=enable'] //enable or compatibility + jvmTarget = "1.8" + } + } } task clean(type: Delete) {