int featuresProcessed = 0;
int totalFeatures = featureToMatchesMap.size();
HashMap newMap = new HashMap();
if (featureToMatchesMap.isEmpty()) { return newMap; }
for (Iterator i = featureToMatchesMap.keySet().iterator(); i.hasNext() && ! monitor.isCancelRequested(); ) {
Feature oldKey = (Feature) i.next();
featuresProcessed++;
monitor.report(featuresProcessed, totalFeatures, "features inverted");
Matches oldMatches = (Matches) featureToMatchesMap.get(oldKey);
for (int j = 0; j < oldMatches.size(); j++) {
Feature newKey = (Feature) oldMatches.getFeature(j);
Matches newMatches = (Matches) newMap.get(newKey);
if (newMatches == null) {
newMatches = new Matches(oldKey.getSchema());
}
newMatches.add(oldKey, oldMatches.getScore(j));