in nlpcraft/src/main/scala/org/apache/nlpcraft/internal/intent/compiler/NCIDLCodeGenerator.scala [351:381]
def parseEqNeqExpr(eq: TN, neq: TN)(implicit ctx: PRC): SI = (_, stack: S, _) => {
val (x1, x2) = pop2()(stack, ctx)
def doEq(v1: Object, v2: Object): Boolean =
//noinspection ComparingUnrelatedTypes
if v1 == null && v2 == null then true
else if (v1 == null && v2 != null) || (v1 != null && v2 == null) then false
else if isInt(v1) && isInt(v2) then asInt(v1) == asInt(v2)
else if isReal(v1) && isReal(v2) then
val r1 = asReal(v1)
val r2 = asReal(v2)
if r1.isNaN || r2.isNaN then false else r1 == r2
else if isBool(v1) && isBool(v2) then asBool(v1) == asBool(v2)
else if isStr(v1) && isStr(v2) then asStr(v1) == asStr(v2)
else if isColl(v1) && isColl(v2) then CollectionUtils.isEqualCollection(asColl(v1), asColl(v2))
else if (isInt(v1) && isReal(v2)) || (isReal(v1) && isInt(v2)) then asReal(v1) == asReal(v2)
else
v1.equals(v2)
stack.push(() => {
val (v1, v2, n) = extract2(x1, x2)
val f =
if eq != null then doEq(v1, v2)
else
assert(neq != null)
!doEq(v1, v2)
Z(f, n)
})
}