From 3ba74e7692143fd6dcf4dd885f80f95dfef8387e Mon Sep 17 00:00:00 2001 From: zmc <zmc_li@foxmail.com> Date: 星期四, 23 十一月 2023 16:09:41 +0800 Subject: [PATCH] Merge remote-tracking branch 'origin/feature-risk_analysis' into feature-risk_analysis --- src/main/java/com/flightfeather/monitor/analysis/dust/exception/ExceptionValueMutation.kt | 19 +++++++++++++++++-- 1 files changed, 17 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/flightfeather/monitor/analysis/dust/exception/ExceptionValueMutation.kt b/src/main/java/com/flightfeather/monitor/analysis/dust/exception/ExceptionValueMutation.kt index 1695904..2501601 100644 --- a/src/main/java/com/flightfeather/monitor/analysis/dust/exception/ExceptionValueMutation.kt +++ b/src/main/java/com/flightfeather/monitor/analysis/dust/exception/ExceptionValueMutation.kt @@ -2,6 +2,7 @@ import com.flightfeather.monitor.domain.ds1.entity.DustExceptionSetting import com.flightfeather.monitor.domain.ds1.entity.DustSiteData +import com.flightfeather.monitor.enumration.dust.DataStatus import com.flightfeather.monitor.enumration.dust.ExceptionType import kotlin.math.abs @@ -10,14 +11,28 @@ */ class ExceptionValueMutation(config: DustExceptionSetting) : BaseExceptionContinuous(config) { + /** + * 鏈紓甯哥殑杩炵画鍙戠敓娆℃暟浼氭牴鎹紓甯哥殑绋嬪害鍙樺寲 + * 褰撶獊鍙樼殑閲忕骇瓒呰繃璁惧畾鍊�1鍊嶆槸,杩炵画鍙戠敓娆℃暟瑕佹眰鍑忓皯1鍊� + */ + private var special = false + override fun getExceptionType(): ExceptionType = ExceptionType.TYPE4 override fun judgeException(p: DustSiteData?, n: DustSiteData): Boolean { if (p == null) return false - return abs((p.dustValue - n.dustValue) / p.dustValue) >= config.mutationRate + val r = abs((p.dustValue - n.dustValue) / p.dustValue) + val b1 = r >= (2 * config.mutationRate) && n.flag == DataStatus.N.value + val b2 = r >= config.mutationRate && n.flag == DataStatus.N.value + val b3 = n.flag == DataStatus.OUT_MAX.value + if (b1) special = true + return b1 || b2 || b3 } override fun judgeDuration(sIndex: Int, eIndex: Int): Boolean { - return (eIndex - sIndex + 1) >= config.mutationNum + val b1 = special && (eIndex - sIndex) >= (config.mutationNum / 2) + val b2 = (eIndex - sIndex) >= config.mutationNum + special = false + return b1 || b2 } } \ No newline at end of file -- Gitblit v1.9.3