package com.flightfeather.uav.biz
|
|
import com.flightfeather.uav.socket.eunm.FactorType
|
|
/**
|
* 所选主要分析因子,以及关联因子
|
* 在做数据异常分析以及数据统计时,用于决定是否需要进行处理该因子。
|
* @date 2024/6/27
|
* @author feiyu02
|
*/
|
class FactorFilter private constructor(){
|
|
data class SelectedFactor(
|
val main:FactorType,
|
var subs:List<FactorType> = emptyList()
|
)
|
|
inner class Builder{
|
fun withMain(factorType: FactorType): Builder {
|
selectedList.add(SelectedFactor(factorType))
|
return this
|
}
|
|
fun withSubs(subs: List<FactorType>): Builder {
|
if (selectedList.isNotEmpty()) {
|
selectedList.last().subs = subs
|
}
|
return this
|
}
|
|
fun create(): FactorFilter {
|
return this@FactorFilter
|
}
|
}
|
|
companion object{
|
fun builder() = FactorFilter().Builder()
|
fun default() = builder().create()
|
}
|
|
// 所选因子集合
|
val selectedList = mutableListOf<SelectedFactor>()
|
|
fun mainList(): List<FactorType> {
|
return selectedList.map { it.main }
|
}
|
}
|