001    //$HeadURL: http://svn.wald.intevation.org/svn/deegree/base/trunk/src/org/deegree/model/feature/FeatureCollection.java $
002    /*----------------------------------------------------------------------------
003     This file is part of deegree, http://deegree.org/
004     Copyright (C) 2001-2009 by:
005       Department of Geography, University of Bonn
006     and
007       lat/lon GmbH
008    
009     This library is free software; you can redistribute it and/or modify it under
010     the terms of the GNU Lesser General Public License as published by the Free
011     Software Foundation; either version 2.1 of the License, or (at your option)
012     any later version.
013     This library is distributed in the hope that it will be useful, but WITHOUT
014     ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
015     FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
016     details.
017     You should have received a copy of the GNU Lesser General Public License
018     along with this library; if not, write to the Free Software Foundation, Inc.,
019     59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
020    
021     Contact information:
022    
023     lat/lon GmbH
024     Aennchenstr. 19, 53177 Bonn
025     Germany
026     http://lat-lon.de/
027    
028     Department of Geography, University of Bonn
029     Prof. Dr. Klaus Greve
030     Postfach 1147, 53001 Bonn
031     Germany
032     http://www.geographie.uni-bonn.de/deegree/
033    
034     e-mail: info@deegree.org
035    ----------------------------------------------------------------------------*/
036    package org.deegree.model.feature;
037    
038    import java.util.Iterator;
039    
040    /**
041     *
042     *
043     * @author <a href="mailto:poth@lat-lon.de">Andreas Poth</a>
044     * @author last edited by: $Author: apoth $
045     *
046     * @version $Revision: 29966 $, $Date: 2011-03-09 15:19:04 +0100 (Wed, 09 Mar 2011) $
047     */
048    public interface FeatureCollection extends Feature {
049    
050        /**
051         * removes all features from a collection
052         *
053         */
054        public void clear();
055    
056        /**
057         * @param index
058         *            of the feature.
059         * @return the feature at the submitted index
060         */
061        public Feature getFeature( int index );
062    
063        /**
064         * @param id
065         *            of the feature
066         * @return the feature that is assigned to the submitted id. If no valid feature could be found <code>null</code>
067         *         will be returned.
068         */
069        public Feature getFeature( String id );
070    
071        /**
072         * @return an array of all features
073         */
074        public Feature[] toArray();
075    
076        /**
077         * returns an <tt>Iterator</tt> on the feature contained in a collection
078         *
079         * @return an <tt>Iterator</tt> on the feature contained in a collection
080         */
081        public Iterator<Feature> iterator();
082    
083        /**
084         * adds a feature to the collection
085         *
086         * @param feature
087         *            to add.
088         */
089        public void add( Feature feature );
090    
091       
092    
093        /**
094         * adds a list of features to the collection
095         *
096         * @param features
097         *            to add.
098         */
099        public void addAllUncontained( Feature[] features );
100    
101      
102    
103        /**
104         * Adds the features to the collection, if they're not already contained.
105         *
106         * @param featureCollection
107         */
108        public void addAllUncontained( FeatureCollection featureCollection );
109    
110        /**
111         * removes the submitted feature from the collection
112         *
113         * @param feature
114         *            to remove
115         *
116         * @return removed feature
117         */
118        public Feature remove( Feature feature );
119    
120        /**
121         * removes the feature at the submitted index from the collection
122         *
123         * @param index
124         *            of the feature to remove.
125         *
126         * @return removed feature
127         */
128        public Feature remove( int index );
129    
130        /**
131         * removes the feature that is assigned to the submitted id. The removed feature will be returned. If no valid
132         * feature could be found null will be returned
133         *
134         * @param id
135         *            of the feature to remove.
136         *
137         * @return removed feature
138         */
139        public Feature remove( String id );
140    
141        /**
142         * @return the number of features within the collection
143         */
144        public int size();
145    }