KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jfree > chart > entity > ContourEntity


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 License
20  * along with this library; if not, write to the Free Software Foundation,
21  * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
22  *
23  * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
24  * in the United States and other countries.]
25  *
26  * ------------------
27  * ContourEntity.java
28  * ------------------
29  * (C) Copyright 2002-2004, by David M. O'Donnell and Contributors.
30  *
31  * Original Author: David M. O'Donnell;
32  * Contributor(s): David Gilbert (for Object Refinery Limited);
33  *
34  * $Id: ContourEntity.java,v 1.3 2005/05/19 15:42:54 mungady Exp $
35  *
36  * Changes
37  * -------
38  * 26-Nov-2002 : Version 1 contributed by David M. O'Donnell (DG);
39  * 20-May-2004 : Added equals() and clone() methods and implemented
40  * Serializable (DG);
41  *
42  */

43
44 package org.jfree.chart.entity;
45
46 import java.awt.Shape JavaDoc;
47 import java.io.Serializable JavaDoc;
48
49 /**
50  * Represents an item on a contour chart.
51  *
52  * @author David M. O'Donnell
53  */

54 public class ContourEntity extends ChartEntity
55                            implements Cloneable JavaDoc, Serializable JavaDoc {
56
57     /** For serialization. */
58     private static final long serialVersionUID = 1249570520505992847L;
59     
60     /** Holds the index into the dataset for this entity. */
61     private int index = -1;
62
63     /**
64      * Constructor for ContourEntity.
65      *
66      * @param area the area.
67      * @param toolTipText the tooltip text.
68      */

69     public ContourEntity(Shape JavaDoc area, String JavaDoc toolTipText) {
70         super(area, toolTipText);
71     }
72
73     /**
74      * Constructor for ContourEntity.
75      *
76      * @param area the area.
77      * @param toolTipText the tooltip text.
78      * @param urlText the URL text.
79      */

80     public ContourEntity(Shape JavaDoc area, String JavaDoc toolTipText, String JavaDoc urlText) {
81         super(area, toolTipText, urlText);
82     }
83
84     /**
85      * Returns the index.
86      *
87      * @return The index.
88      */

89     public int getIndex() {
90         return this.index;
91     }
92
93     /**
94      * Sets the index.
95      *
96      * @param index the index.
97      */

98     public void setIndex(int index) {
99         this.index = index;
100     }
101
102     /**
103      * Tests the entity for equality with an arbitrary object.
104      *
105      * @param obj the object (<code>null</code> permitted).
106      *
107      * @return A boolean.
108      */

109     public boolean equals(Object JavaDoc obj) {
110         if (obj == this) {
111             return true;
112         }
113         if (obj instanceof ContourEntity && super.equals(obj)) {
114             ContourEntity ce = (ContourEntity) obj;
115             if (this.index != ce.index) {
116                 return false;
117             }
118             return true;
119         }
120         return false;
121     }
122     
123     /**
124      * Returns a clone of the entity.
125      *
126      * @return A clone.
127      *
128      * @throws CloneNotSupportedException if cloning is not supported.
129      */

130     public Object JavaDoc clone() throws CloneNotSupportedException JavaDoc {
131         return super.clone();
132     }
133     
134 }
135
Popular Tags