int numPreserved = 0; int numAlreadyAnnotated = 0; int numLost = 0; int numLostWithAnnotations = 0;
System.out.println(mergeResults.getNumPreserved() + " preserved, " + mergeResults.getNumAlreadyAnnotated() + " already annotated, " + mergeResults.getNumLost() + " lost (" + mergeResults.getNumLostWithAnnotations() + " lost with annotations)");
	public static void main(String[] argv) throws Exception {		if (argv.length != 3) {			System.err.println("Usage: " + MergeResults.class.getName() + " <orig results> <new results> <output file>");			System.exit(1);		}		if (VERSION_INSENSITIVE) {			System.out.println("Using version-insensitive bug comparator");		}		DetectorFactoryCollection.instance(); // as a side effect, loads detector plugins		String origResultsFile = argv[0];		String newResultsFile = argv[1];		String outputFile = argv[2];		Project project = new Project();		SortedBugCollection origCollection = new SortedBugCollection();		SortedBugCollection newCollection = new SortedBugCollection();		origCollection.readXML(origResultsFile, new Project());		newCollection.readXML(newResultsFile, project);		SortedSet<BugInstance> origSet = createSet(origCollection);		SortedSet<BugInstance> newSet = createSet(newCollection);		Set<String> updateCategorySet = new HashSet<String>();		if (UPDATE_CATEGORIES) {			extractCategories(newSet, updateCategorySet);			System.out.println("Updating only categories: " + updateCategorySet);		}		int numPreserved = 0;		int numAlreadyAnnotated = 0;		int numLost = 0;		int numLostWithAnnotations = 0;		Iterator<BugInstance> i = origSet.iterator();		while (i.hasNext()) {			BugInstance orig = i.next();			if (UPDATE_CATEGORIES && !updateCategorySet.contains(orig.getAbbrev())) {				// This original bug is not in a category that we are updating.				// Therefore, it is copied into the results unconditionally.				numPreserved++;				newCollection.add(orig);			} else {				// This original bug is in an updated category.				// So, to be preserved, it must also be in the new set.				if (newSet.contains(orig)) {					SortedSet<BugInstance> tailSet = newSet.tailSet(orig);					BugInstance matching = tailSet.first();					if (matching.getAnnotationText().equals("")) {						matching.setAnnotationText(orig.getAnnotationText());						numPreserved++;					} else {						numAlreadyAnnotated++;					}				} else {					numLost++;					if (!orig.getAnnotationText().equals("")) {						System.out.println("Losing a bug with an annotation:");						System.out.println(orig.getMessage());						SourceLineAnnotation srcLine = orig.getPrimarySourceLineAnnotation();						if (srcLine != null)							System.out.println("\t" + srcLine.toString());						System.out.println(orig.getAnnotationText());						numLostWithAnnotations++;					}				}			}		}		System.out.println(numPreserved + " preserved, " +			numAlreadyAnnotated + " already annotated, " +			numLost + " lost (" + numLostWithAnnotations + " lost with annotations)");		newCollection.writeXML(outputFile, project);	}