This is an automated email from the ASF dual-hosted git repository.
aradzinski pushed a commit to branch NLPCRAFT-474
in repository https://gitbox.apache.org/repos/asf/incubator-nlpcraft.git
The following commit(s) were added to refs/heads/NLPCRAFT-474 by this push:
new 23db28a WIP
23db28a is described below
commit 23db28a4323baeac51f43cf31f33523c80f8c903
Author: Aaron Radzinski <[email protected]>
AuthorDate: Wed Jan 26 15:43:45 2022 -0800
WIP
---
.../nlpcraft/internal/intent/compiler/NCIDLCodeGenerator.scala | 10 +++++-----
.../intent/compiler/functions/NCIDLFunctionsEntity.scala | 4 ++--
2 files changed, 7 insertions(+), 7 deletions(-)
diff --git
a/nlpcraft/src/main/scala/org/apache/nlpcraft/internal/intent/compiler/NCIDLCodeGenerator.scala
b/nlpcraft/src/main/scala/org/apache/nlpcraft/internal/intent/compiler/NCIDLCodeGenerator.scala
index 6c88067..3343866 100644
---
a/nlpcraft/src/main/scala/org/apache/nlpcraft/internal/intent/compiler/NCIDLCodeGenerator.scala
+++
b/nlpcraft/src/main/scala/org/apache/nlpcraft/internal/intent/compiler/NCIDLCodeGenerator.scala
@@ -119,21 +119,21 @@ trait NCIDLCodeGenerator:
else if isInt(v) then asInt(v)
else if isReal(v) then asReal(v)
else if isList(v) || isMap(v) then v
- else if isJColl(v) then // Convert any other Java collections to
ArrayList.
- new java.util.ArrayList(asJColl(v)).asInstanceOf[Object]
+ else if isColl(v) then // Convert any other Java collections to
ArrayList.
+ new java.util.ArrayList(asColl(v)).asInstanceOf[Object]
else
v
//noinspection ComparingUnrelatedTypes
def isBool(v: Object): Boolean = v.isInstanceOf[Boolean]
def isList(v: Object): Boolean = v.isInstanceOf[JList[_]]
- def isJColl(v: Object): Boolean = v.isInstanceOf[JColl[_]]
+ def isColl(v: Object): Boolean = v.isInstanceOf[JColl[_]]
def isMap(v: Object): Boolean = v.isInstanceOf[JMap[_, _]]
def isStr(v: Object): Boolean = v.isInstanceOf[String]
def isEntity(v: Object): Boolean = v.isInstanceOf[NCIDLEntity]
def asList(v: Object): JList[_] = v.asInstanceOf[JList[_]]
- def asJColl(v: Object): JColl[_] = v.asInstanceOf[JColl[_]]
+ def asColl(v: Object): JColl[_] = v.asInstanceOf[JColl[_]]
def asMap(v: Object): JMap[_, _] = v.asInstanceOf[JMap[_, _]]
def asStr(v: Object): String = v.asInstanceOf[String]
def asEntity(v: Object): NCIDLEntity = v.asInstanceOf[NCIDLEntity]
@@ -378,7 +378,7 @@ trait NCIDLCodeGenerator:
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 isList(v1) && isList(v2) then
CollectionUtils.isEqualCollection(asList(v1), asList(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)
diff --git
a/nlpcraft/src/test/scala/org/apache/nlpcraft/internal/intent/compiler/functions/NCIDLFunctionsEntity.scala
b/nlpcraft/src/test/scala/org/apache/nlpcraft/internal/intent/compiler/functions/NCIDLFunctionsEntity.scala
index 9ce559b..ecf1eed 100644
---
a/nlpcraft/src/test/scala/org/apache/nlpcraft/internal/intent/compiler/functions/NCIDLFunctionsEntity.scala
+++
b/nlpcraft/src/test/scala/org/apache/nlpcraft/internal/intent/compiler/functions/NCIDLFunctionsEntity.scala
@@ -63,11 +63,11 @@ class NCIDLFunctionsEntity extends NCIDLFunctions:
),
TestDesc(
truth = "ent_groups() == list('g1', 'g2')",
- entity = mkEntity(id = "a", groups = Set("g1, g2"), tokens =
t1, t2)
+ entity = mkEntity(id = "a", groups = Set("g1", "g2"), tokens =
t1, t2)
),
TestDesc(
truth = "ent_groups() == list('a')",
- entity = mkEntity(id = "a", tokens = t1, t2)
+ entity = mkEntity(id = "a", tokens = t1, t2, groups = Set("a"))
)
)