001/* ----------------------------------------------------------------------------
002   The Kiwi Toolkit - A Java Class Library
003   Copyright (C) 1998-2004 Mark A. Lindner
004
005   This library is free software; you can redistribute it and/or
006   modify it under the terms of the GNU General Public License as
007   published by the Free Software Foundation; either version 2 of the
008   License, or (at your option) any later version.
009
010   This library is distributed in the hope that it will be useful,
011   but WITHOUT ANY WARRANTY; without even the implied warranty of
012   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
013   General Public License for more details.
014
015   You should have received a copy of the GNU General Public License
016   along with this library; if not, write to the Free Software
017   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
018   02111-1307, USA.
019 
020   The author may be contacted at: mark_a_lindner@yahoo.com
021   ----------------------------------------------------------------------------
022   $Log: BasicDataSample.java,v $
023   Revision 1.1  2004/05/05 22:23:50  markl
024   new class
025
026   ----------------------------------------------------------------------------
027*/
028
029package kiwi.ui.graph;
030
031import java.util.HashMap;
032
033/**
034 * A basic implementation of the <i>DataSample</i> interface.
035 *
036 * @author Mark Lindner
037 * @since Kiwi 2.0
038 */
039
040public class BasicDataSample implements DataSample
041  {
042  private HashMap data;
043
044  /**
045   * Construct a new <code>BasicDataSample</code>.
046   */
047  
048  public BasicDataSample()
049    {
050    data = new HashMap();
051    }
052
053  /**
054   */
055
056  public Object getValue(String var)
057    {
058    return(data.get(var));
059    }
060
061  /**
062   * Store an integer value in the data sample.
063   *
064   * @param var The variable name.
065   * @param value The variable value.
066   */
067  
068  public void putValue(String var, int value)
069    {
070    data.put(var, new Integer(value));
071    }
072
073  /**
074   * Store a double value in the data sample.
075   *
076   * @param var The variable name.
077   * @param value The variable value.
078   */
079
080  public void putValue(String var, double value)
081    {
082    data.put(var, new Double(value));
083    }
084
085  /**
086   * Remove a value from the data sample.
087   *
088   * @param var The variable name.
089   */
090  
091  public void removeValue(String var)
092    {
093    data.remove(var);
094    }
095
096  /**
097   * Remove all values from the data sample.
098   */
099  
100  public void clear()
101    {
102    data.clear();
103    }
104
105  }
106
107/* end of source file */