IndexIteratorCachePair iicp;
IntPointerIterator it;
ArrayList iv, cv;
// We may need to profile this. If this is a bottleneck, use a different
// implementation.
SortedIntSet set;
int jMax, indStrat;
// Iterate over all types.
for (int i = 0; i < this.indexArray.length; i++) {
iv = this.indexArray[i];
if (iv == null) {
// The 0 position is the only one that should be null.
continue;
}
// Iterate over the indexes for the type.
jMax = iv.size();
// Create a vector of IICPs. If there is at least one sorted or bag
// index, pick one arbitrarily and add its FSs (since it contains all
// FSs that all other indexes for the same type contain). If there are
// only set indexes, create a set of the FSs in those indexes, since they
// may all contain different elements (FSs that are duplicates for one
// index may not be duplicates for a different one).
cv = new ArrayList();
for (int j = 0; j < jMax; j++) {
iicp = (IndexIteratorCachePair) iv.get(j);
indStrat = iicp.index.getIndexingStrategy();
if (indStrat == FSIndex.SET_INDEX) {
cv.add(iicp);
} else {
if (cv.size() > 0) {
cv = new ArrayList();
}
cv.add(iicp);
break;
}
}
if (cv.size() > 0) {
set = new SortedIntSet();
for (int k = 0; k < cv.size(); k++) {
it = ((IndexIteratorCachePair) cv.get(k)).index.refIterator();
while (it.isValid()) {
set.add(it.get());
it.inc();
}
}
for (int k = 0; k < set.size(); k++) {
v.add(set.get(k));
}
}
}
return v.toArray();
}