| | |
| | | import com.flightfeather.uav.biz.dataanalysis.model.DataAnalysisConfig |
| | | import com.flightfeather.uav.biz.dataanalysis.model.ExceptionType |
| | | import com.flightfeather.uav.domain.entity.BaseRealTimeData |
| | | import com.flightfeather.uav.socket.eunm.FactorType |
| | | import kotlin.math.abs |
| | | |
| | | /** |
| | |
| | | |
| | | override fun getExceptionType(): ExceptionType = ExceptionType.TYPE4 |
| | | |
| | | override fun judgeException(p: BaseRealTimeData?, n: BaseRealTimeData): List<Boolean> { |
| | | val res = mutableListOf<Boolean>() |
| | | repeat(config.factorCount) { i-> |
| | | if (p?.getByFactorIndex(i) == null || n.getByFactorIndex(i) == null) { |
| | | res.add(false) |
| | | return@repeat |
| | | override fun judgeException(p: BaseRealTimeData?, n: BaseRealTimeData): MutableMap<FactorType, Boolean> { |
| | | val res = mutableMapOf<FactorType, Boolean>() |
| | | config.factorFilter.mainList().forEach { f -> |
| | | if (p?.getByFactorType(f) == null || n.getByFactorType(f) == null) { |
| | | res[f] = (false) |
| | | return@forEach |
| | | } |
| | | val pValue = p.getByFactorIndex(i)!! |
| | | val nValue = n.getByFactorIndex(i)!! |
| | | val pValue = p.getByFactorType(f)!! |
| | | val nValue = n.getByFactorType(f)!! |
| | | val r = abs((pValue - nValue) / pValue) |
| | | val b1 = r >= (2 * config.mutationRate) |
| | | val b2 = r >= config.mutationRate |
| | | if (b1) special = true |
| | | res.add(b1 || b2) |
| | | res[f] = (b1 || b2) |
| | | } |
| | | // repeat(config.factorCount) { i-> |
| | | // if (p?.getByFactorIndex(i) == null || n.getByFactorIndex(i) == null) { |
| | | // res.add(false) |
| | | // return@repeat |
| | | // } |
| | | // val pValue = p.getByFactorIndex(i)!! |
| | | // val nValue = n.getByFactorIndex(i)!! |
| | | // val r = abs((pValue - nValue) / pValue) |
| | | // val b1 = r >= (2 * config.mutationRate) |
| | | // val b2 = r >= config.mutationRate |
| | | // if (b1) special = true |
| | | // res.add(b1 || b2) |
| | | // } |
| | | |
| | | return res |
| | | } |