Example usage for java.io PrintStream println

List of usage examples for java.io PrintStream println

Introduction

In this page you can find the example usage for java.io PrintStream println.

Prototype

public void println() 

Source Link

Document

Terminates the current line by writing the line separator string.

Usage

From source file:herbie.running.population.algorithms.AbstractClassifiedFrequencyAnalysis.java

/**
 * @param crosstabFormat indicates if absolute numbers or percentage of all legs are printed
 * @param isCumulative indicates if cumulative numbers are printed
 * @param numberOfQuantiles number of quantiles desired
 *///from w w w.j  a va  2 s. c o m
public void printQuantiles(boolean isCumulative, int numberOfQuantiles, PrintStream out) {
    out.println();
    /*
     * header - start
     */
    out.print("#p");
    for (String mode : this.frequencies.keySet()) {
        out.print("\t" + mode);
    }
    out.println();
    /*
     * header - end
     */

    /*
     * table - start
     */
    double[] quantiles = new double[numberOfQuantiles];
    for (int ii = 0; ii < numberOfQuantiles; ii++) {
        quantiles[ii] = ((double) ii + 1) / (numberOfQuantiles);
    }

    for (int ii = 0; ii < numberOfQuantiles; ii++) {
        out.print(percentFormat.format(quantiles[ii]));
        for (String mode : this.frequencies.keySet()) {
            out.print("\t");
            out.print(classFormat
                    .format(StatUtils.percentile(this.rawData.get(mode).getElements(), quantiles[ii] * 100.0)));
        }
        out.println();
    }
    /*
     * table - end
     */
    out.println();
}

From source file:de.unisb.cs.st.javaslicer.tracer.instrumentation.TracingMethodInstrumenter.java

public static void printStats(final PrintStream out) {
    out.println();
    out.println("----------------------------------------------------");
    final String format = "%-23s%10d%n";
    out.println("Instrumentation statistics:");
    out.format(format, "classes", statsClasses);
    out.format(format, "methods", statsMethods);
    out.format(format, "instructions", statsInstructions);
    out.format(format, "labels (no jump target)", statsLabelsStd);
    out.format(format, "labels (jump target)", statsLabelsJumpTargets);
    out.format(format, "labels (additional)", statsLabelsAdditional);
    out.format(format, "array store", statsArrayStore);
    out.format(format, "array load", statsArrayLoad);
    out.format(format, "get field", statsGetField);
    out.format(format, "put field", statsPutField);
    out.println("----------------------------------------------------");
    out.println();//from  w w w.j  a v a 2  s .c o  m
}

From source file:com.blackducksoftware.tools.nrt.generator.NRTReportGenerator.java

private void writeOutLicenseText(String componentName, PrintStream outputTextFile) {
    try {//from w  w w. ja v  a 2  s.  c  o  m
        outputTextFile.println();
        outputTextFile.println("License texts (" + (componentMap.get(componentName).getLicenses() != null
                ? componentMap.get(componentName).getLicenses().size()
                : "0") + ")");

        int licenseCounter = 0;
        if (componentMap.get(componentName).getLicenses() != null) {

            for (LicenseModel license : componentMap.get(componentName).getLicenseModels()) {

                String licenseName = license.getName() != null
                        ? license.getName() + "(Taken from KnowledgeBase)"
                        : "license_" + licenseCounter + "(Taken from scanned file)";

                if (nrtConfig.isTextFileOutput()) {
                    outputTextFile.println();
                    outputTextFile.println(
                            "==========================================================================");
                    outputTextFile.println(licenseName);
                    outputTextFile.print(StringEscapeUtils.unescapeHtml(Jsoup.clean(license.getText(), "",
                            Whitelist.none(), new Document.OutputSettings().prettyPrint(false))));
                }
                licenseCounter++;
            } // for all licenses
        } // if licenses exist

    } catch (Exception e) {
        log.error("Error writing out licenses", e);
    }
}

From source file:web.GeneratedBanner.java

@Override
public void printBanner(Environment environment, Class<?> sourceClass, PrintStream out) {

    printApplicationName(out, environment, sourceClass);

    printInfoText(out, SPRING, getSpringVersion());
    printInfoText(out, SPRING_BOOT, getSpringBootVersion());
    printInfoText(out, ACTIVE_PROFILES, getActiveProfiles(environment));
    out.println();
}

From source file:herbie.running.population.algorithms.AbstractClassifiedFrequencyAnalysis.java

/**
 * Prints the crosstab.//from w  w w .  j  a  va 2s .c o m
 *
 * @param crosstabFormat indicates if absolute numbers or percentage of all legs are printed
 * @param isCumulative indicates if cumulative numbers are printed
 * @param classes the classification of distances
 */
public void printClasses(CrosstabFormat crosstabFormat, boolean isCumulative, double[] classes,
        PrintStream out) {
    long numberOfLegs;
    out.println();
    /*
     * header - start
     */
    out.print("#i\tclass");
    for (String mode : this.frequencies.keySet()) {
        out.print("\t" + mode);
    }
    out.print("\tsum");
    out.println();
    /*
     * header - end
     */

    /*
     * table - start
     */
    for (int i = 0; i < classes.length; i++) {
        long sumClass = 0;
        out.print(Integer.toString(i) + "\t");
        out.print(classFormat.format(classes[i]));
        for (String mode : this.frequencies.keySet()) {
            out.print("\t");
            if (isCumulative) {
                numberOfLegs = this.getNumberOfLegs(mode, DUMMY_NEGATIVE_BOUND, classes[i]);
            } else {
                numberOfLegs = this.getNumberOfLegs(mode, ((i == 0) ? DUMMY_NEGATIVE_BOUND : classes[i - 1]),
                        classes[i]);
            }
            sumClass += numberOfLegs;

            switch (crosstabFormat) {
            case ABSOLUTE:
                out.print(Long.toString(numberOfLegs));
                break;
            case PERCENTAGE:
                out.print(percentFormat.format((double) numberOfLegs / (double) this.getNumberOfLegs()));
                break;
            }
        }
        out.print("\t");

        switch (crosstabFormat) {
        case ABSOLUTE:
            out.print(Long.toString(sumClass));
            break;
        case PERCENTAGE:
            out.print(percentFormat.format((double) sumClass / (double) this.getNumberOfLegs()));
            break;
        }
        out.println();
    }
    /*
     * table - end
     */

    /*
     * sum - start
     */
    out.print("#sum\t");
    for (String mode : this.frequencies.keySet()) {
        out.print("\t");
        numberOfLegs = this.getNumberOfLegs(mode);

        switch (crosstabFormat) {
        case ABSOLUTE:
            out.print(numberOfLegs);
            break;
        case PERCENTAGE:
            out.print(percentFormat.format((double) numberOfLegs / (double) this.getNumberOfLegs()));
            break;
        }
    }
    out.print("\t");
    numberOfLegs = this.getNumberOfLegs();

    switch (crosstabFormat) {
    case ABSOLUTE:
        out.print(Long.toString(numberOfLegs));
        break;
    case PERCENTAGE:
        out.print(percentFormat.format(1.0));
        break;
    }
    /*
     * sum - end
     */
    out.println();
}

From source file:com.blackducksoftware.tools.nrt.generator.NRTReportGenerator.java

private void writeOutCopyrights(String componentName, PrintStream outputTextFile) {
    try {/*w ww .j  av a 2s.  c  o  m*/
        if (nrtConfig.isShowCopyrights()) {

            outputTextFile.println();
            outputTextFile.println("copyrights (" + (componentMap.get(componentName).getCopyrights() != null
                    ? componentMap.get(componentName).getCopyrights().size()
                    : "0") + ")");

            if (componentMap.get(componentName).getCopyrights() != null) {

                for (String copyright : componentMap.get(componentName).getCopyrights()) {
                    outputTextFile.println(copyright);
                }
            }
        }
    } catch (Exception e) {
        log.error("Unable to write out copyrights", e);
    }

}

From source file:ie.aib.nbp.zosconnect.ZosRestServicePerformanceRunner.java

public long executeServices(String URI, String username, String password, String payload, PrintStream out,
        boolean attachResponse, boolean formatResponse) {
    long elapsedTime = 0L;
    //SimpleDateFormat sdf = new SimpleDateFormat("HH:mm:ss z");
    //out.print("Start DateTime: "+sdf.format(new Date())+"   response: ");
    out.print("Call succeeded, response: ");
    if (formatResponse)
        out.println();
    long startTime = System.currentTimeMillis();
    if (this.connector.isReadyToGo()) {
        String response = this.connector.makePostRequest(URI, username, password, payload);
        try {/* w w  w  .j  ava2s .c om*/
            JSONObject result = new JSONObject(response);
            if (attachResponse) {
                String output = formatResponse ? result.toString(4) : result.toString();
                out.println(output);
            }

            //calculate execution time
            elapsedTime = System.currentTimeMillis() - startTime;
            //out.print("End DateTime: "+sdf.format(new Date())+"     ");                
            out.println("service call completed in " + elapsedTime + " miliseconds.");

        } catch (Exception ex) {
            out.println("execution failed or hit the timeout !!!");
        }
    }
    return elapsedTime;
}