Source for org.jfree.chart.entity.ContourEntity

   1: /* ===========================================================
   2:  * JFreeChart : a free chart library for the Java(tm) platform
   3:  * ===========================================================
   4:  *
   5:  * (C) Copyright 2000-2007, by Object Refinery Limited and Contributors.
   6:  *
   7:  * Project Info:  http://www.jfree.org/jfreechart/index.html
   8:  *
   9:  * This library is free software; you can redistribute it and/or modify it 
  10:  * under the terms of the GNU Lesser General Public License as published by 
  11:  * the Free Software Foundation; either version 2.1 of the License, or 
  12:  * (at your option) any later version.
  13:  *
  14:  * This library is distributed in the hope that it will be useful, but 
  15:  * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 
  16:  * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public 
  17:  * License for more details.
  18:  *
  19:  * You should have received a copy of the GNU Lesser General Public
  20:  * License along with this library; if not, write to the Free Software
  21:  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, 
  22:  * USA.  
  23:  *
  24:  * [Java is a trademark or registered trademark of Sun Microsystems, Inc. 
  25:  * in the United States and other countries.]
  26:  *
  27:  * ------------------
  28:  * ContourEntity.java
  29:  * ------------------
  30:  * (C) Copyright 2002-2007, by David M. O'Donnell and Contributors.
  31:  *
  32:  * Original Author:  David M. O'Donnell;
  33:  * Contributor(s):   David Gilbert (for Object Refinery Limited);
  34:  *
  35:  * Changes
  36:  * -------
  37:  * 26-Nov-2002 : Version 1 contributed by David M. O'Donnell (DG);
  38:  * 20-May-2004 : Added equals() and clone() methods and implemented 
  39:  *               Serializable (DG);
  40:  * ------------- JFREECHART 1.0.x ---------------------------------------------
  41:  * 02-Feb-2007 : Removed author tags all over JFreeChart sources (DG);
  42:  *
  43:  */
  44: 
  45: package org.jfree.chart.entity;
  46: 
  47: import java.awt.Shape;
  48: import java.io.Serializable;
  49: 
  50: import org.jfree.chart.plot.XYPlot;
  51: import org.jfree.chart.renderer.xy.XYBlockRenderer;
  52: 
  53: /**
  54:  * Represents an item on a contour chart.
  55:  *
  56:  * @deprecated This class is no longer supported (as of version 1.0.4).  If 
  57:  *     you are creating contour plots, please try to use {@link XYPlot} and 
  58:  *     {@link XYBlockRenderer}.
  59:  */
  60: public class ContourEntity extends ChartEntity 
  61:                            implements Cloneable, Serializable {
  62: 
  63:     /** For serialization. */
  64:     private static final long serialVersionUID = 1249570520505992847L;
  65:     
  66:     /** Holds the index into the dataset for this entity. */
  67:     private int index = -1;
  68: 
  69:     /**
  70:      * Constructor for ContourEntity.
  71:      *
  72:      * @param area  the area.
  73:      * @param toolTipText  the tooltip text.
  74:      */
  75:     public ContourEntity(Shape area, String toolTipText) {
  76:         super(area, toolTipText);
  77:     }
  78: 
  79:     /**
  80:      * Constructor for ContourEntity.
  81:      *
  82:      * @param area  the area.
  83:      * @param toolTipText  the tooltip text.
  84:      * @param urlText  the URL text.
  85:      */
  86:     public ContourEntity(Shape area, String toolTipText, String urlText) {
  87:         super(area, toolTipText, urlText);
  88:     }
  89: 
  90:     /**
  91:      * Returns the index.
  92:      *
  93:      * @return The index.
  94:      */
  95:     public int getIndex() {
  96:         return this.index;
  97:     }
  98: 
  99:     /**
 100:      * Sets the index.
 101:      *
 102:      * @param index  the index.
 103:      */
 104:     public void setIndex(int index) {
 105:         this.index = index;
 106:     }
 107: 
 108:     /**
 109:      * Tests the entity for equality with an arbitrary object.
 110:      * 
 111:      * @param obj  the object (<code>null</code> permitted).
 112:      * 
 113:      * @return A boolean.
 114:      */
 115:     public boolean equals(Object obj) {
 116:         if (obj == this) {
 117:             return true;   
 118:         }
 119:         if (obj instanceof ContourEntity && super.equals(obj)) {
 120:             ContourEntity ce = (ContourEntity) obj;
 121:             if (this.index != ce.index) {
 122:                 return false;   
 123:             }
 124:             return true;
 125:         }
 126:         return false;
 127:     }
 128:     
 129:     /**
 130:      * Returns a clone of the entity.
 131:      * 
 132:      * @return A clone.
 133:      * 
 134:      * @throws CloneNotSupportedException if cloning is not supported.
 135:      */
 136:     public Object clone() throws CloneNotSupportedException {
 137:         return super.clone();
 138:     }
 139:     
 140: }