001    //$HeadURL: svn+ssh://jwilden@svn.wald.intevation.org/deegree/base/branches/2.5_testing/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: mschneider $
045     *
046     * @version $Revision: 18195 $, $Date: 2009-06-18 17:55:39 +0200 (Do, 18 Jun 2009) $
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         * adds a list of features to the collection
093         *
094         * @param features
095         *            to add.
096         * @deprecated use {@link #addAllUncontained} instead, and note that the method behaves slightly different
097         * @see #addAllUncontained
098         */
099        @Deprecated
100        public void addAll( Feature[] features );
101    
102        /**
103         * adds a list of features to the collection
104         *
105         * @param features
106         *            to add.
107         */
108        public void addAllUncontained( Feature[] features );
109    
110        /**
111         * adds a list of features to the collection
112         *
113         * @param featureCollection
114         *            to add.
115         * @deprecated use {@link #addAllUncontained} instead, and note that the method behaves slightly different
116         * @see #addAllUncontained
117         */
118        @Deprecated
119        public void addAll( FeatureCollection featureCollection );
120    
121        /**
122         * Adds the features to the collection, if they're not already contained.
123         *
124         * @param featureCollection
125         */
126        public void addAllUncontained( FeatureCollection featureCollection );
127    
128        /**
129         * removes the submitted feature from the collection
130         *
131         * @param feature
132         *            to remove
133         *
134         * @return removed feature
135         */
136        public Feature remove( Feature feature );
137    
138        /**
139         * removes the feature at the submitted index from the collection
140         *
141         * @param index
142         *            of the feature to remove.
143         *
144         * @return removed feature
145         */
146        public Feature remove( int index );
147    
148        /**
149         * removes the feature that is assigned to the submitted id. The removed feature will be returned. If no valid
150         * feature could be found null will be returned
151         *
152         * @param id
153         *            of the feature to remove.
154         *
155         * @return removed feature
156         */
157        public Feature remove( String id );
158    
159        /**
160         * @return the number of features within the collection
161         */
162        public int size();
163    }