001/* ===========================================================
002 * JFreeChart : a free chart library for the Java(tm) platform
003 * ===========================================================
004 *
005 * (C) Copyright 2000-2013, 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 * [Oracle and Java are registered trademarks of Oracle and/or its affiliates. 
025 * Other names may be trademarks of their respective owners.]
026 *
027 * ---------------------
028 * EntityCollection.java
029 * ---------------------
030 * (C) Copyright 2002-2008, by Object Refinery Limited.
031 *
032 * Original Author:  David Gilbert (for Object Refinery Limited);
033 * Contributor(s):   -;
034 *
035 * Changes
036 * -------
037 * 23-May-2002 : Version 1 (DG);
038 * 25-Jun-2002 : Removed unnecessary import (DG);
039 * 26-Jun-2002 : Added iterator() method (DG);
040 * 03-Oct-2002 : Fixed errors reported by Checkstyle (DG);
041 * 30-Jan-2004 : Added a method to add a collection of entities.
042 * 11-Jan-2005 : Removed deprecated code in preparation for the 1.0.0
043 *               release (DG);
044 * 18-Jan-2005 : Added getEntity() and getEntityCount() methods (DG);
045 *
046 */
047
048package org.jfree.chart.entity;
049
050import java.util.Collection;
051import java.util.Iterator;
052
053/**
054 * This interface defines the methods used to access an ordered list of
055 * {@link ChartEntity} objects.
056 */
057public interface EntityCollection {
058
059    /**
060     * Clears all entities.
061     */
062    public void clear();
063
064    /**
065     * Adds an entity to the collection.
066     *
067     * @param entity  the entity (<code>null</code> not permitted).
068     */
069    public void add(ChartEntity entity);
070
071    /**
072     * Adds the entities from another collection to this collection.
073     *
074     * @param collection  the other collection.
075     */
076    public void addAll(EntityCollection collection);
077
078    /**
079     * Returns an entity whose area contains the specified point.
080     *
081     * @param x  the x coordinate.
082     * @param y  the y coordinate.
083     *
084     * @return The entity.
085     */
086    public ChartEntity getEntity(double x, double y);
087
088    /**
089     * Returns an entity from the collection.
090     *
091     * @param index  the index (zero-based).
092     *
093     * @return An entity.
094     */
095    public ChartEntity getEntity(int index);
096
097    /**
098     * Returns the entity count.
099     *
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}