MCPcopy Create free account
hub / github.com/GateNLP/gate-core / createChain

Method createChain

src/main/java/gate/gui/docview/CorefEditor.java:1078–1166  ·  view source on GitHub ↗

Creates the internal data structure @param set

(AnnotationSet set, boolean isDefaultSet)

Source from the content-addressed store, hash-verified

1076 * @param set
1077 */
1078 @SuppressWarnings("unchecked")
1079 private CorefTreeNode createChain(AnnotationSet set, boolean isDefaultSet) {
1080
1081 // create the node for setName
1082 String setName = isDefaultSet ? DEFAULT_ANNOTSET_NAME : set.getName();
1083 CorefTreeNode annotSetNode = new CorefTreeNode(setName, true,
1084 CorefTreeNode.ANNOTSET_NODE);
1085
1086 // see if this setName available in the annotSets
1087 boolean found = false;
1088 for (int i = 0; i < annotSets.getModel().getSize(); i++) {
1089 if ( annotSets.getModel().getElementAt(i).equals(setName)) {
1090 found = true;
1091 break;
1092 }
1093 }
1094 if (!found) {
1095 explicitCall = true;
1096 annotSets.addItem(setName);
1097 explicitCall = false;
1098 }
1099
1100 // the internal datastructure
1101 Map<CorefTreeNode, List<Integer>> chainLinks = new HashMap<CorefTreeNode, List<Integer>>();
1102 Map<String, Boolean> selectionMap = new HashMap<String, Boolean>();
1103 Map<String, Color> colorMap = new HashMap<String, Color>();
1104
1105 // map for all the annotations with matches feature in it
1106 Map<String,List<List<Integer>>> matchesMap = null;
1107 Object matchesMapObject = document.getFeatures().get(ANNIEConstants.DOCUMENT_COREF_FEATURE_NAME);
1108 if(matchesMapObject instanceof Map) {
1109 matchesMap = (Map<String,List<List<Integer>>>) matchesMapObject;
1110 }
1111
1112
1113 // what if this map is null
1114 if (matchesMap == null) {
1115 corefChains.put(annotSetNode, chainLinks);
1116 selectionChainsMap.put(setName, selectionMap);
1117 colorChainsMap.put(setName, colorMap);
1118 return annotSetNode;
1119 }
1120
1121 //AnnotationSetName --> List of ArrayLists
1122 //each ArrayList contains Ids of related annotations
1123 List<List<Integer>> matches1 = matchesMap.get(isDefaultSet ? "" :
1124 setName);
1125 if (matches1 == null) {
1126 corefChains.put(annotSetNode, chainLinks);
1127 selectionChainsMap.put(setName, selectionMap);
1128 colorChainsMap.put(setName, colorMap);
1129 return annotSetNode;
1130 }
1131
1132 Iterator<List<Integer>> tempIter = matches1.iterator();
1133
1134 while (tempIter.hasNext()) {
1135 List<Integer> matches = tempIter.next();

Callers 2

featureMapUpdatedMethod · 0.95
initDataMethod · 0.95

Calls 15

getStringMethod · 0.95
getModelMethod · 0.80
getNextColorMethod · 0.80
getNameMethod · 0.65
equalsMethod · 0.65
getMethod · 0.65
getFeaturesMethod · 0.65
iteratorMethod · 0.65
hasNextMethod · 0.65
nextMethod · 0.65
sizeMethod · 0.65

Tested by

no test coverage detected