    001    /* ===========================================================
    002     * JFreeChart : a free chart library for the Java(tm) platform
    003     * ===========================================================
    004     *
    005     * (C) Copyright 2000-2005, by Object Refinery Limited and Contributors.
    006     *
    007     * Project Info:  http://www.jfree.org/jfreechart/index.html
    008     *
    009     * This library is free software; you can redistribute it and/or modify it
    010     * under the terms of the GNU Lesser General Public License as published by
    011     * the Free Software Foundation; either version 2.1 of the License, or
    012     * (at your option) any later version.
    013     *
    014     * This library is distributed in the hope that it will be useful, but
    015     * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
    016     * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
    017     * License for more details.
    018     *
    019     * You should have received a copy of the GNU Lesser General Public
    020     * License along with this library; if not, write to the Free Software
    021     * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301,
    022     * USA.
    023     *
    024     * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
    025     * in the United States and other countries.]
    026     *
    027     * ---------------------
    028     * EntityCollection.java
    029     * ---------------------
    030     * (C) Copyright 2002-2005, by Object Refinery Limited.
    031     *
    032     * Original Author:  David Gilbert (for Object Refinery Limited);
    033     * Contributor(s):   -;
    034     *
    035     * $Id: EntityCollection.java,v 1.5.2.1 2005/10/25 20:41:59 mungady Exp $
    036     *
    037     * Changes
    038     * -------
    039     * 23-May-2002 : Version 1 (DG);
    040     * 25-Jun-2002 : Removed unnecessary import (DG);
    041     * 26-Jun-2002 : Added iterator() method (DG);
    042     * 03-Oct-2002 : Fixed errors reported by Checkstyle (DG);
    043     * 30-Jan-2004 : Added a method to add a collection of entities.
    044     * 11-Jan-2005 : Removed deprecated code in preparation for the 1.0.0
    045     *               release (DG);
    046     * 18-Jan-2005 : Added getEntity() and getEntityCount() methods (DG);
    047     *
    048     */
    049
    050    package org.jfree.chart.entity;
    051
    052    import java.util.Collection;
    053    import java.util.Iterator;
    054
    055    /**
    056     * This interface defines the methods used to access an ordered list of
    057     * {@link ChartEntity} objects.
    058     */
    059    public interface EntityCollection {
    060
    061        /**
    062         * Clears all entities.
    063         */
    064        public void clear();
    065
    066        /**
    067         * Adds an entity to the collection.
    068         *
    069         * @param entity  the entity (<code>null</code> not permitted).
    070         */
    071        public void add(ChartEntity entity);
    072
    073        /**
    074         * Adds the entities from another collection to this collection.
    075         *
    076         * @param collection  the other collection.
    077         */
    078        public void addAll(EntityCollection collection);
    079
    080        /**
    081         * Returns an entity whose area contains the specified point.
    082         *
    083         * @param x  the x coordinate.
    084         * @param y  the y coordinate.
    085         *
    086         * @return The entity.
    087         */
    088        public ChartEntity getEntity(double x, double y);
    089
    090        /**
    091         * Returns an entity from the collection.
    092         *
    093         * @param index  the index (zero-based).
    094         *
    095         * @return An entity.
    096         */
    097        public ChartEntity getEntity(int index);
    098
    099        /**
    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    }