String lhsCode = getCode(a.getType()); String rhsCode = getCode(b.getType());
if (DEBUG) { if (lhsPattern == null) System.out.println("Missing pattern: " + lhs.getType()); if (rhsPattern == null) System.out.println("Missing pattern: " + rhs.getType()); } String lhsCode = getCode(lhs.getType()); String rhsCode = getCode(rhs.getType());
	public int compare(BugInstance a, BugInstance b) {		int cmp;				if (DEBUG) System.out.println("Fuzzy comparison");				// Bug abbreviations must match.		BugPattern lhsPattern = a.getBugPattern();		BugPattern rhsPattern = b.getBugPattern();//		if ((cmp = compareNullElements(lhsPattern, rhsPattern)) != 0)//			return cmp;				if (lhsPattern == null || rhsPattern == null) {			String lhsCode = getCode(a.getType());			String rhsCode = getCode(b.getType());			if ((cmp = lhsCode.compareTo(rhsCode)) != 0)				return cmp;		} else {			if ((cmp = lhsPattern.getAbbrev().compareTo(rhsPattern.getAbbrev())) != 0)				return cmp;		}				BugCollection lhsCollection = bugCollectionMap.get(a);		BugCollection rhsCollection = bugCollectionMap.get(b);				// Scan through bug annotations, comparing fuzzily if possible				Iterator<BugAnnotation> lhsIter = new FilteringBugAnnotationIterator(a.annotationIterator());		Iterator<BugAnnotation> rhsIter = new FilteringBugAnnotationIterator(b.annotationIterator());				while (lhsIter.hasNext() && rhsIter.hasNext()) {			BugAnnotation lhs = lhsIter.next();			BugAnnotation rhs = rhsIter.next();						if (DEBUG) System.out.println("Compare annotations: " + lhs + "," + rhs);			// Annotation classes must match exactly			cmp = lhs.getClass().getName().compareTo(rhs.getClass().getName());			if (cmp != 0) {				if (DEBUG) System.out.println("annotation class mismatch: " + lhs.getClass().getName() +						"," + rhs.getClass().getName());				return cmp;			}						if (lhs.getClass() == ClassAnnotation.class)				cmp = compareClasses(lhsCollection, rhsCollection, (ClassAnnotation) lhs, (ClassAnnotation) rhs);			else if (lhs.getClass() == MethodAnnotation.class)				cmp = compareMethods(lhsCollection, rhsCollection, (MethodAnnotation) lhs, (MethodAnnotation) rhs);			else if (lhs.getClass() == SourceLineAnnotation.class)				cmp = compareSourceLines(lhsCollection, rhsCollection, (SourceLineAnnotation) lhs, (SourceLineAnnotation) rhs);			else				// everything else just compare directly				cmp = lhs.compareTo(rhs);						if (cmp != 0)				return cmp;		}				// Number of bug annotations must match		if (!lhsIter.hasNext() && !rhsIter.hasNext()) {			if (DEBUG) System.out.println("Match!");			return 0;		} else			return (lhsIter.hasNext() ? 1 : -1);	}