code: public Double averagePrecision() 
      {
          double n = 0;
          double sumPrecision = 0;
          for (int i=0; i<pairs.length; i++) {
              if (correctPair(i)) {
                  n++;
                  double precisionAtRankI = n/(i+1.0);
                  sumPrecision += precisionAtRankI;
              }
          }
          return new Double(sumPrecision / numCorrectPairs);
      }
docs: non-interpolated average precision