return retval;
}
public synchronized void itemsFound(SearchEvent e) {
SearchTOCItem tocitem;
Enumeration itemEnum = e.getSearchItems();
// Iterate through each search item in the searchEvent
while (itemEnum.hasMoreElements()) {
SearchItem item = (SearchItem) itemEnum.nextElement();
URL url;
try {
url = new URL(item.getBase(), item.getFilename());
} catch (MalformedURLException me) {
debug ("Failed to create URL from " + item.getBase() + "|" +
item.getFilename());
continue;
}
boolean foundNode = false;
// see if this search item matches that of one we currently have
// if so just do an update
Enumeration nodesEnum = nodes.elements();
while (nodesEnum.hasMoreElements()) {
tocitem = (SearchTOCItem) nodesEnum.nextElement();
URL testURL = tocitem.getURL();
if (testURL != null && url != null && url.sameFile(testURL)) {
tocitem.addSearchHit(new SearchHit(item.getConfidence(),
item.getBegin(),
item.getEnd()));
foundNode = true;
break;
}
}
// No match.
// OK then add a new one.
if (!foundNode) {
tocitem = new SearchTOCItem(item);
nodes.addElement(tocitem);
}
}
}