Example usage for java.text NumberFormat getPercentInstance

List of usage examples for java.text NumberFormat getPercentInstance

Introduction

In this page you can find the example usage for java.text NumberFormat getPercentInstance.

Prototype

public static final NumberFormat getPercentInstance() 

Source Link

Document

Returns a percentage format for the current default java.util.Locale.Category#FORMAT FORMAT locale.

Usage

From source file:net.yacy.crawler.data.CacheTest.java

/**
 * Run a stress test on the Cache/*from w w  w .  j  ava  2  s .  co m*/
 * 
 * @param args
 *            main arguments
 * @throws IOException
 *             when a error occurred
 */
public static void main(final String args[]) throws IOException {
    System.out.println("Stress test on Cache");

    /*
     * Set the root log level to WARNING to prevent filling the console with
     * too many information log messages
     */
    LogManager.getLogManager().readConfiguration(
            new ByteArrayInputStream(".level=WARNING".getBytes(StandardCharsets.ISO_8859_1)));

    /* Main control parameters. Modify values for different scenarios. */

    /* Number of concurrent test tasks */
    final int threads = 50;
    /* Number of steps in each task */
    final int steps = 10;
    /* Number of test URLs in each task */
    final int urlsPerThread = 5;
    /* Size of the generated test content */
    final int contentSize = Math.max(Cache.DEFAULT_COMPRESSOR_BUFFER_SIZE + 1,
            Cache.DEFAULT_BACKEND_BUFFER_SIZE + 1) / urlsPerThread;
    /* Cache maximum size */
    final long cacheMaxSize = Math.min(1024 * 1024 * 1024, ((long) contentSize) * 10 * urlsPerThread);
    /* Sleep time between each cache operation */
    final long sleepTime = 0;
    /* Maximum waiting time (in ms) for acquiring a synchronization lock */
    final long lockTimeout = 2000;
    /* The backend compression level */
    final int compressionLevel = Deflater.BEST_COMPRESSION;

    Cache.init(new File(System.getProperty("java.io.tmpdir") + File.separator + "yacyTestCache"), "peerSalt",
            cacheMaxSize, lockTimeout, compressionLevel);
    Cache.clear();
    System.out.println("Cache initialized with a maximum size of " + cacheMaxSize + " bytes.");

    try {
        System.out.println("Starting " + threads + " threads ...");
        long time = System.nanoTime();
        List<CacheAccessTask> tasks = new ArrayList<>();
        for (int count = 0; count < threads; count++) {
            List<DigestURL> urls = new ArrayList<>();
            for (int i = 0; i < urlsPerThread; i++) {
                urls.add(new DigestURL("http://yacy.net/" + i + "/" + count));
            }
            CacheAccessTask thread = new CacheAccessTask(urls, steps, contentSize, sleepTime);
            thread.start();
            tasks.add(thread);
        }
        /* Wait for tasks termination */
        for (CacheAccessTask task : tasks) {
            try {
                task.join();
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        }
        /*
         * Check consistency : cache should be empty when all tasks have
         * terminated without error
         */
        Cache.commit();
        long docCount = Cache.getActualCacheDocCount();
        if (docCount > 0) {
            System.out.println("Cache is not empty!!! Actual documents count : " + docCount);
        }

        System.out.println("All threads terminated in "
                + TimeUnit.NANOSECONDS.toSeconds(System.nanoTime() - time) + "s. Computing statistics...");
        long storeTime = 0;
        long maxStoreTime = 0;
        long getContentTime = 0;
        long maxGetContentTime = 0;
        int storeFailures = 0;
        long deleteTime = 0;
        long maxDeleteTime = 0;
        long totalSteps = 0;
        for (CacheAccessTask task : tasks) {
            storeTime += task.getStoreTime();
            maxStoreTime = Math.max(task.getMaxStoreTime(), maxStoreTime);
            getContentTime += task.getGetContentTime();
            maxGetContentTime = Math.max(task.getMaxGetContentTime(), maxGetContentTime);
            storeFailures += task.getStoreFailures();
            deleteTime += task.getDeleteTime();
            maxDeleteTime = Math.max(task.getMaxDeleteTime(), maxDeleteTime);
            totalSteps += task.getSteps();
        }
        System.out.println("Cache.store() total time (ms) : " + TimeUnit.NANOSECONDS.toMillis(storeTime));
        System.out.println("Cache.store() maximum time (ms) : " + TimeUnit.NANOSECONDS.toMillis(maxStoreTime));
        System.out.println(
                "Cache.store() mean time (ms) : " + TimeUnit.NANOSECONDS.toMillis(storeTime / totalSteps));
        System.out.println("Cache.store() failures : " + storeFailures);
        System.out.println("");
        System.out.println(
                "Cache.getContent() total time (ms) : " + TimeUnit.NANOSECONDS.toMillis(getContentTime));
        System.out.println(
                "Cache.getContent() maximum time (ms) : " + TimeUnit.NANOSECONDS.toMillis(maxGetContentTime));
        System.out.println("Cache.getContent() mean time (ms) : "
                + TimeUnit.NANOSECONDS.toMillis(getContentTime / totalSteps));
        System.out.println("Cache hits : " + Cache.getHits() + " total requests : " + Cache.getTotalRequests()
                + " ( hit rate : " + NumberFormat.getPercentInstance().format(Cache.getHitRate()) + " )");
        System.out.println("");
        System.out.println("Cache.delete() total time (ms) : " + TimeUnit.NANOSECONDS.toMillis(deleteTime));
        System.out
                .println("Cache.delete() maximum time (ms) : " + TimeUnit.NANOSECONDS.toMillis(maxDeleteTime));
        System.out.println(
                "Cache.delete() mean time (ms) : " + TimeUnit.NANOSECONDS.toMillis(deleteTime / totalSteps));
    } finally {
        try {
            Cache.close();
        } finally {
            /* Shutdown running threads */
            ArrayStack.shutdownDeleteService();
            try {
                Domains.close();
            } finally {
                ConcurrentLog.shutdown();
            }
        }
    }

}

From source file:FormatterFactoryDemo.java

private void setUpFormats() {
    amountDisplayFormat = NumberFormat.getCurrencyInstance();
    amountDisplayFormat.setMinimumFractionDigits(0);
    amountEditFormat = NumberFormat.getNumberInstance();

    percentDisplayFormat = NumberFormat.getPercentInstance();
    percentDisplayFormat.setMinimumFractionDigits(2);
    percentEditFormat = NumberFormat.getNumberInstance();
    percentEditFormat.setMinimumFractionDigits(2);

    paymentFormat = NumberFormat.getCurrencyInstance();
}

From source file:com.rapidminer.gui.plotter.charts.ParetoChartPlotter.java

private JFreeChart createChart() {
    if (data.getItemCount() > 0) {
        // get cumulative percentages
        KeyedValues cumulative = DataUtilities.getCumulativePercentages(data);

        CategoryDataset categoryDataset = DatasetUtilities.createCategoryDataset(
                "Count for " + this.dataTable.getColumnName(this.countColumn) + " = " + countValue, data);

        // create the chart...
        final JFreeChart chart = ChartFactory.createBarChart(null, // chart title
                this.dataTable.getColumnName(this.groupByColumn), // domain axis label
                "Count", // range axis label
                categoryDataset, // data
                PlotOrientation.VERTICAL, true, // include legend
                true, false);/*from   w w  w.j av a 2  s.c  om*/

        // set the background color for the chart...
        chart.setBackgroundPaint(Color.WHITE);

        // get a reference to the plot for further customization...
        CategoryPlot plot = chart.getCategoryPlot();

        CategoryAxis domainAxis = plot.getDomainAxis();
        domainAxis.setLowerMargin(0.02);
        domainAxis.setUpperMargin(0.02);
        domainAxis.setLabelFont(LABEL_FONT_BOLD);
        domainAxis.setTickLabelFont(LABEL_FONT);

        // set the range axis to display integers only...
        NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis();
        rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits(Locale.US));
        rangeAxis.setLabelFont(LABEL_FONT_BOLD);
        rangeAxis.setTickLabelFont(LABEL_FONT);

        // second data set (cumulative percentages)
        CategoryDataset dataset2 = DatasetUtilities.createCategoryDataset("Cumulative (Percent)", cumulative);

        LineAndShapeRenderer renderer2 = new LineAndShapeRenderer();
        renderer2.setSeriesPaint(0, SwingTools.VERY_DARK_BLUE.darker());

        NumberAxis axis2 = new NumberAxis("Percent of " + countValue);
        axis2.setNumberFormatOverride(NumberFormat.getPercentInstance());
        axis2.setLabelFont(LABEL_FONT_BOLD);
        axis2.setTickLabelFont(LABEL_FONT);

        plot.setRangeAxis(1, axis2);
        plot.setDataset(1, dataset2);
        plot.setRenderer(1, renderer2);
        plot.mapDatasetToRangeAxis(1, 1);

        axis2.setTickUnit(new NumberTickUnit(0.1));

        // show grid lines
        plot.setRangeGridlinesVisible(true);

        // bring cumulative line to front
        plot.setDatasetRenderingOrder(DatasetRenderingOrder.FORWARD);

        if (isLabelRotating()) {
            domainAxis.setTickLabelsVisible(true);
            domainAxis.setCategoryLabelPositions(
                    CategoryLabelPositions.createUpRotationLabelPositions(Math.PI / 2.0d));
        }

        return chart;
    } else {
        return null;
    }
}

From source file:org.alfresco.repo.batch.BatchProcessor.java

/**
 * {@inheritDoc}// w w w .  j a v  a2  s .  co m
 */
public synchronized String getPercentComplete() {
    int totalResults = this.workProvider.getTotalEstimatedWorkSize();
    int processed = this.successfullyProcessedEntries + this.totalErrors;
    return processed <= totalResults
            ? NumberFormat.getPercentInstance()
                    .format(totalResults == 0 ? 1.0F : (float) processed / totalResults)
            : "Unknown";
}

From source file:org.evosuite.statistics.backend.HTMLStatisticsBackend.java

/**
 * The big table of results//from   ww w .ja va 2  s. c o  m
 * 
 * @param buffer
 *            a {@link java.lang.StringBuffer} object.
 */
protected void writeRunTable(TestSuiteChromosome suite, Map<String, OutputVariable<?>> data,
        StringBuffer buffer) {
    SimpleDateFormat sdf = new SimpleDateFormat(DATE_FORMAT_NOW);

    buffer.append("<tr>");
    // buffer.append("<td>" + entry.id + "</td>");
    buffer.append("<td>");
    buffer.append(sdf.format(new Date()));
    buffer.append("</td>");
    buffer.append("<td>");
    if (data.containsKey(RuntimeVariable.Total_Time.name())) {
        long duration = (Long) data.get(RuntimeVariable.Total_Time.name()).getValue() / 1000L;
        buffer.append(String.format("%d:%02d:%02d", duration / 3600, (duration % 3600) / 60, (duration % 60)));
    } else
        buffer.append("UNKNOWN");
    buffer.append("</td>");
    buffer.append("<td>");
    Double coverage = (Double) getOutputVariableValue(data, RuntimeVariable.Coverage.name());
    buffer.append((coverage != null) ? NumberFormat.getPercentInstance().format(coverage) : "UNKNOWN");
    buffer.append("</td>");
    buffer.append("<td><a href=\"html/");
    String filename = writeRunPage(suite, data);
    buffer.append(filename);
    buffer.append("\">");
    buffer.append(data.get("TARGET_CLASS").getValue());
    buffer.append("</tr>\n");

    buffer.append("<!-- EVOSUITE INSERTION POINT -->\n");
    buffer.append("<tr class=\"top\"><td colspan=\"3\">&nbsp;<td></tr>\n");
    buffer.append("</table>");
}

From source file:org.evosuite.strategy.RegressionSuiteStrategy.java

@Override
public TestSuiteChromosome generateTests() {
    ClientServices.getInstance().getClientNode().trackOutputVariable(RuntimeVariable.Total_Goals, 0);
    ClientServices.getInstance().getClientNode().trackOutputVariable(RuntimeVariable.Generated_Assertions, 0);
    ClientServices.getInstance().getClientNode().trackOutputVariable(RuntimeVariable.Coverage_Old, 0);
    ClientServices.getInstance().getClientNode().trackOutputVariable(RuntimeVariable.Coverage_New, 0);
    ClientServices.getInstance().getClientNode().trackOutputVariable(RuntimeVariable.Exception_Difference, 0);
    ClientServices.getInstance().getClientNode().trackOutputVariable(RuntimeVariable.State_Distance, 0);
    ClientServices.getInstance().getClientNode().trackOutputVariable(RuntimeVariable.Testsuite_Diversity, 0);
    ClientServices.getInstance().getClientNode().trackOutputVariable(RuntimeVariable.Regression_ID,
            RegressionSearchListener.statsID);

    // Disable test archive
    Properties.TEST_ARCHIVE = false;

    // Disable functional mocking stuff (due to incompatibilities)
    Properties.P_FUNCTIONAL_MOCKING = 0;
    Properties.FUNCTIONAL_MOCKING_INPUT_LIMIT = 0;
    Properties.FUNCTIONAL_MOCKING_PERCENT = 0;

    // Regression random strategy switch. 
    if (Properties.REGRESSION_FITNESS == RegressionMeasure.RANDOM) {
        return generateRandomRegressionTests();
    }/* w  ww  .j a v  a  2  s . c  o  m*/

    LoggingUtils.getEvoLogger().info("* Setting up search algorithm for REGRESSION suite generation");
    PropertiesSuiteGAFactory algorithmFactory = new PropertiesSuiteGAFactory();
    GeneticAlgorithm<?> algorithm = algorithmFactory.getSearchAlgorithm();

    if (Properties.SERIALIZE_GA || Properties.CLIENT_ON_THREAD)
        TestGenerationResultBuilder.getInstance().setGeneticAlgorithm(algorithm);

    long startTime = System.currentTimeMillis() / 1000;

    Properties.CRITERION = new Criterion[] { Criterion.REGRESSION };
    // What's the search target
    List<TestSuiteFitnessFunction> fitnessFunctions = getFitnessFunctions();

    // TODO: Argh, generics.
    algorithm.addFitnessFunctions((List) fitnessFunctions);

    algorithm.addListener(regressionMonitor); // FIXME progressMonitor may
    // cause
    // client hang if EvoSuite is
    // executed with -prefix!

    if (ArrayUtil.contains(Properties.CRITERION, Criterion.DEFUSE)
            || ArrayUtil.contains(Properties.CRITERION, Criterion.ALLDEFS)
            || ArrayUtil.contains(Properties.CRITERION, Criterion.STATEMENT)
            || ArrayUtil.contains(Properties.CRITERION, Criterion.RHO)
            || ArrayUtil.contains(Properties.CRITERION, Criterion.AMBIGUITY))
        ExecutionTracer.enableTraceCalls();

    // TODO: why it was only if "analyzing"???
    // if (analyzing)
    algorithm.resetStoppingConditions();

    List<TestFitnessFunction> goals = getGoals(true);

    // List<TestSuiteChromosome> bestSuites = new
    // ArrayList<TestSuiteChromosome>();
    TestSuiteChromosome bestSuites = new TestSuiteChromosome();
    RegressionTestSuiteChromosome best = null;
    if (!(Properties.STOP_ZERO && goals.isEmpty())) {
        // logger.warn("performing search ... ############################################################");
        // Perform search
        LoggingUtils.getEvoLogger().info("* Using seed {}", Randomness.getSeed());
        LoggingUtils.getEvoLogger().info("* Starting evolution");
        ClientServices.getInstance().getClientNode().changeState(ClientState.SEARCH);

        algorithm.generateSolution();
        best = (RegressionTestSuiteChromosome) algorithm.getBestIndividual();
        // List<TestSuiteChromosome> tmpTestSuiteList = new
        // ArrayList<TestSuiteChromosome>();
        for (TestCase t : best.getTests())
            bestSuites.addTest(t);
        // bestSuites = (List<TestSuiteChromosome>) ga.getBestIndividuals();
        if (bestSuites.size() == 0) {
            LoggingUtils.getEvoLogger().warn("Could not find any suiteable chromosome");
            return bestSuites;
        }
    } else {
        zeroFitness.setFinished();
        bestSuites = new TestSuiteChromosome();
        for (FitnessFunction<?> ff : bestSuites.getFitnessValues().keySet()) {
            bestSuites.setCoverage(ff, 1.0);
        }
    }

    long end_time = System.currentTimeMillis() / 1000;

    goals = getGoals(false); //recalculated now after the search, eg to handle exception fitness
    ClientServices.getInstance().getClientNode().trackOutputVariable(RuntimeVariable.Total_Goals, goals.size());

    // Newline after progress bar
    if (Properties.SHOW_PROGRESS)
        LoggingUtils.getEvoLogger().info("");
    String text = " statements, best individual has fitness: ";
    if (bestSuites.size() > 1) {
        text = " statements, best individuals have fitness: ";
    }
    LoggingUtils.getEvoLogger()
            .info("* Search finished after " + (end_time - startTime) + "s and " + algorithm.getAge()
                    + " generations, " + MaxStatementsStoppingCondition.getNumExecutedStatements() + text
                    + best.getFitness());

    // progressMonitor.updateStatus(33);

    // progressMonitor.updateStatus(66);

    if (Properties.COVERAGE) {
        for (Properties.Criterion pc : Properties.CRITERION)
            CoverageCriteriaAnalyzer.analyzeCoverage(bestSuites, pc); // FIXME: can
        // we send
        // all
        // bestSuites?
    }

    // progressMonitor.updateStatus(99);

    int number_of_test_cases = 0;
    int totalLengthOfTestCases = 0;
    double coverage = 0.0;

    // for (TestSuiteChromosome tsc : bestSuites) {
    number_of_test_cases += bestSuites.size();
    totalLengthOfTestCases += bestSuites.totalLengthOfTestCases();
    coverage += bestSuites.getCoverage();
    // }
    // coverage = coverage / ((double)bestSuites.size());

    if (ArrayUtil.contains(Properties.CRITERION, Criterion.MUTATION)
            || ArrayUtil.contains(Properties.CRITERION, Criterion.STRONGMUTATION)) {
        // SearchStatistics.getInstance().mutationScore(coverage);
    }

    // StatisticsSender.executedAndThenSendIndividualToMaster(bestSuites);
    // // FIXME: can we send all bestSuites?
    // statistics.iteration(ga);
    // statistics.minimized(bestSuites.get(0)); // FIXME: can we send all
    // bestSuites?
    LoggingUtils.getEvoLogger()
            .info("* Generated " + number_of_test_cases + " tests with total length " + totalLengthOfTestCases);

    // TODO: In the end we will only need one analysis technique
    if (!Properties.ANALYSIS_CRITERIA.isEmpty()) {
        // SearchStatistics.getInstance().addCoverage(Properties.CRITERION.toString(),
        // coverage);
        CoverageCriteriaAnalyzer.analyzeCriteria(bestSuites, Properties.ANALYSIS_CRITERIA); // FIXME: can we send all
        // bestSuites?
    }

    LoggingUtils.getEvoLogger()
            .info("* Resulting test suite's coverage: " + NumberFormat.getPercentInstance().format(coverage));

    algorithm.printBudget();

    // System.exit(0);
    ClientServices.getInstance().getClientNode().trackOutputVariable(RuntimeVariable.Regression_ID,
            RegressionSearchListener.statsID);

    return bestSuites;
}

From source file:com.signalcollect.sna.gephiconnectors.SignalCollectGephiConnector.java

/**
 * Gets the Label Propagation in the graph and creates a chart out of it
 * /*from ww w. ja v a2 s  . com*/
 * @throws IOException
 */
public void getLabelPropagation() throws IOException {

    Map<Integer, Map<String, Integer>> m = LabelPropagation.run(graph, signalSteps.get());

    DefaultCategoryDataset dataset = new DefaultCategoryDataset();

    final JFreeChart chart = ChartFactory.createStackedBarChart("Evolving Label Propagation", "Signal Step",
            null, dataset, PlotOrientation.VERTICAL, false, false, false);

    CategoryPlot plot = (CategoryPlot) chart.getPlot();

    StackedBarRenderer renderer = new StackedBarRenderer();

    plot.setDataset(dataset);
    plot.setRenderer(renderer);
    renderer.setBaseItemLabelGenerator(
            new StandardCategoryItemLabelGenerator("{0} {2} {3}", NumberFormat.getInstance()));
    renderer.setBaseItemLabelsVisible(true);
    if (signalSteps.get() > 10) {
        long stepInterval = Math.round(new Double(signalSteps.get().doubleValue() / 10d));
        for (int i = (int) stepInterval; i <= signalSteps.get(); i += stepInterval) {
            Set<Map.Entry<String, Integer>> entrySet = m.get(new Integer(i)).entrySet();
            for (Map.Entry<String, Integer> subentry : entrySet) {
                dataset.addValue(subentry.getValue(), subentry.getKey(), new Integer(i));
            }
        }
    } else {
        for (Map.Entry<Integer, Map<String, Integer>> entry : m.entrySet()) {
            for (Map.Entry<String, Integer> subentry : entry.getValue().entrySet()) {
                dataset.addValue(subentry.getValue(), subentry.getKey(), entry.getKey());
            }
        }
    }
    renderer.setRenderAsPercentages(true);
    NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis();
    rangeAxis.setNumberFormatOverride(NumberFormat.getPercentInstance());

    final ChartPanel chartPanel = new ChartPanel(chart);
    chartPanel.setPreferredSize(new java.awt.Dimension(1200, 600));
    ApplicationFrame f = new ApplicationFrame("Label Propagation");
    f.setContentPane(chartPanel);
    f.pack();
    f.setVisible(true);
}

From source file:org.emftrace.quarc.ui.views.RatioView.java

/**
 * create a PieChart for the priorities of the goals
 * @param dataset the used Dataset//from  w  ww.ja  v  a2s .  c  o m
 * @return the created Chart
 */
private JFreeChart createChart(PieDataset dataset) {

    JFreeChart chart = ChartFactory.createPieChart3D("priorities of selected goals", // chart
            // title
            dataset, // data
            true, // include legend
            true, false);

    final org.jfree.chart.plot.PiePlot3D plot = (org.jfree.chart.plot.PiePlot3D) chart.getPlot();
    plot.setStartAngle(290);
    plot.setDirection(Rotation.CLOCKWISE);
    plot.setForegroundAlpha(0.5f);
    plot.setNoDataMessage("No data to display");
    plot.setLabelGenerator(new org.jfree.chart.labels.StandardPieSectionLabelGenerator("{0} = {2}",
            NumberFormat.getNumberInstance(), NumberFormat.getPercentInstance()));

    return chart;
}

From source file:com.opensourcestrategies.activities.reports.ActivitiesChartsService.java

private String createPieChart(DefaultPieDataset dataset, String title)
        throws InfrastructureException, IOException {
    Debug.logInfo("Charting dashboard [" + title + "]", MODULE);
    // set up the chart
    JFreeChart chart = ChartFactory.createPieChart(title, dataset, true, // include legend
            true, // tooltips
            false // urls
    );//ww w  .  j a v a  2  s.  co  m
    chart.setBackgroundPaint(Color.white);
    chart.setBorderVisible(true);
    chart.setPadding(new RectangleInsets(5.0, 5.0, 5.0, 5.0));

    // get a reference to the plot for further customization...
    final PiePlot plot = (PiePlot) chart.getPlot();
    plot.setBackgroundPaint(Color.white);
    plot.setCircular(true);
    plot.setLabelGenerator(new StandardPieSectionLabelGenerator("{0}: {1} / {2}",
            NumberFormat.getNumberInstance(), NumberFormat.getPercentInstance()));
    plot.setNoDataMessage("No data available");

    Color[] colors = {
            Color.decode("#" + infrastructure.getConfigurationValue(
                    OpentapsConfigurationTypeConstants.ACTIVITIES_DASHBOARD_LEADS_NEW_COLOR)),
            Color.decode("#" + infrastructure.getConfigurationValue(
                    OpentapsConfigurationTypeConstants.ACTIVITIES_DASHBOARD_LEADS_OLD_COLOR)),
            Color.decode("#" + infrastructure.getConfigurationValue(
                    OpentapsConfigurationTypeConstants.ACTIVITIES_DASHBOARD_LEADS_NO_ACTIVITY_COLOR)) };
    for (int i = 0; i < dataset.getItemCount(); i++) {
        Comparable<?> key = dataset.getKey(i);
        plot.setSectionPaint(key, colors[i]);
    }

    // save as a png and return the file name
    return ServletUtilities.saveChartAsPNG(chart, chartWidth, chartHeight, null);
}

From source file:biz.wolschon.fileformats.gnucash.jwsdpimpl.GnucashInvoiceEntryImpl.java

/**
*
* @return the number-format to use for percentage-numbers if no locale is given.
*//*from   www .j  av a  2s.  c om*/
protected NumberFormat getPercentFormat() {
    if (percentFormat == null) {
        percentFormat = NumberFormat.getPercentInstance();
    }

    return percentFormat;
}