if (substring == null) {
if (memoryIndex == null) {
for (int i = 0, l = docNames.length; i < l; i++)
results.add(docNames[i]);
} else {
SimpleLookupTable docsToRefs = memoryIndex.docsToReferences;
for (int i = 0, l = docNames.length; i < l; i++) {
String docName = docNames[i];
if (!docsToRefs.containsKey(docName))
results.add(docName);
}
}
} else {
if (memoryIndex == null) {
for (int i = 0, l = docNames.length; i < l; i++)
if (docNames[i].startsWith(substring, 0))
results.add(docNames[i]);
} else {
SimpleLookupTable docsToRefs = memoryIndex.docsToReferences;
for (int i = 0, l = docNames.length; i < l; i++) {
String docName = docNames[i];
if (docName.startsWith(substring, 0) && !docsToRefs.containsKey(docName))
results.add(docName);
}
}
}
return results;