constraintsInterface java -> kotlin

This commit is contained in:
AdrianLxM 2019-12-28 02:53:55 +01:00
parent 93bc179181
commit a98b3ed6ac
3 changed files with 86 additions and 66 deletions

View file

@ -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<Boolean> isLoopInvocationAllowed(Constraint<Boolean> value) {
return value;
}
default Constraint<Boolean> isClosedLoopAllowed(Constraint<Boolean> value) {
return value;
}
default Constraint<Boolean> isAutosensModeEnabled(Constraint<Boolean> value) {
return value;
}
default Constraint<Boolean> isAMAModeEnabled(Constraint<Boolean> value) {
return value;
}
default Constraint<Boolean> isSMBModeEnabled(Constraint<Boolean> value) {
return value;
}
default Constraint<Boolean> isUAMEnabled(Constraint<Boolean> value) {
return value;
}
default Constraint<Boolean> isAdvancedFilteringEnabled(Constraint<Boolean> value) {
return value;
}
default Constraint<Boolean> isSuperBolusEnabled(Constraint<Boolean> value) {
return value;
}
default Constraint<Double> applyBasalConstraints(Constraint<Double> absoluteRate, Profile profile) {
return absoluteRate;
}
default Constraint<Integer> applyBasalPercentConstraints(Constraint<Integer> percentRate, Profile profile) {
return percentRate;
}
default Constraint<Double> applyBolusConstraints(Constraint<Double> insulin) {
return insulin;
}
default Constraint<Double> applyExtendedBolusConstraints(Constraint<Double> insulin) {
return insulin;
}
default Constraint<Integer> applyCarbsConstraints(Constraint<Integer> carbs) {
return carbs;
}
default Constraint<Double> applyMaxIOBConstraints(Constraint<Double> maxIob) {
return maxIob;
}
}

View file

@ -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<Boolean>): Constraint<Boolean> {
return value
}
@JvmDefault
fun isClosedLoopAllowed(value: Constraint<Boolean>): Constraint<Boolean> {
return value
}
@JvmDefault
fun isAutosensModeEnabled(value: Constraint<Boolean>): Constraint<Boolean> {
return value
}
@JvmDefault
fun isAMAModeEnabled(value: Constraint<Boolean>): Constraint<Boolean> {
return value
}
@JvmDefault
fun isSMBModeEnabled(value: Constraint<Boolean>): Constraint<Boolean> {
return value
}
@JvmDefault
fun isUAMEnabled(value: Constraint<Boolean>): Constraint<Boolean> {
return value
}
@JvmDefault
fun isAdvancedFilteringEnabled(value: Constraint<Boolean>): Constraint<Boolean> {
return value
}
@JvmDefault
fun isSuperBolusEnabled(value: Constraint<Boolean>): Constraint<Boolean> {
return value
}
@JvmDefault
fun applyBasalConstraints(absoluteRate: Constraint<Double>, profile: Profile): Constraint<Double> {
return absoluteRate
}
@JvmDefault
fun applyBasalPercentConstraints(percentRate: Constraint<Int>, profile: Profile): Constraint<Int> {
return percentRate
}
@JvmDefault
fun applyBolusConstraints(insulin: Constraint<Double>): Constraint<Double> {
return insulin
}
@JvmDefault
fun applyExtendedBolusConstraints(insulin: Constraint<Double>): Constraint<Double> {
return insulin
}
@JvmDefault
fun applyCarbsConstraints(carbs: Constraint<Int>): Constraint<Int> {
return carbs
}
@JvmDefault
fun applyMaxIOBConstraints(maxIob: Constraint<Double>): Constraint<Double> {
return maxIob
}
}

View file

@ -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) {