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: * EntityCollection.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: * 23-May-2002 : Version 1 (DG); 38: * 25-Jun-2002 : Removed unnecessary import (DG); 39: * 26-Jun-2002 : Added iterator() method (DG); 40: * 03-Oct-2002 : Fixed errors reported by Checkstyle (DG); 41: * 30-Jan-2004 : Added a method to add a collection of entities. 42: * 11-Jan-2005 : Removed deprecated code in preparation for the 1.0.0 43: * release (DG); 44: * 18-Jan-2005 : Added getEntity() and getEntityCount() methods (DG); 45: * 46: */ 47: 48: package org.jfree.chart.entity; 49: 50: import java.util.Collection; 51: import java.util.Iterator; 52: 53: /** 54: * This interface defines the methods used to access an ordered list of 55: * {@link ChartEntity} objects. 56: */ 57: public interface EntityCollection { 58: 59: /** 60: * Clears all entities. 61: */ 62: public void clear(); 63: 64: /** 65: * Adds an entity to the collection. 66: * 67: * @param entity the entity (<code>null</code> not permitted). 68: */ 69: public void add(ChartEntity entity); 70: 71: /** 72: * Adds the entities from another collection to this collection. 73: * 74: * @param collection the other collection. 75: */ 76: public void addAll(EntityCollection collection); 77: 78: /** 79: * Returns an entity whose area contains the specified point. 80: * 81: * @param x the x coordinate. 82: * @param y the y coordinate. 83: * 84: * @return The entity. 85: */ 86: public ChartEntity getEntity(double x, double y); 87: 88: /** 89: * Returns an entity from the collection. 90: * 91: * @param index the index (zero-based). 92: * 93: * @return An entity. 94: */ 95: public ChartEntity getEntity(int index); 96: 97: /** 98: * Returns the entity count. 99: * 100: * @return The entity count. 101: */ 102: public int getEntityCount(); 103: 104: /** 105: * Returns the entities in an unmodifiable collection. 106: * 107: * @return The entities. 108: */ 109: public Collection getEntities(); 110: 111: /** 112: * Returns an iterator for the entities in the collection. 113: * 114: * @return An iterator. 115: */ 116: public Iterator iterator(); 117: 118: }