Source for org.jfree.chart.entity.EntityCollection

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