From 103fbe0eb58ccfbd619c788a7f299c271480617c Mon Sep 17 00:00:00 2001 From: christian Date: Thu, 9 Dec 2021 12:04:36 +0100 Subject: [PATCH] should properly clear the arraylist in the hasmap --- .../src/main/java/FunctionLayer/Datahandler.java | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/ArtificialAutism/src/main/java/FunctionLayer/Datahandler.java b/ArtificialAutism/src/main/java/FunctionLayer/Datahandler.java index 4ac5e1c1..02b7ae92 100644 --- a/ArtificialAutism/src/main/java/FunctionLayer/Datahandler.java +++ b/ArtificialAutism/src/main/java/FunctionLayer/Datahandler.java @@ -593,8 +593,6 @@ public class Datahandler { Collections.reverse(concurrentRelations); ArrayList mysqlUpdateLastUsed = new ArrayList(); if (!concurrentRelations.isEmpty()) { - boolean passedFirst = false; - int lastIter = 1; for (String secondaryRelation : concurrentRelations) { if (SB.toString().length() > randomLenghtPermit && !SB.toString().isEmpty()) { break; @@ -605,12 +603,14 @@ public class Datahandler { for (String strItr : orDefault) { if (secondaryRelation.equalsIgnoreCase(strItr)) { skip = true; - if (orDefault.size() >= concurrentRelations.size()) { + if (orDefault.size() + 3 >= concurrentRelations.size()) { orDefault = new ArrayList<>(); - } else if (orDefault.size() > 3) { + strResponses.put(strF, orDefault); + } else if (orDefault.size() > 5) { double v = Math.random() * 10; if (v > 8.6) { orDefault = new ArrayList<>(); + strResponses.put(strF, orDefault); } } break; @@ -618,7 +618,7 @@ public class Datahandler { } if (skip) continue; - if (passedFirst && lastIter < concurrentRelations.size()) { + if (!SB.isEmpty()) { String testSTR = SB.toString() + " " + secondaryRelation; SentimentAnalyzerTest SMX = getReponseFuturesHelper(strF, testSTR, stanfordCoreNLP, stanfordCoreNLPSentiment, coreMaps1, strAnno, strAnnoSentiment, coreDocument, tokenizeCountingF, taggedWordListF @@ -634,8 +634,6 @@ public class Datahandler { break; } } - passedFirst = true; - lastIter++; SB.append(secondaryRelation).append(" "); mysqlUpdateLastUsed.add(secondaryRelation);