Modify change * != IntRange.EMPTY to *.isEmpty().not() in ConstructorRulesData, MethodRulesData, MemberRulesData, NameConditions

This commit is contained in:
2022-09-11 23:41:25 +08:00
parent bc03f14ba5
commit 0f05267edc
4 changed files with 5 additions and 5 deletions

View File

@@ -49,7 +49,7 @@ internal class ConstructorRulesData internal constructor(
override val isInitialize
get() = super.isInitializeOfSuper || paramTypes != null || paramCount >= 0 ||
paramCountRange != IntRange.EMPTY || paramCountConditions != null
paramCountRange.isEmpty().not() || paramCountConditions != null
override fun hashCode(other: Any?) = super.hashCode(other) + "[$paramTypes][$paramCount][$paramCountRange]".hashCode()
}

View File

@@ -49,7 +49,7 @@ internal open class MemberRulesData internal constructor(
* 判断 [matchCount]、[matchCountRange] 规则是否已经初始化 (设置了任意一个参数)
* @return [Boolean]
*/
internal val isInitializeOfMatch get() = matchCount >= 0 || matchCountRange != IntRange.EMPTY
internal val isInitializeOfMatch get() = matchCount >= 0 || matchCountRange.isEmpty().not()
/**
* 判断 [BaseRulesData] 规则是否已经初始化 (设置了任意一个参数)

View File

@@ -56,7 +56,7 @@ internal class MethodRulesData internal constructor(
override val isInitialize
get() = super.isInitializeOfSuper || name.isNotBlank() || nameConditions != null || paramTypes != null ||
paramCount >= 0 || paramCountRange != IntRange.EMPTY || paramCountConditions != null || returnType != null
paramCount >= 0 || paramCountRange.isEmpty().not() || paramCountConditions != null || returnType != null
override fun hashCode(other: Any?) =
super.hashCode(other) + "[$name][$nameConditions][$paramTypes][$paramCount][$paramCountRange][$returnType]".hashCode()

View File

@@ -270,7 +270,7 @@ class NameConditions @PublishedApi internal constructor() {
if (cdsContains != null) cdsContains?.apply { conditions = conditions && it.contains(first, second) }
if (cdsMatches != null) cdsMatches?.apply { conditions = conditions && it.matches(regex = this) }
if (cdsLength >= 0) conditions = conditions && it.length == cdsLength
if (cdsLengthRange != IntRange.EMPTY) conditions = conditions && it.length in cdsLengthRange
if (cdsLengthRange.isEmpty().not()) conditions = conditions && it.length in cdsLengthRange
}
return conditions
}
@@ -290,7 +290,7 @@ class NameConditions @PublishedApi internal constructor() {
if (cdsContains != null) cdsContains?.apply { conditions += "<Contains:[other: $first, isIgnoreCase: $second]> " }
if (cdsMatches != null) cdsMatches?.apply { conditions += "<Matches:[regex: $this]> " }
if (cdsLength >= 0) conditions += "<Length:[num: $cdsLength]> "
if (cdsLengthRange != IntRange.EMPTY) conditions += "<LengthRange:[numRange: $cdsLengthRange]> "
if (cdsLengthRange.isEmpty().not()) conditions += "<LengthRange:[numRange: $cdsLengthRange]> "
return "[${conditions.trim()}]"
}
}