view gnv-artifacts/src/main/java/de/intevation/gnv/statistics/Statistic.java @ 1129:ccfa07b88476

merged geo-backend
author Thomas Arendsen Hein <thomas@intevation.de>
date Fri, 28 Sep 2012 12:14:01 +0200
parents f953c9a559d8
children
line wrap: on
line source
/*
 * Copyright (c) 2010 by Intevation GmbH
 *
 * This program is free software under the LGPL (>=v2.1)
 * Read the file LGPL.txt coming with the software for details
 * or visit http://www.gnu.org/licenses/ if it does not exist.
 */

/**
 * Title:           Statistic, $Header: /share/gdi/SDI-Suite/Repository/projekte/BSH-GDI/genericViewer/src/main/java/de/conterra/bsh/gdi/gnviewer/output/statistics/Statistic.java,v 1.2 2007/12/21 12:31:15 blume Exp $
 * Source:          $Source: /share/gdi/SDI-Suite/Repository/projekte/BSH-GDI/genericViewer/src/main/java/de/conterra/bsh/gdi/gnviewer/output/statistics/Statistic.java,v $
 * created by:      Stefan Blume (blume)
 * erstellt am:     14.12.2007
 * Copyright:       con terra GmbH, 2005
 *
 * modified by:     $Author: blume $
 * modified on:     $Date: 2007/12/21 12:31:15 $
 * Version:         $Revision: 1.2 $
 * TAG:             $Name:  $
 * locked from:     $Locker:  $
 * CVS State:       $State: Exp $
 * Project:         $ProjectName$
 */
package de.intevation.gnv.statistics;

import org.apache.log4j.Logger;

/**
 * This class stores a double value with a specific key.
 *
 * @author blume
 */
public class Statistic {

    /**
     * Default Logging instance
     */
    private static Logger sLogger = Logger.getLogger(Statistic.class);
    private static boolean sDebug = sLogger.isDebugEnabled();

    private double mValue;
    private String mKey;

    /**
     * Creates a new Statistic with a given key and a value.
     * @param pKey The key.
     * @param pValue The value.
     */
    public Statistic(String pKey, double pValue) {
        mKey = pKey;
        mValue = pValue;
    }

    /**
     * Returns the value.
     * @return the value.
     */
    public double getValue() {
        return mValue;
    }

    /**
     * Returns the key.
     * @return the key.
     */
    public String getKey() {
        return mKey;
    }

    /**
     * Turns the value into string representation and returns it.<br>
     * <b>Attention:</b> This method doesn't take a locale into account.
     *
     * @return the value as string.
     */
    public String getStringValue() {
        java.text.DecimalFormat df = new java.text.DecimalFormat("#.##");
        return df.format(mValue);
    }
}
// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org