package com.flightfeather.monitor.analysis.dust
|
|
import com.flightfeather.monitor.domain.ds1.entity.DustExceptionSetting
|
import com.flightfeather.monitor.domain.ds1.entity.DustSiteData
|
import com.flightfeather.monitor.enumration.dust.ExceptionType
|
import kotlin.math.abs
|
|
/**
|
* 量级突变异常分析
|
*/
|
class ExceptionValueMutation(config: DustExceptionSetting) : BaseExceptionContinuous(config) {
|
|
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
|
}
|
|
override fun judgeDuration(sIndex: Int, eIndex: Int): Boolean {
|
return (eIndex - sIndex) >= config.mutationNum
|
}
|
}
|