From f8bbfab7ea297a11b6f2a11d14390b75dc99c47a Mon Sep 17 00:00:00 2001
From: MarkusKrug <markus.krug@uni-wuerzburg.de>
Date: Thu, 22 Feb 2018 16:43:51 +0100
Subject: [PATCH] maps work as expected

---
 .../GoldstandardAnalyzer.java                  | 18 ++++++++++++++----
 1 file changed, 14 insertions(+), 4 deletions(-)

diff --git a/de.uniwue.mk.athen/bundles/de.uniwue.mk.kall.athen.goldstandardAnalyzer/src/de/uniwue/mk/kall/athen/goldstandardAnalyzer/GoldstandardAnalyzer.java b/de.uniwue.mk.athen/bundles/de.uniwue.mk.kall.athen.goldstandardAnalyzer/src/de/uniwue/mk/kall/athen/goldstandardAnalyzer/GoldstandardAnalyzer.java
index 5337333e..b2ee9192 100644
--- a/de.uniwue.mk.athen/bundles/de.uniwue.mk.kall.athen.goldstandardAnalyzer/src/de/uniwue/mk/kall/athen/goldstandardAnalyzer/GoldstandardAnalyzer.java
+++ b/de.uniwue.mk.athen/bundles/de.uniwue.mk.kall.athen.goldstandardAnalyzer/src/de/uniwue/mk/kall/athen/goldstandardAnalyzer/GoldstandardAnalyzer.java
@@ -296,12 +296,17 @@ public class GoldstandardAnalyzer extends AEditorSubordinateViewPart {
 
 		editor.removeAnnotations(toDelete);
 
-		for (AnnotationFS anno : toDelete) {
-			editor.getCas().removeFsFromIndexes(anno);
-		}
+		// for (AnnotationFS anno : toDelete) {
+		// editor.getCas().removeFsFromIndexes(anno);
+		// }
 	}
 
 	public void deleteAnnotations() {
+		
+		//reset maps
+		this.fnMap.clear();
+		this.fpMap.clear();
+		this.tpMap.clear();
 
 		List<AnnotationFS> annoList = new ArrayList<>();
 		AnnotationIndex<AnnotationFS> annotationIndex = editor.getCas().getAnnotationIndex(tpType);
@@ -321,7 +326,11 @@ public class GoldstandardAnalyzer extends AEditorSubordinateViewPart {
 		while (iterator2.hasNext()) {
 			annoList.add((AnnotationFS) iterator2.next());
 		}
-		deleteAnnotations(annoList.toArray(new AnnotationFS[0]));
+		for (AnnotationFS a : annoList) {
+			editor.getCas().removeFsFromIndexes(a);
+		}
+		editor.updateWidget();
+		// deleteAnnotations(annoList.toArray(new AnnotationFS[0]));
 	}
 
 	public void compareTypes() {
@@ -401,6 +410,7 @@ public class GoldstandardAnalyzer extends AEditorSubordinateViewPart {
 	}
 
 	public void createMap() {
+		this.m = new HashMap<>();
 		m.putAll(tpMap);
 		m.putAll(fpMap);
 		m.putAll(fnMap);
-- 
GitLab