KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jfree > data > general > DatasetGroup


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  * DatasetGroup.java
29  * -----------------
30  * (C) Copyright 2002-2005, by Object Refinery Limited.
31  *
32  * Original Author: David Gilbert (for Object Refinery Limited);
33  * Contributor(s): -;
34  *
35  * $Id: DatasetGroup.java,v 1.4.2.1 2005/10/25 21:32:29 mungady Exp $
36  *
37  * Changes
38  * -------
39  * 07-Oct-2002 : Version 1 (DG);
40  * 26-Mar-2003 : Implemented Serializable (DG);
41  * 20-Aug-2003 : Implemented Cloneable (DG);
42  *
43  */

44
45 package org.jfree.data.general;
46
47 import java.io.Serializable JavaDoc;
48
49 /**
50  * A class that is used to group datasets (currently not used for any specific
51  * purpose).
52  */

53 public class DatasetGroup implements Cloneable JavaDoc, Serializable JavaDoc {
54     
55     /** For serialization. */
56     private static final long serialVersionUID = -3640642179674185688L;
57     
58     /** The group id. */
59     private String JavaDoc id;
60     
61     /**
62      * Constructs a new group.
63      */

64     public DatasetGroup() {
65         super();
66         this.id = "NOID";
67     }
68
69     /**
70      * Creates a new group with the specified id.
71      *
72      * @param id the identification for the group.
73      */

74     public DatasetGroup(String JavaDoc id) {
75         if (id == null) {
76             throw new IllegalArgumentException JavaDoc("Null 'id' argument.");
77         }
78         this.id = id;
79     }
80     
81     /**
82      * Returns the identification string for this group.
83      *
84      * @return The identification string.
85      */

86     public String JavaDoc getID() {
87         return this.id;
88     }
89     
90     /**
91      * Clones the group.
92      *
93      * @return A clone.
94      *
95      * @throws CloneNotSupportedException not by this class.
96      */

97     public Object JavaDoc clone() throws CloneNotSupportedException JavaDoc {
98         return super.clone();
99     }
100     
101     /**
102      * Tests this instance for equality with an arbitrary object.
103      *
104      * @param obj the object (<code>null</code> permitted).
105      *
106      * @return A boolean.
107      */

108     public boolean equals(Object JavaDoc obj) {
109         if (obj == this) {
110             return true;
111         }
112         if (!(obj instanceof DatasetGroup)) {
113             return false;
114         }
115         DatasetGroup that = (DatasetGroup) obj;
116         if (!this.id.equals(that.id)) {
117             return false;
118         }
119         return true;
120     }
121     
122 }
123
Popular Tags