Example usage for java.util Formatter format

List of usage examples for java.util Formatter format

Introduction

In this page you can find the example usage for java.util Formatter format.

Prototype

public Formatter format(String format, Object... args) 

Source Link

Document

Writes a formatted string to this object's destination using the specified format string and arguments.

Usage

From source file:edu.cmu.tetrad.cli.simulation.data.SemRandomForwardCli.java

@Override
public void printSimulationParameters(Formatter fmt) {
    fmt.format("Number of Latent Confounders: %d%n", numOfLatentConfounders);
    fmt.format("Average Degree: %f%n", avgDegree);
    fmt.format("Maximum Degree: %d%n", maxDegree);
    fmt.format("Maximum Indegree: %d%n", maxIndegree);
    fmt.format("Maximum Outdegree: %d%n", maxOutdegree);
    fmt.format("Connected: %s%n", connected);
}

From source file:net.sourceforge.fenixedu.domain.candidacyProcess.Formation.java

public void exportValues(StringBuilder result) {
    Formatter formatter = new Formatter(result);
    formatter.format("\n%s:\n", BundleUtil.getString(Bundle.CANDIDATE, "title.other.academic.titles"));
    formatter.format("%s: %s\n",
            BundleUtil.getString(Bundle.CANDIDATE, "label.other.academic.titles.program.name"),
            getDesignation());/* w ww.j  a v a 2  s. co m*/
    formatter.format("%s: %s\n",
            BundleUtil.getString(Bundle.CANDIDATE, "label.other.academic.titles.institution"),
            getInstitution().getName());
    formatter.format("%s: %s\n",
            BundleUtil.getString(Bundle.CANDIDATE, "label.other.academic.titles.conclusion.date"),
            StringUtils.isEmpty(getYear()) ? StringUtils.EMPTY : getYear());
    formatter.format("%s: %s\n",
            BundleUtil.getString(Bundle.CANDIDATE, "label.other.academic.titles.conclusion.grade"),
            StringUtils.isEmpty(getConclusionGrade()) ? StringUtils.EMPTY : getConclusionGrade());
    formatter.close();
}

From source file:com.itemanalysis.psychometrics.mixture.MvNormalComponentDistribution.java

public String printMixingProportion() {
    StringBuilder sb = new StringBuilder();
    Formatter f = new Formatter(sb);
    f.format("%6.4f", pi);
    f.format("%n");
    return f.toString();
}

From source file:edu.cmu.tetrad.cli.simulation.data.BayesNetRandomForwardCli.java

@Override
public void printSimulationParameters(Formatter fmt) {
    fmt.format("Number of Latent Confounders: %d%n", numOfLatentConfounders);
    fmt.format("Average Degree: %f%n", avgDegree);
    fmt.format("Maximum Degree: %d%n", maxDegree);
    fmt.format("Maximum Indegree: %d%n", maxIndegree);
    fmt.format("Maximum Outdegree: %d%n", maxOutdegree);
    fmt.format("Connected: %s%n", connected);
    fmt.format("Minimum Categories: %d%n", minCategories);
    fmt.format("Maximum Categories: %d%n", maxCategories);
}

From source file:org.jasig.cas.monitor.SimpleCacheStatistics.java

public void toString(final StringBuilder builder) {
    if (this.name != null) {
        builder.append(this.name).append(':');
    }/* w ww .  j  av a  2  s.  co  m*/
    final Formatter formatter = new Formatter(builder);
    formatter.format("%.2f", this.size / BYTES_PER_MB);
    builder.append("MB used, ");
    builder.append(getPercentFree()).append("% free, ");
    builder.append(this.evictions).append(" evictions");
    IOUtils.closeQuietly(formatter);
}

From source file:com.itemanalysis.psychometrics.cmh.CmhTableRow.java

@Override
public String toString() {
    StringBuilder sb = new StringBuilder();
    Formatter f = new Formatter(sb);

    f.format("%-10s", rowValue);
    f.format("%5s", "");

    Iterator<Comparable<?>> iter = columns.valuesIterator();
    double freq = 0;

    while (iter.hasNext()) {
        freq = columns.getCount(iter.next());
        f.format("%10.0f", freq);
        f.format("%5s", "");
    }/* w  ww .  j  a va2 s  . c om*/
    return f.toString();
}

From source file:com.rackspace.api.clients.veracode.responses.UploadResponse.java

public String getBuildId(int buildVersion) {
    Formatter formatter = new Formatter();
    String buildId = null;/*  ww w .  ja  v a 2s  . co  m*/

    try {
        buildId = (String) xpath.evaluate(formatter.format(XPATH_EXPRESSION, buildVersion).toString(), doc,
                XPathConstants.STRING);
    } catch (XPathExpressionException e) {
        throw new RuntimeException(e);
    }

    return buildId;
}

From source file:org.megam.api.http.TransportTools.java

public String toString() {
    StringBuilder strbd = new StringBuilder();
    final Formatter formatter = new Formatter(strbd);
    formatter.format("%s%n", "*----------------------------------------------*");
    formatter.format("%12s = %s%n", "url", urlString());
    formatter.format("%12s = %s%n", "pairs", pairs());
    formatter.format("%12s = %s%n", "headers", headers());
    formatter.format("%12s = %s%n", "query", isQuery());
    formatter.format("%12s = %s%n", "encoding", encoding());
    formatter.format("%12s = %s%n", "contenttype", contentType());
    formatter.format("%12s = %s%n", "contentstring", contentString());
    formatter.format("%s%n", "*----------------------------------------------*");
    formatter.close();// w w  w .j a v a2s .c om
    return strbd.toString();
}

From source file:edu.cmu.tetrad.cli.search.FgscCli.java

@Override
public void printValidationInfos(Formatter fmt) {
    fmt.format("ensure variable names are unique = %s%n", !skipUniqueVarName);
    fmt.format("ensure variables have non-zero variance = %s%n", !skipZeroVariance);
}

From source file:edu.cmu.tetrad.cli.search.FgscCli.java

@Override
public void printParameterInfos(Formatter fmt) {
    fmt.format("penalty discount = %f%n", penaltyDiscount);
    fmt.format("max degree = %d%n", maxDegree);
    fmt.format("faithfulness assumed = %s%n", faithfulnessAssumed);
}