| | |
| | | /** |
| | | * 立即判断:当出现异常时,缓存异常数据的同时,立即对已有异常进行判断是否满足异常结果要求 |
| | | */ |
| | | open fun immeExcCheck(tag: T): Boolean { |
| | | open fun immeExcCheck(tag: T, factorType: FactorType): Boolean { |
| | | return false |
| | | } |
| | | |
| | |
| | | * 判断异常出现的连续个数是否满足条件 |
| | | * @param tag 异常数据对象 |
| | | */ |
| | | abstract fun judgeExceptionCount(tag: T): Boolean |
| | | abstract fun judgeExceptionCount(tag: T, factorType: FactorType?): Boolean |
| | | |
| | | /** |
| | | * 异常数据的截取判断 |
| | | * @return 默认不需要截取 |
| | | * @return |
| | | */ |
| | | open fun needCut(tag: T, hasException: Boolean?): Boolean { |
| | | // 默认判断条件为 当异常不再重复出现时,形成异常结果 |
| | |
| | | config.factorFilter.selectedList.forEach { s -> |
| | | val f = s.main |
| | | tagMap[f]?.let { |
| | | it.addHistoryData(data) |
| | | |
| | | it.eIndex++ |
| | | // 起始数据 |
| | | it.endData = data |
| | |
| | | // 有异常出现时,记录异常数据 |
| | | it.addExceptionData(data) |
| | | // 当立即判断通过时,形成异常结果 |
| | | if (immeExcCheck(it)) { |
| | | if (immeExcCheck(it, f)) { |
| | | recordException(s, it, data) |
| | | } |
| | | } |
| | |
| | | ) { |
| | | val tag = tagMap[factor?.main] |
| | | if (factor != null && tag != null) { |
| | | if (tag.exceptionExisted && judgeExceptionCount(tag)) { |
| | | if (tag.exceptionExisted && judgeExceptionCount(tag, factor.main)) { |
| | | onNewException(tag, factor, exceptionStatus) |
| | | } |
| | | } else { |
| | | config.factorFilter.selectedList.forEach { f -> |
| | | val tag1 = tagMap[f.main] ?: return@forEach |
| | | if (tag1.exceptionExisted && judgeExceptionCount(tag1)) { |
| | | if (tag1.exceptionExisted && judgeExceptionCount(tag1, null)) { |
| | | onNewException(tag1, f, exceptionStatus) |
| | | } |
| | | } |
| | |
| | | */ |
| | | open fun onNewException(tag: T, factor: FactorFilter.SelectedFactor, exceptionStatus: ExceptionStatusType) { |
| | | if (tag.startData == null) return |
| | | val ex = newResult(tag.startData!!, tag.endData, factor, tag.exceptionData) |
| | | // val ex = newResult(tag.startData!!, tag.endData, factor, tag.exceptionData) |
| | | val ex = newResult(tag, factor) |
| | | .apply { status = exceptionStatus.value } |
| | | // 异常已创建时,更新异常信息 |
| | | if (tag.exceptionCreated) { |
| | |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 生成一条异常分析结果 |
| | | */ |
| | | abstract fun newResult(tag:T, factor: FactorFilter.SelectedFactor): Y |
| | | |
| | | } |