package com.flightfeather.uav.model
|
|
/**
|
* 权重
|
* 某种影响因素在不同情况下对某种监测数据产生的权重影响
|
*/
|
abstract class BaseWeight {
|
|
// 区间阈值
|
abstract val sectionValues: List<Double>
|
// 区间对应权重
|
abstract val weights: List<Double>
|
|
/**
|
* 权重计算
|
* @param value 影响因素的值
|
*/
|
fun weightCal(value: Double): Double {
|
for (i in sectionValues.indices) {
|
if (value < sectionValues[i]) {
|
return weights[i]
|
}
|
}
|
return weights.last()
|
}
|
}
|