parameters: (A, B)
return_statement: return res
docstring: compareResults - Generate a relation from diagnostics in run A to
      diagnostics in run B.
  
      The result is the relation as a list of triples (a, b, confidence) where
      each element {a,b} is None or an element from the respective run, and
      confidence is a measure of the match quality (where 0 indicates equality,
      and None is used if either element is None).
docstring_summary: compareResults - Generate a relation from diagnostics in run A to
      diagnostics in run B.
docstring_tokens: compareResults - Generate a relation from diagnostics in run A to diagnostics in run B .
function: def compareResults(A, B):
      """
      compareResults - Generate a relation from diagnostics in run A to
      diagnostics in run B.
  
      The result is the relation as a list of triples (a, b, confidence) where
      each element {a,b} is None or an element from the respective run, and
      confidence is a measure of the match quality (where 0 indicates equality,
      and None is used if either element is None).
      """
  
      res = []
  
      # Quickly eliminate equal elements.
      neqA = []
      neqB = []
      eltsA = list(A.diagnostics)
      eltsB = list(B.diagnostics)
      eltsA.sort(key = cmpAnalysisDiagnostic)
      eltsB.sort(key = cmpAnalysisDiagnostic)
      while eltsA and eltsB:
          a = eltsA.pop()
          b = eltsB.pop()
          if (a.getIssueIdentifier() == b.getIssueIdentifier()) :
              res.append((a, b, 0))
          elif a.getIssueIdentifier() > b.getIssueIdentifier():
              eltsB.append(b)
              neqA.append(a)
          else:
              eltsA.append(a)
              neqB.append(b)
      neqA.extend(eltsA)
      neqB.extend(eltsB)
  
      # FIXME: Add fuzzy matching. One simple and possible effective idea would be
      # to bin the diagnostics, print them in a normalized form (based solely on
      # the structure of the diagnostic), compute the diff, then use that as the
      # basis for matching. This has the nice property that we don't depend in any
      # way on the diagnostic format.
  
      for a in neqA:
          res.append((a, None, None))
      for b in neqB:
          res.append((None, b, None))
  
      return res
function_tokens: def compareResults ( A , B ) : res = [ ] # Quickly eliminate equal elements. neqA = [ ] neqB = [ ] eltsA = list ( A . diagnostics ) eltsB = list ( B . diagnostics ) eltsA . sort ( key = cmpAnalysisDiagnostic ) eltsB . sort ( key = cmpAnalysisDiagnostic ) while eltsA and eltsB : a = eltsA . pop ( ) b = eltsB . pop ( ) if ( a . getIssueIdentifier ( ) == b . getIssueIdentifier ( ) ) : res . append ( ( a , b , 0 ) ) elif a . getIssueIdentifier ( ) > b . getIssueIdentifier ( ) : eltsB . append ( b ) neqA . append ( a ) else : eltsA . append ( a ) neqB . append ( b ) neqA . extend ( eltsA ) neqB . extend ( eltsB ) # FIXME: Add fuzzy matching. One simple and possible effective idea would be # to bin the diagnostics, print them in a normalized form (based solely on # the structure of the diagnostic), compute the diff, then use that as the # basis for matching. This has the nice property that we don't depend in any # way on the diagnostic format. for a in neqA : res . append ( ( a , None , None ) ) for b in neqB : res . append ( ( None , b , None ) ) return res