ChartEvent.java
Upload User: rhdiban
Upload Date: 2013-08-09
Package Size: 15085k
Code Size: 4k
Category:

Windows Develop

Development Platform:

Java

  1. /*  *    This program is free software; you can redistribute it and/or modify  *    it under the terms of the GNU General Public License as published by  *    the Free Software Foundation; either version 2 of the License, or  *    (at your option) any later version.  *  *    This program is distributed in the hope that it will be useful,  *    but WITHOUT ANY WARRANTY; without even the implied warranty of  *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the  *    GNU General Public License for more details.  *  *    You should have received a copy of the GNU General Public License  *    along with this program; if not, write to the Free Software  *    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */ /*  *    ChartEvent.java  *    Copyright (C) 2002 Mark Hall  *  */ package weka.gui.beans;
  2. import java.util.EventObject;
  3. import java.util.Vector;
  4. /**
  5.  * Event encapsulating info for plotting a data point on the StripChart
  6.  *
  7.  * @author <a href="mailto:mhall@cs.waikato.ac.nz">Mark Hall</a>
  8.  * @version $Revision: 1.1 $
  9.  */
  10. public class ChartEvent extends EventObject {
  11.   private Vector m_legendText;
  12.   private double m_max;
  13.   private double m_min;
  14.   private boolean m_reset;
  15.   /**
  16.    * Y values of the data points
  17.    */
  18.   private double [] m_dataPoint;
  19.   /**
  20.    * Creates a new <code>ChartEvent</code> instance.
  21.    *
  22.    * @param source the source of the event
  23.    * @param legendText a vector of strings to display in the legend
  24.    * @param min minimum y value
  25.    * @param max maximum y value
  26.    * @param dataPoint an array of y values to plot
  27.    * @param reset true if display is to be reset
  28.    */
  29.   public ChartEvent(Object source, Vector legendText, double min, double max,
  30.     double [] dataPoint, boolean reset) {
  31.     super(source);
  32.     m_legendText = legendText;
  33.     m_max = max;
  34.     m_min = min;
  35.     m_dataPoint = dataPoint;
  36.     m_reset = reset;
  37.   }
  38.   /**
  39.    * Creates a new <code>ChartEvent</code> instance.
  40.    *
  41.    * @param source the source of the event
  42.    */
  43.   public ChartEvent(Object source) {
  44.     super(source);
  45.   }
  46.   /**
  47.    * Get the legend text vector
  48.    *
  49.    * @return a <code>Vector</code> value
  50.    */
  51.   public Vector getLegendText() {
  52.     return m_legendText;
  53.   }
  54.   /**
  55.    * Set the legend text vector
  56.    *
  57.    * @param lt a <code>Vector</code> value
  58.    */
  59.   public void setLegendText(Vector lt) {
  60.     m_legendText = lt;
  61.   }
  62.   /**
  63.    * Get the min y value
  64.    *
  65.    * @return a <code>double</code> value
  66.    */
  67.   public double getMin() {
  68.     return m_min;
  69.   }
  70.   /**
  71.    * Set the min y value
  72.    *
  73.    * @param m a <code>double</code> value
  74.    */
  75.   public void setMin(double m) {
  76.     m_min = m;
  77.   }
  78.   /**
  79.    * Get the max y value
  80.    *
  81.    * @return a <code>double</code> value
  82.    */
  83.   public double getMax() {
  84.     return m_max;
  85.   }
  86.   /**
  87.    * Set the max y value
  88.    *
  89.    * @param m a <code>double</code> value
  90.    */
  91.   public void setMax(double m) {
  92.     m_max = m;
  93.   }
  94.   /**
  95.    * Get the data point
  96.    *
  97.    * @return a <code>double[]</code> value
  98.    */
  99.   public double [] getDataPoint() {
  100.     return m_dataPoint;
  101.   }
  102.   /**
  103.    * Set the data point
  104.    *
  105.    * @param dp a <code>double[]</code> value
  106.    */
  107.   public void setDataPoint(double [] dp) {
  108.     m_dataPoint = dp;
  109.   }
  110.   /**
  111.    * Set the reset flag
  112.    *
  113.    * @param reset a <code>boolean</code> value
  114.    */
  115.   public void setReset(boolean reset) {
  116.     m_reset = reset;
  117.   }
  118.   /**
  119.    * get the value of the reset flag
  120.    *
  121.    * @return a <code>boolean</code> value
  122.    */
  123.   public boolean getReset() {
  124.     return m_reset;
  125.   }
  126. }