should properly clear the arraylist in the hasmap

This commit is contained in:
christian 2021-12-09 12:04:36 +01:00
parent da92210753
commit 103fbe0eb5

View File

@ -593,8 +593,6 @@ public class Datahandler {
Collections.reverse(concurrentRelations); Collections.reverse(concurrentRelations);
ArrayList<String> mysqlUpdateLastUsed = new ArrayList(); ArrayList<String> mysqlUpdateLastUsed = new ArrayList();
if (!concurrentRelations.isEmpty()) { if (!concurrentRelations.isEmpty()) {
boolean passedFirst = false;
int lastIter = 1;
for (String secondaryRelation : concurrentRelations) { for (String secondaryRelation : concurrentRelations) {
if (SB.toString().length() > randomLenghtPermit && !SB.toString().isEmpty()) { if (SB.toString().length() > randomLenghtPermit && !SB.toString().isEmpty()) {
break; break;
@ -605,12 +603,14 @@ public class Datahandler {
for (String strItr : orDefault) { for (String strItr : orDefault) {
if (secondaryRelation.equalsIgnoreCase(strItr)) { if (secondaryRelation.equalsIgnoreCase(strItr)) {
skip = true; skip = true;
if (orDefault.size() >= concurrentRelations.size()) { if (orDefault.size() + 3 >= concurrentRelations.size()) {
orDefault = new ArrayList<>(); orDefault = new ArrayList<>();
} else if (orDefault.size() > 3) { strResponses.put(strF, orDefault);
} else if (orDefault.size() > 5) {
double v = Math.random() * 10; double v = Math.random() * 10;
if (v > 8.6) { if (v > 8.6) {
orDefault = new ArrayList<>(); orDefault = new ArrayList<>();
strResponses.put(strF, orDefault);
} }
} }
break; break;
@ -618,7 +618,7 @@ public class Datahandler {
} }
if (skip) continue; if (skip) continue;
if (passedFirst && lastIter < concurrentRelations.size()) { if (!SB.isEmpty()) {
String testSTR = SB.toString() + " " + secondaryRelation; String testSTR = SB.toString() + " " + secondaryRelation;
SentimentAnalyzerTest SMX = getReponseFuturesHelper(strF, testSTR, stanfordCoreNLP, stanfordCoreNLPSentiment, SentimentAnalyzerTest SMX = getReponseFuturesHelper(strF, testSTR, stanfordCoreNLP, stanfordCoreNLPSentiment,
coreMaps1, strAnno, strAnnoSentiment, coreDocument, tokenizeCountingF, taggedWordListF coreMaps1, strAnno, strAnnoSentiment, coreDocument, tokenizeCountingF, taggedWordListF
@ -634,8 +634,6 @@ public class Datahandler {
break; break;
} }
} }
passedFirst = true;
lastIter++;
SB.append(secondaryRelation).append(" "); SB.append(secondaryRelation).append(" ");
mysqlUpdateLastUsed.add(secondaryRelation); mysqlUpdateLastUsed.add(secondaryRelation);