Frames | No Frames |
1: /* =========================================================== 2: * JFreeChart : a free chart library for the Java(tm) platform 3: * =========================================================== 4: * 5: * (C) Copyright 2000-2005, 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-2004, 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: * $Id: ContourEntity.java,v 1.3.2.1 2005/10/25 20:41:59 mungady Exp $ 36: * 37: * Changes 38: * ------- 39: * 26-Nov-2002 : Version 1 contributed by David M. O'Donnell (DG); 40: * 20-May-2004 : Added equals() and clone() methods and implemented 41: * Serializable (DG); 42: * 43: */ 44: 45: package org.jfree.chart.entity; 46: 47: import java.awt.Shape; 48: import java.io.Serializable; 49: 50: /** 51: * Represents an item on a contour chart. 52: * 53: * @author David M. O'Donnell 54: */ 55: public class ContourEntity extends ChartEntity 56: implements Cloneable, Serializable { 57: 58: /** For serialization. */ 59: private static final long serialVersionUID = 1249570520505992847L; 60: 61: /** Holds the index into the dataset for this entity. */ 62: private int index = -1; 63: 64: /** 65: * Constructor for ContourEntity. 66: * 67: * @param area the area. 68: * @param toolTipText the tooltip text. 69: */ 70: public ContourEntity(Shape area, String toolTipText) { 71: super(area, toolTipText); 72: } 73: 74: /** 75: * Constructor for ContourEntity. 76: * 77: * @param area the area. 78: * @param toolTipText the tooltip text. 79: * @param urlText the URL text. 80: */ 81: public ContourEntity(Shape area, String toolTipText, String urlText) { 82: super(area, toolTipText, urlText); 83: } 84: 85: /** 86: * Returns the index. 87: * 88: * @return The index. 89: */ 90: public int getIndex() { 91: return this.index; 92: } 93: 94: /** 95: * Sets the index. 96: * 97: * @param index the index. 98: */ 99: public void setIndex(int index) { 100: this.index = index; 101: } 102: 103: /** 104: * Tests the entity for equality with an arbitrary object. 105: * 106: * @param obj the object (<code>null</code> permitted). 107: * 108: * @return A boolean. 109: */ 110: public boolean equals(Object obj) { 111: if (obj == this) { 112: return true; 113: } 114: if (obj instanceof ContourEntity && super.equals(obj)) { 115: ContourEntity ce = (ContourEntity) obj; 116: if (this.index != ce.index) { 117: return false; 118: } 119: return true; 120: } 121: return false; 122: } 123: 124: /** 125: * Returns a clone of the entity. 126: * 127: * @return A clone. 128: * 129: * @throws CloneNotSupportedException if cloning is not supported. 130: */ 131: public Object clone() throws CloneNotSupportedException { 132: return super.clone(); 133: } 134: 135: }