Revision: 14508
http://gate.svn.sourceforge.net/gate/?rev=14508&view=rev
Author: adamfunk
Date: 2011-11-09 20:33:32 +0000 (Wed, 09 Nov 2011)
Log Message:
-----------
The Set<Annotation> fields are now set early on to empty sets (to
avoid NPEs after reading them).
This time, cruise reports 0 errors and 0 failures.
:-)
Modified Paths:
--------------
gate/trunk/src/gate/util/AnnotationDiffer.java
Modified: gate/trunk/src/gate/util/AnnotationDiffer.java
===================================================================
--- gate/trunk/src/gate/util/AnnotationDiffer.java 2011-11-09 18:52:39 UTC
(rev 14507)
+++ gate/trunk/src/gate/util/AnnotationDiffer.java 2011-11-09 20:33:32 UTC
(rev 14508)
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1995-2010, The University of Sheffield. See the file
+ * Copyright (c) 1995-2011, The University of Sheffield. See the file
* COPYRIGHT.txt in the software or at http://gate.ac.uk/gate/COPYRIGHT.txt
*
* This file is part of GATE (see http://gate.ac.uk/), and is free
@@ -124,10 +124,30 @@
else
responseList = new ArrayList<Annotation>(response);
- if(correctAnnotations != null) correctAnnotations.clear();
- if(partiallyCorrectAnnotations != null)
partiallyCorrectAnnotations.clear();
- if(missingAnnotations != null) missingAnnotations.clear();
- if(spuriousAnnotations != null) spuriousAnnotations.clear();
+ if(correctAnnotations != null) {
+ correctAnnotations.clear();
+ }
+ else {
+ correctAnnotations = new HashSet<Annotation>();
+ }
+ if(partiallyCorrectAnnotations != null) {
+ partiallyCorrectAnnotations.clear();
+ }
+ else {
+ partiallyCorrectAnnotations = new HashSet<Annotation>();
+ }
+ if(missingAnnotations != null) {
+ missingAnnotations.clear();
+ }
+ else {
+ missingAnnotations = new HashSet<Annotation>();
+ }
+ if(spuriousAnnotations != null) {
+ spuriousAnnotations.clear();
+ }
+ else {
+ spuriousAnnotations = new HashSet<Annotation>();
+ }
keyChoices = new ArrayList<List<Pairing>>(keyList.size());
keyChoices.addAll(Collections.nCopies(keyList.size(), (List<Pairing>)
null));
@@ -186,25 +206,21 @@
finalChoices.add(bestChoice);
switch(bestChoice.value){
case CORRECT_VALUE:{
- if(correctAnnotations == null) correctAnnotations = new
HashSet<Annotation>();
correctAnnotations.add(bestChoice.getResponse());
correctMatches++;
bestChoice.setType(CORRECT_TYPE);
break;
}
case PARTIALLY_CORRECT_VALUE:{
- if(partiallyCorrectAnnotations == null) partiallyCorrectAnnotations
= new HashSet<Annotation>();
partiallyCorrectAnnotations.add(bestChoice.getResponse());
partiallyCorrectMatches++;
bestChoice.setType(PARTIALLY_CORRECT_TYPE);
break;
}
case MISMATCH_VALUE:{
- //this is a mising and a spurious annotations together
- if(missingAnnotations == null) missingAnnotations = new
HashSet<Annotation>();
+ //this is a missing and a spurious annotations together
missingAnnotations.add(bestChoice.getKey());
missing ++;
- if(spuriousAnnotations == null) spuriousAnnotations = new
HashSet<Annotation>();
spuriousAnnotations.add(bestChoice.getResponse());
spurious ++;
bestChoice.setType(MISMATCH_TYPE);
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
------------------------------------------------------------------------------
RSA(R) Conference 2012
Save $700 by Nov 18
Register now
http://p.sf.net/sfu/rsa-sfdev2dev1
_______________________________________________
GATE-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/gate-cvs