use of de.tudarmstadt.ukp.clarin.webanno.ui.curation.component.model.AnnotationState in project webanno by webanno.
the class SuggestionViewPanel method addSuggestionColor.
/**
* For each {@link ConfigurationSet}, where there are some differences in users annotation and
* the curation annotation.
*/
private void addSuggestionColor(Project aProject, Mode aMode, Map<String, JCas> aCasMap, Map<String, Map<VID, AnnotationState>> aSuggestionColors, Collection<ConfigurationSet> aCfgSet, boolean aI, boolean aAgree) {
for (ConfigurationSet cs : aCfgSet) {
boolean use = false;
for (String u : cs.getCasGroupIds()) {
Map<VID, AnnotationState> colors = aSuggestionColors.get(u);
if (colors == null) {
colors = new HashMap<>();
aSuggestionColors.put(u, colors);
}
for (Configuration c : cs.getConfigurations(u)) {
FeatureStructure fs = c.getFs(u, aCasMap);
AnnotationLayer layer = annotationService.getLayer(fs.getType().getName(), aProject);
TypeAdapter typeAdapter = annotationService.getAdapter(layer);
VID vid;
// link FS
if (c.getPosition().getFeature() != null) {
int fi = 0;
for (AnnotationFeature f : typeAdapter.listFeatures()) {
if (f.getName().equals(c.getPosition().getFeature())) {
break;
}
fi++;
}
vid = new VID(WebAnnoCasUtil.getAddr(fs), fi, c.getAID(u).index);
} else {
vid = new VID(WebAnnoCasUtil.getAddr(fs));
}
if (aAgree) {
colors.put(vid, AnnotationState.AGREE);
continue;
}
// automation and correction projects
if (!aMode.equals(Mode.CURATION) && !aAgree) {
if (cs.getCasGroupIds().size() == 2) {
colors.put(vid, AnnotationState.DO_NOT_USE);
} else {
colors.put(vid, AnnotationState.DISAGREE);
}
continue;
}
// this set agree with the curation annotation
if (c.getCasGroupIds().contains(CURATION_USER)) {
use = true;
} else {
use = false;
}
// this curation view
if (u.equals(CURATION_USER)) {
continue;
}
if (aAgree) {
colors.put(vid, AnnotationState.AGREE);
} else if (use) {
colors.put(vid, AnnotationState.USE);
} else if (aI) {
colors.put(vid, AnnotationState.DISAGREE);
} else if (!cs.getCasGroupIds().contains(CURATION_USER)) {
colors.put(vid, AnnotationState.DISAGREE);
} else {
colors.put(vid, AnnotationState.DO_NOT_USE);
}
}
}
}
}
Aggregations