@Override public boolean remove(Object o) { boolean result = false; int size = nodes.size(); if(o instanceof LinearNode) { result = nodes.remove(o); String list = ((LinearNode)o).getList(); lists.remove(list); nodesByList.remove(list); gazListsByNode.remove(o); isModified |= (size != nodes.size()); } // if linear node return result; }// remove
@Override public LinearNode remove(int index) { LinearNode result = null; int size = nodes.size(); result = nodes.remove(index); if(null != result) { String list = result.getList(); lists.remove(list); nodesByList.remove(list); gazListsByNode.remove(result); isModified |= (size != nodes.size()); } return result; }
/** * Add a node to this LinearDefinition. * <p> * NOTE: this will throw a GateRuntimeException if anything goes wrong * when reading the list. * * @param index * @param ln */ @Override public void add(int index, LinearNode ln) { String list = ln.getList(); if(!nodesByList.containsKey(list)) { try { GazetteerList gl = loadSingleList(list); gazListsByNode.put(ln, gl); nodes.add(index, ln); nodesByList.put(list, ln); lists.add(list); isModified = true; } catch(ResourceInstantiationException x) { throw new GateRuntimeException("Error loading list: " + list + ": " + x.getMessage(), x); } } // if unique }
public boolean add(LinearNode o) { boolean result = false; String list = o.getList(); if(!nodesByList.containsKey(list)) { try {
/** * Loads the gazetteer lists and maps them to the nodes * * @return a map of nodes vs GazetteerLists * @param isOrdered true if the feature maps used should be ordered * @throws ResourceInstantiationException when the resource cannot be * created */ public Map<LinearNode, GazetteerList> loadLists(boolean isOrdered) throws ResourceInstantiationException { try { gazListsByNode = new HashMap<LinearNode, GazetteerList>(); Iterator<LinearNode> inodes = nodes.iterator(); while(inodes.hasNext()) { LinearNode node = inodes.next(); GazetteerList list = new GazetteerList(); list.setSeparator(separator); URL lurl = new URL(url, node.getList()); list.setURL(lurl); list.setEncoding(encoding); list.load(isOrdered); gazListsByNode.put(node, list); } // while inodes } catch(Exception ex) { throw new ResourceInstantiationException(ex); } return gazListsByNode; } // loadLists()
if(gazetteerlist == null) throw new GazetteerException("gazetteer list not found by node"); String s = linearnode.getList(); String majorType = linearnode.getMajorType(); String minorType = linearnode.getMinorType();
String newListFileName = (String) definitionTableModel.getValueAt(row, column); String oldListFileName = selectedLinearNode.getList(); if (oldListFileName != null && oldListFileName.equals(newListFileName)) { return; } .put(selectedLinearNode, gazetteerList); linearDefinition.getNodesByListNames() .put(selectedLinearNode.getList(), selectedLinearNode); linearDefinition.setModified(true); } else if (column == 2) { // minor type .put(selectedLinearNode, gazetteerList); linearDefinition.getNodesByListNames() .put(selectedLinearNode.getList(), selectedLinearNode); linearDefinition.setModified(true); } else if (column == 3) { // language .put(selectedLinearNode, gazetteerList); linearDefinition.getNodesByListNames() .put(selectedLinearNode.getList(), selectedLinearNode); linearDefinition.setModified(true); } else if (column == 4) { // annotation type .put(selectedLinearNode, gazetteerList); linearDefinition.getNodesByListNames() .put(selectedLinearNode.getList(), selectedLinearNode); linearDefinition.setModified(true);
listName = node.getList(); majorType = node.getMajorType(); minorType = node.getMinorType(); defaultLookup.list = node.getList(); if ( null != mappingDefinition){ MappingNode mnode = mappingDefinition.getNodeByList(defaultLookup.list); lookup.list = node.getList(); if(null != mappingDefinition) { MappingNode mnode = mappingDefinition.getNodeByList(lookup.list);