public bool FindIndex(XPathNavigator context, int indexId, out XmlILIndex index) {
XPathNavigator navRoot;
ArrayList docIndexes;
Debug.Assert(context != null);
// Get root of document
navRoot = context.Clone();
navRoot.MoveToRoot();
// Search pre-existing indexes in order to determine whether the specified index has already been created
if (this.indexes != null && indexId < this.indexes.Length) {
docIndexes = (ArrayList) this.indexes[indexId];
if (docIndexes != null) {
// Search for an index defined over the specified document
for (int i = 0; i < docIndexes.Count; i += 2) {
// If we find a matching document, then return the index saved in the next slot
if (((XPathNavigator) docIndexes[i]).IsSamePosition(navRoot)) {
index = (XmlILIndex) docIndexes[i + 1];
return true;
}
}
}
}
// Return a new, empty index
index = new XmlILIndex();
return false;
}