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