Frames | No Frames |
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: * DatasetGroup.java 29: * ----------------- 30: * (C) Copyright 2002-2007, by Object Refinery Limited. 31: * 32: * Original Author: David Gilbert (for Object Refinery Limited); 33: * Contributor(s): -; 34: * 35: * Changes 36: * ------- 37: * 07-Oct-2002 : Version 1 (DG); 38: * 26-Mar-2003 : Implemented Serializable (DG); 39: * 20-Aug-2003 : Implemented Cloneable (DG); 40: * 41: */ 42: 43: package org.jfree.data.general; 44: 45: import java.io.Serializable; 46: 47: /** 48: * A class that is used to group datasets (currently not used for any specific 49: * purpose). 50: */ 51: public class DatasetGroup implements Cloneable, Serializable { 52: 53: /** For serialization. */ 54: private static final long serialVersionUID = -3640642179674185688L; 55: 56: /** The group id. */ 57: private String id; 58: 59: /** 60: * Constructs a new group. 61: */ 62: public DatasetGroup() { 63: super(); 64: this.id = "NOID"; 65: } 66: 67: /** 68: * Creates a new group with the specified id. 69: * 70: * @param id the identification for the group. 71: */ 72: public DatasetGroup(String id) { 73: if (id == null) { 74: throw new IllegalArgumentException("Null 'id' argument."); 75: } 76: this.id = id; 77: } 78: 79: /** 80: * Returns the identification string for this group. 81: * 82: * @return The identification string. 83: */ 84: public String getID() { 85: return this.id; 86: } 87: 88: /** 89: * Clones the group. 90: * 91: * @return A clone. 92: * 93: * @throws CloneNotSupportedException not by this class. 94: */ 95: public Object clone() throws CloneNotSupportedException { 96: return super.clone(); 97: } 98: 99: /** 100: * Tests this instance for equality with an arbitrary object. 101: * 102: * @param obj the object (<code>null</code> permitted). 103: * 104: * @return A boolean. 105: */ 106: public boolean equals(Object obj) { 107: if (obj == this) { 108: return true; 109: } 110: if (!(obj instanceof DatasetGroup)) { 111: return false; 112: } 113: DatasetGroup that = (DatasetGroup) obj; 114: if (!this.id.equals(that.id)) { 115: return false; 116: } 117: return true; 118: } 119: 120: }