Formats the results

@param results is the vector of results
@param shape is the shape to present the table of results
@param contents indicates the information to include in the table of
results
@return the formatted results from the benchmark
512143
public String format(Map<String, String> results, TableShape shape,
            TableContents contents) {
        return format(results, shape, contents, "\t");
    }
115700
public void writeContent(final OutputStream result) throws IOException
    {
        Iterator it = this.borders.values().iterator();
        while(it.hasNext()) {
            ((RtfBorder) it.next()).writeContent(result);
        }
    }
739530
private List<String> getValues(UserCoreResult<?, ?, ?> results) {

		List<String> values = null;
		if (results != null) {
			try {
				if (results.getCount() > 0) {
					int columnIndex = results.getColumnIndex(COLUMN_VALUE);
					values = getColumnResults(columnIndex, results);
				} else {
					values = new ArrayList<>();
				}
			} finally {
				results.close();
			}
		} else {
			values = new ArrayList<>();
		}

		return values;
	}
1036803
function(results, options) {
        var id = option('reportToId') || 'jspec'
        var report = document.getElementById(id)
        var failuresOnly = option('failuresOnly')
        var classes = results.stats.failures ? 'has-failures' : ''
        if (!report) throw 'JSpec requires the element #' + id + ' to output its reports'
        
        function bodyContents(body) {
          return JSpec.
            escape(JSpec.contentsOf(body)).
            replace(/^ */gm, function(a){ return (new Array(Math.round(a.length / 3))).join(' ') }).
            replace(/\r\n|\r|\n/gm, '<br/>')
        }
        
        report.innerHTML = '<div id="jspec-report" class="' + classes + '"><div class="heading"> \
        <span class="passes">Passes: <em>' + results.stats.passes + '</em></span>                \
        <span class="failures">Failures: <em>' + results.stats.failures + '</em></span>          \
        <span class="passes">Duration: <em>' + results.duration + '</em> ms</span>          \
        </div><table class="suites">' + map(results.allSuites, function(suite) {
          var displaySuite = failuresOnly ? suite.ran && !suite.passed() : suite.ran
          if (displaySuite && suite.hasSpecs())
            return '<tr class="description"><td colspan="2">' + escape(suite.description) + '</td></tr>' +
              map(suite.specs, function(i, spec) {
                return '<tr class="' + (i % 2 ? 'odd' : 'even') + '">' +
                  (spec.requiresImplementation() ?
                    '<td class="requires-implementation" colspan="2">' + escape(spec.description) + '</td>' :
                      (spec.passed() && !failuresOnly) ?
                        '<td class="pass">' + escape(spec.description)+ '</td><td>' + spec.assertionsGraph() + '</td>' :
                          !spec.passed() ?
                            '<td class="fail">' + escape(spec.description) + 
  													map(spec.failures(), function(a){ return '<em>' + escape(a.message) + '</em>' }).join('') +
 														'</td><td>' + spec.assertionsGraph() + '</td>' :
                              '') +
                  '<tr class="body"><td colspan="2"><pre>' + bodyContents(spec.body) + '</pre></td></tr>'
              }).join('') + '</tr>'
        }).join('') + '</table></div>'
      }
1331377
public static void compareResults(Map<URL, MatchResult> inputMatches,
                                      Map<URL, MatchResult> inputMatchesAlt) {

        MapDifference<URL, MatchResult> diff = Maps.difference(inputMatches, inputMatchesAlt);
        System.out.println("Comparing Match Results Maps");

        Map<URL, MatchResult> common = diff.entriesInCommon();
        System.out.println("Entries in common");
        showMapDetails(common);

        Map<URL, MatchResult> onlyLeft = diff.entriesOnlyOnLeft();
        System.out.println("Entries only in the left map");
        showMapDetails(common);

        Map<URL, MatchResult> onlyRight = diff.entriesOnlyOnRight();
        System.out.println("Entries only in the right map");
        showMapDetails(common);

        Map<URL, ValueDifference<MatchResult>> diffValues = diff.entriesDiffering();
        System.out.println("Differing values");
        for (Entry<URL, ValueDifference<MatchResult>> entry : diffValues.entrySet()) {
            MatchResult resultLeft = entry.getValue().leftValue();
            MatchResult resultRight = entry.getValue().rightValue();

            System.out.println("Match " + entry.getKey().toString());
            System.out.println("Left value details: ");
            System.out.println("Match explanation: " + resultLeft.getExplanation());

            System.out.println("Right value details: ");
            System.out.println("Match explanation: " + resultRight.getExplanation());
        }

    }
1171574
public void writeContent(final OutputStream result) throws IOException
    {
    	
        if(this.topLevelElement) {
            result.write(RtfParagraph.PARAGRAPH_DEFAULTS);
            switch(alignment) {
                case Element.ALIGN_LEFT:
                    result.write(RtfParagraphStyle.ALIGN_LEFT);
                    break;
                case Element.ALIGN_RIGHT:
                    result.write(RtfParagraphStyle.ALIGN_RIGHT);
                    break;
                case Element.ALIGN_CENTER:
                    result.write(RtfParagraphStyle.ALIGN_CENTER);
                    break;
                case Element.ALIGN_JUSTIFIED:
                    result.write(RtfParagraphStyle.ALIGN_JUSTIFY);
                    break;
            }
        }
        result.write(OPEN_GROUP);
        result.write(PICTURE_GROUP);
        result.write(OPEN_GROUP);
        result.write(PICTURE);
        switch(imageType) {
        	case Image.ORIGINAL_JPEG:
        	    result.write(PICTURE_JPEG);
        		break;
        	case Image.ORIGINAL_PNG:
            case Image.ORIGINAL_GIF:
        	    result.write(PICTURE_PNG);
        		break;
        	case Image.ORIGINAL_WMF:
        	case Image.ORIGINAL_BMP:
        	    result.write(PICTURE_WMF);
        		break;
        }
        result.write(PICTURE_WIDTH);
        result.write(intToByteArray((int) width));
        result.write(PICTURE_HEIGHT);
        result.write(intToByteArray((int) height));
        if(this.document.getDocumentSettings().isWriteImageScalingInformation()) {
            result.write(PICTURE_SCALE_X);
            result.write(intToByteArray((int)(100 * plainWidth / width)));
            result.write(PICTURE_SCALE_Y);
            result.write(intToByteArray((int)(100 * plainHeight / height)));
        }
        if(this.document.getDocumentSettings().isImagePDFConformance()) {
            result.write(PICTURE_SCALED_WIDTH);
            result.write(intToByteArray((int) (plainWidth * RtfElement.TWIPS_FACTOR)));
            result.write(PICTURE_SCALED_HEIGHT);
            result.write(intToByteArray((int) (plainHeight * RtfElement.TWIPS_FACTOR)));
        } else {
            if(this.width != this.plainWidth || this.imageType == Image.ORIGINAL_BMP) {
                result.write(PICTURE_SCALED_WIDTH);
                result.write(intToByteArray((int) (plainWidth * PIXEL_TWIPS_FACTOR)));
            }
            if(this.height != this.plainHeight || this.imageType == Image.ORIGINAL_BMP) {
                result.write(PICTURE_SCALED_HEIGHT);
                result.write(intToByteArray((int) (plainHeight * PIXEL_TWIPS_FACTOR)));
            }
        }

        if(this.document.getDocumentSettings().isImageWrittenAsBinary()) {
        	//binary
        	result.write('\n');
        	result.write(PICTURE_BINARY_DATA);
        	result.write(intToByteArray(imageDataSize()));
            result.write(DELIMITER);
            if(result instanceof RtfByteArrayBuffer) {
            	((RtfByteArrayBuffer)result).append(imageData);
            } else {
            	for(int k = 0; k < imageData.length; k++) {
					result.write(imageData[k]);
				}
            }
        } else {
        	//hex encoded
            result.write(DELIMITER);
        	result.write('\n');
        	writeImageDataHexEncoded(result);
        }
        
        result.write(CLOSE_GROUP);
        result.write(CLOSE_GROUP);
        if(this.topLevelElement) {
            result.write(RtfParagraph.PARAGRAPH);
            result.write(RtfParagraph.PARAGRAPH);
        }
        result.write('\n');    	
    }
1223902
private function getFormattedResults(&$results) {
    return implode('', array(
        $this->getReportInfo($results),
        $this->getPaginationInfo($results),
        $this->getProfileInformation($results),
        $this->getQueryParameters($results),
        $this->getColumnHeaders($results),
        $this->getTotalsForAllResults($results),
        $this->getRows($results)
    ));
    
  }
1145291
public void displayFacetResult(CmsSolrResultList solrResultList, CmsSearchResultWrapper resultWrapper) {

        removeAllComponents();
        Component categories = prepareCategoryFacets(solrResultList, resultWrapper);
        if (categories != null) {
            addComponent(categories);
        }
        Component folders = prepareFolderFacets(solrResultList, resultWrapper);
        if (folders != null) {
            addComponent(folders);
        }
        Component dates = prepareDateFacets(solrResultList, resultWrapper);
        if (dates != null) {
            addComponent(dates);
        }
    }
844111
def table_format(self, columns, content):
        
        result = []
        textw = TextWidget()
        for row in content:
            i = 0
            result_row = []
            for cell in row:
                result_row.append(textw.render(cell, **columns[i]))
                i += 1
            result.append(result_row)
        return (columns, result)
436272
@Override
    public void write(Iterable<QueryResult> results) {
        logger.debug("Export to '{}', proxy {} metrics {}", url, proxy, results);

        List<QueryResult> counters = new ArrayList<QueryResult>();
        List<QueryResult> gauges = new ArrayList<QueryResult>();
        for (QueryResult result : results) {
            if (METRIC_TYPE_GAUGE.equals(result.getType())) {
                gauges.add(result);
            } else if (METRIC_TYPE_COUNTER.equals(result.getType())) {
                counters.add(result);
            } else if (null == result.getType()) {
                logger.info("Unspecified type for result {}, export it as counter");
                counters.add(result);
            } else {
                logger.info("Unsupported metric type '{}' for result {}, export it as counter", result.getType(), result);
                counters.add(result);
            }
        }


        HttpURLConnection urlConnection = null;
        try {
            if (proxy == null) {
                urlConnection = (HttpURLConnection) url.openConnection();
            } else {
                urlConnection = (HttpURLConnection) url.openConnection(proxy);
            }
            urlConnection.setRequestMethod("POST");
            urlConnection.setDoInput(true);
            urlConnection.setDoOutput(true);
            urlConnection.setReadTimeout(libratoApiTimeoutInMillis);
            urlConnection.setRequestProperty("content-type", "application/json; charset=utf-8");
            urlConnection.setRequestProperty("Authorization", "Basic " + basicAuthentication);
            urlConnection.setRequestProperty("User-Agent", httpUserAgent);

            serialize(counters, gauges, urlConnection.getOutputStream());
            int responseCode = urlConnection.getResponseCode();
            if (responseCode != 200) {
                exceptionCounter.incrementAndGet();
                logger.warn("Failure {}:'{}' to send result to Librato server '{}' with proxy {}, user {}", responseCode, urlConnection.getResponseMessage(), url, proxy, user);
            }
            if (logger.isTraceEnabled()) {
                IoUtils2.copy(urlConnection.getInputStream(), System.out);
            }
        } catch (Exception e) {
            exceptionCounter.incrementAndGet();
            logger.warn("Failure to send result to Librato server '{}' with proxy {}, user {}", url, proxy, user, e);
        } finally {
            if (urlConnection != null) {
                try {
                    InputStream in = urlConnection.getInputStream();
                    IoUtils2.copy(in, IoUtils2.nullOutputStream());
                    IoUtils2.closeQuietly(in);
                    InputStream err = urlConnection.getErrorStream();
                    if (err != null) {
                        IoUtils2.copy(err, IoUtils2.nullOutputStream());
                        IoUtils2.closeQuietly(err);
                    }
                } catch (IOException e) {
                    logger.warn("Exception flushing http connection", e);
                }
            }

        }
    }
1342968
private void writeRowDefinition(final OutputStream result) throws IOException {
        result.write(ROW_BEGIN);
        this.document.outputDebugLinebreak(result);
        result.write(ROW_WIDTH_STYLE);
        result.write(ROW_WIDTH);
        result.write(intToByteArray(this.width));
        if(this.parentTable.getCellsFitToPage()) {
            result.write(ROW_KEEP_TOGETHER);
        }
        if(this.rowNumber <= this.parentTable.getHeaderRows()) {
            result.write(ROW_HEADER_ROW);
        }
        switch (this.parentTable.getAlignment()) {
            case Element.ALIGN_LEFT:
            	result.write(ROW_ALIGN_LEFT);
                break;
            case Element.ALIGN_RIGHT:
                result.write(ROW_ALIGN_RIGHT);
                break;
            case Element.ALIGN_CENTER:
                result.write(ROW_ALIGN_CENTER);
                break;
            case Element.ALIGN_JUSTIFIED:
            case Element.ALIGN_JUSTIFIED_ALL:
                result.write(ROW_ALIGN_JUSTIFIED);
                break;
        }
        result.write(ROW_GRAPH);
        RtfBorderGroup borders =this.parentTable.getBorders();
        if(borders != null) {
        	borders.writeContent(result);
        }
        
        if(this.parentTable.getCellSpacing() > 0) {
            result.write(ROW_CELL_SPACING_LEFT);
            result.write(intToByteArray((int) (this.parentTable.getCellSpacing() / 2)));
            result.write(ROW_CELL_SPACING_LEFT_STYLE);
            result.write(ROW_CELL_SPACING_TOP);
            result.write(intToByteArray((int) (this.parentTable.getCellSpacing() / 2)));
            result.write(ROW_CELL_SPACING_TOP_STYLE);
            result.write(ROW_CELL_SPACING_RIGHT);
            result.write(intToByteArray((int) (this.parentTable.getCellSpacing() / 2)));
            result.write(ROW_CELL_SPACING_RIGHT_STYLE);
            result.write(ROW_CELL_SPACING_BOTTOM);
            result.write(intToByteArray((int) (this.parentTable.getCellSpacing() / 2)));
            result.write(ROW_CELL_SPACING_BOTTOM_STYLE);
        }
        
        result.write(ROW_CELL_PADDING_LEFT);
        result.write(intToByteArray((int) (this.parentTable.getCellPadding() / 2)));
        result.write(ROW_CELL_PADDING_RIGHT);
        result.write(intToByteArray((int) (this.parentTable.getCellPadding() / 2)));
        result.write(ROW_CELL_PADDING_LEFT_STYLE);
        result.write(ROW_CELL_PADDING_RIGHT_STYLE);
        
        this.document.outputDebugLinebreak(result);
        
        for(int i = 0; i < this.cells.size(); i++) {
            RtfCell rtfCell = (RtfCell) this.cells.get(i);
            rtfCell.writeDefinition(result);
        }    	
    }
672442
static List<Point2D> pointsOf(final Shape shape) {
        final List<Point2D> points = new ArrayList<Point2D>();
        final double[] coordinates = new double[6];
        for (PathIterator i = shape.getPathIterator(null); !i.isDone(); i.next()) {
            switch (i.currentSegment(coordinates)) {
                case PathIterator.SEG_CLOSE:
                    break;
                case PathIterator.SEG_MOVETO:
                case PathIterator.SEG_LINETO:
                    points.add(new Point2D.Double(coordinates[0], coordinates[1]));
                    break;
                case PathIterator.SEG_QUADTO:
                    points.add(new Point2D.Double(coordinates[0], coordinates[1]));
                    points.add(new Point2D.Double(coordinates[2], coordinates[3]));
                    break;
                case PathIterator.SEG_CUBICTO:
                    points.add(new Point2D.Double(coordinates[0], coordinates[1]));
                    points.add(new Point2D.Double(coordinates[2], coordinates[3]));
                    points.add(new Point2D.Double(coordinates[4], coordinates[5]));
                    break;
            }
        }

        if (!points.isEmpty() && points.get(points.size() - 1).equals(points.get(0))) {
            points.remove(points.size() - 1);
        }
        return points;
    }
555978
public static ResultSet forRows(Type type, Iterable<Struct> rows) {
    return new PrePopulatedResultSet(type, rows);
  }
343710
def __process_results(results):
    
    if 'no match' in results and 'returning 0 elements' in results:
        return []

    result_list = []

    # Splts the result and cuts first and last dataset which are comments
    split = results.split(sep='\n\n')[1:-1]

    for entry in split:
        entry_dict = {}
        for value in entry.split('\n'):
            if len(value) < 1:
                continue
            (desc, val) = value.split(': ')
            entry_dict[desc.replace('-', '')] = val.strip(' ')
        result_list.append(entry_dict)
    return result_list
619758
public void writeContent(final OutputStream result) throws IOException
    {
        if(this.content.size() == 0) {
            result.write(RtfParagraph.PARAGRAPH_DEFAULTS);
            if(this.parentRow.getParentTable().getTableFitToPage()) {
                result.write(RtfParagraphStyle.KEEP_TOGETHER_WITH_NEXT);
            }
            result.write(RtfParagraph.IN_TABLE);
        } else {
            for(int i = 0; i < this.content.size(); i++) {
                RtfBasicElement rtfElement = (RtfBasicElement) this.content.get(i);
                if(rtfElement instanceof RtfParagraph) {
                    ((RtfParagraph) rtfElement).setKeepTogetherWithNext(this.parentRow.getParentTable().getTableFitToPage());
                }
                rtfElement.writeContent(result);
                if(rtfElement instanceof RtfParagraph && i < (this.content.size() - 1)) {
                    result.write(RtfParagraph.PARAGRAPH);
                }
            }
        }
        result.write(DocWriter.getISOBytes("\\cell"));
    }
1365963
public String format(Map<String, String> results) {
        return format(results, TableShape.Horizontal);
    }
368396
function drawReport(results) {
    let files;

    files = results.map(result => {
        if (!result.messages.length) {
            return "";
        }

        return `\n${result.filePath}\n\n${drawTable(result.messages)}`;
    });

    files = files.filter(content => content.trim());

    return files.join("");
}