sascha@836: /** sascha@836: * 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 $ sascha@836: * Source: $Source: /share/gdi/SDI-Suite/Repository/projekte/BSH-GDI/genericViewer/src/main/java/de/conterra/bsh/gdi/gnviewer/output/statistics/Statistic.java,v $ sascha@836: * created by: Stefan Blume (blume) sascha@836: * erstellt am: 14.12.2007 sascha@836: * Copyright: con terra GmbH, 2005 sascha@836: * sascha@836: * modified by: $Author: blume $ sascha@836: * modified on: $Date: 2007/12/21 12:31:15 $ sascha@836: * Version: $Revision: 1.2 $ sascha@836: * TAG: $Name: $ sascha@836: * locked from: $Locker: $ sascha@836: * CVS State: $State: Exp $ sascha@836: * Project: $ProjectName$ sascha@836: */ sascha@836: package de.intevation.gnv.statistics; sascha@836: sascha@836: import org.apache.log4j.Logger; sascha@836: sascha@836: /** sascha@836: * This class stores a double value with a specific key. sascha@836: * sascha@836: * @author blume sascha@836: */ sascha@836: public class Statistic { sascha@836: sascha@836: /** sascha@836: * Default Logging instance sascha@836: */ sascha@836: private static Logger sLogger = Logger.getLogger(Statistic.class); sascha@836: private static boolean sDebug = sLogger.isDebugEnabled(); sascha@836: sascha@836: private double mValue; sascha@836: private String mKey; sascha@836: sascha@836: /** sascha@836: * Creates a new Statistic with a given key and a value. sascha@836: * @param pKey The key. sascha@836: * @param pValue The value. sascha@836: */ sascha@836: public Statistic(String pKey, double pValue) { sascha@836: mKey = pKey; sascha@836: mValue = pValue; sascha@836: } sascha@836: sascha@836: /** sascha@836: * Returns the value. sascha@836: * @return the value. sascha@836: */ sascha@836: public double getValue() { sascha@836: return mValue; sascha@836: } sascha@836: sascha@836: /** sascha@836: * Returns the key. sascha@836: * @return the key. sascha@836: */ sascha@836: public String getKey() { sascha@836: return mKey; sascha@836: } sascha@836: sascha@836: /** sascha@836: * Turns the value into string representation and returns it.
sascha@836: * Attention: This method doesn't take a locale into account. sascha@836: * sascha@836: * @return the value as string. sascha@836: */ sascha@836: public String getStringValue() { sascha@836: java.text.DecimalFormat df = new java.text.DecimalFormat("#.##"); sascha@836: return df.format(mValue); sascha@836: } sascha@836: } sascha@836: // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :