| | |
| | | // emptyList<String>() |
| | | WeightType.prep |
| | | |
| | | private val lastData = mutableListOf<DataVo>() |
| | | |
| | | override fun mDataPrep(mDataList: List<DataVo>): List<DataVo> { |
| | | mDataList.forEach { |
| | | it.values?.forEach v@{a -> |
| | |
| | | // } |
| | | |
| | | var i = ncal |
| | | if (lastData.isNotEmpty()) { |
| | | i = 0 |
| | | } |
| | | while (i < mDataList.size) { |
| | | for (y in mDataList[i].values?.indices ?: 0..0) { |
| | | val it = mDataList[i].values?.get(y) ?: continue |
| | |
| | | it.factorData ?: continue |
| | | |
| | | if (it.factorData!! > vMax) { |
| | | val list = mDataList.subList(i - ncal, i) |
| | | val lastDataIndex = i |
| | | val thisIndex = if (i-ncal<0) 0 else i - ncal |
| | | val list = mutableListOf<DataVo>() |
| | | if (lastDataIndex < lastData.size) { |
| | | list.addAll(lastData.subList(lastDataIndex, lastData.lastIndex + 1)) |
| | | } |
| | | list.addAll(mDataList.subList(thisIndex, i)) |
| | | |
| | | // 去除无效值的平均 |
| | | val avg = average(list, it.factorName) |
| | | // 去除无效值的标准差 |
| | |
| | | i++ |
| | | } |
| | | |
| | | lastData.clear() |
| | | mDataList.subList(mDataList.lastIndex - ncal + 1, mDataList.lastIndex + 1).forEach { |
| | | lastData.add(it.copy()) |
| | | } |
| | | |
| | | return mDataList |
| | | } |
| | | |