2 * Copyright (c) 2003-2005 The BISON Project
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU Lesser General Public License version 2 as
6 * published by the Free Software Foundation.
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU Lesser General Public License for more details.
13 * You should have received a copy of the GNU Lesser General Public License
14 * along with this program; if not, write to the Free Software
15 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
19 package peersim.vector;
21 import peersim.core.*;
24 * The task of this protocol is to store a single double value and make it
25 * available through the {@link SingleValue} interface.
27 * @author Alberto Montresor
28 * @version $Revision: 1.6 $
30 public class SingleValueHolder
31 implements SingleValue, Protocol
34 //--------------------------------------------------------------------------
36 //--------------------------------------------------------------------------
38 /** Value held by this protocol */
39 protected double value;
42 //--------------------------------------------------------------------------
44 //--------------------------------------------------------------------------
49 public SingleValueHolder(String prefix)
53 //--------------------------------------------------------------------------
56 * Clones the value holder.
60 SingleValueHolder svh=null;
61 try { svh=(SingleValueHolder)super.clone(); }
62 catch( CloneNotSupportedException e ) {} // never happens
66 //--------------------------------------------------------------------------
68 //--------------------------------------------------------------------------
73 public double getValue()
78 //--------------------------------------------------------------------------
83 public void setValue(double value)
88 //--------------------------------------------------------------------------
91 * Returns the value as a string.
93 public String toString() { return ""+value; }