Example usage for org.apache.commons.lang3.math Fraction doubleValue

List of usage examples for org.apache.commons.lang3.math Fraction doubleValue

Introduction

In this page you can find the example usage for org.apache.commons.lang3.math Fraction doubleValue.

Prototype

@Override
public double doubleValue() 

Source Link

Document

Gets the fraction as a double.

Usage

From source file:org.richfaces.tests.metamer.ftest.extension.attributes.coverage.saver.FullReportResultsSaver.java

protected void write(BufferedWriter bw) throws IOException {
    try {/* ww  w . j  a  v a  2s . c  om*/
        int covered = 0, notCovered = 0;
        for (CoverageResult result : getResults()) {
            bw.append(result.getReport());
            bw.newLine();
            bw.flush();
            covered += result.getCovered().size() + result.getIgnored().size();
            notCovered += result.getNotCovered().size();
        }
        Fraction f = Fraction.getFraction(covered, covered + notCovered);
        bw.append("===========================================================");
        bw.newLine();
        bw.append("total coverage: ").append(f.toString()).append(" (")
                .append(String.valueOf((int) (f.doubleValue() * 100))).append("%)");
        bw.newLine();
        bw.flush();
    } finally {
        if (bw != null) {
            bw.close();
        }
    }
}