001    //$HeadURL: svn+ssh://rbezema@svn.wald.intevation.org/deegree/base/branches/2.2_testing/src/org/deegree/model/spatialschema/Aggregate.java $
002    /*----------------    FILE HEADER  ------------------------------------------
003    
004     This file is part of deegree.
005     Copyright (C) 2001-2008 by:
006     EXSE, Department of Geography, University of Bonn
007     http://www.giub.uni-bonn.de/deegree/
008     lat/lon GmbH
009     http://www.lat-lon.de
010    
011     This library is free software; you can redistribute it and/or
012     modify it under the terms of the GNU Lesser General Public
013     License as published by the Free Software Foundation; either
014     version 2.1 of the License, or (at your option) any later version.
015    
016     This library is distributed in the hope that it will be useful,
017     but WITHOUT ANY WARRANTY; without even the implied warranty of
018     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
019     Lesser General Public License for more details.
020    
021     You should have received a copy of the GNU Lesser General Public
022     License along with this library; if not, write to the Free Software
023     Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
024    
025     Contact:
026    
027     Andreas Poth
028     lat/lon GmbH
029     Aennchenstr. 19
030     53115 Bonn
031     Germany
032     E-Mail: poth@lat-lon.de
033    
034     Prof. Dr. Klaus Greve
035     Department of Geography
036     University of Bonn
037     Meckenheimer Allee 166
038     53115 Bonn
039     Germany
040     E-Mail: greve@giub.uni-bonn.de
041    
042     
043     ---------------------------------------------------------------------------*/
044    
045    package org.deegree.model.spatialschema;
046    
047    import java.util.Iterator;
048    
049    /**
050     * 
051     * This interface defines the basis functionallity of all geometry aggregations. it will be
052     * specialized for the use of primitive, and solid geometries.
053     * 
054     * <p>
055     * -----------------------------------------------------
056     * </p>
057     * 
058     * @author Andreas Poth
059     * @version $Revision: 9343 $ $Date: 2007-12-27 14:30:32 +0100 (Do, 27 Dez 2007) $
060     *          <p>
061     */
062    
063    public interface Aggregate extends Geometry {
064    
065        /**
066         * returns the number of Geometry within the aggregation
067         */
068        int getSize();
069    
070        /**
071         * merges two aggregation.
072         * 
073         * @exception GeometryException
074         *                a GeometryException will be thrown if the submitted isn't the same type as the
075         *                recieving one.
076         */
077        void merge( Aggregate aggregate )
078                                throws GeometryException;
079    
080        /**
081         * adds an Geometry to the aggregation
082         */
083        void add( Geometry gmo );
084    
085        /**
086         * inserts a Geometry in the aggregation. all elements with an index equal or larger index will
087         * be moved. if index is larger then getSize() - 1 an exception will be thrown.
088         * 
089         * @param gmo
090         *            Geometry to insert.
091         * @param index
092         *            position where to insert the new Geometry
093         */
094        void insertObjectAt( Geometry gmo, int index )
095                                throws GeometryException;
096    
097        /**
098         * sets the submitted Geometry at the submitted index. the element at the position
099         * <code>index</code> will be removed. if index is larger then getSize() - 1 an exception will
100         * be thrown.
101         * 
102         * @param gmo
103         *            Geometry to set.
104         * @param index
105         *            position where to set the new Geometry
106         */
107        void setObjectAt( Geometry gmo, int index )
108                                throws GeometryException;
109    
110        /**
111         * removes the submitted Geometry from the aggregation
112         * 
113         * @return the removed Geometry
114         */
115        Geometry removeObject( Geometry gmo );
116    
117        /**
118         * removes the Geometry at the submitted index from the aggregation. if index is larger then
119         * getSize() - 1 an exception will be thrown.
120         * 
121         * @return the removed Geometry
122         */
123        Geometry removeObjectAt( int index )
124                                throws GeometryException;
125    
126        /**
127         * removes all Geometry from the aggregation.
128         */
129        void removeAll();
130    
131        /**
132         * returns the Geometry at the submitted index.
133         */
134        Geometry getObjectAt( int index );
135    
136        /**
137         * returns all Geometries as array
138         */
139        Geometry[] getAll();
140    
141        /**
142         * returns true if the submitted Geometry is within the aggregation
143         */
144        boolean isMember( Geometry gmo );
145    
146        /**
147         * returns the aggregation as an iterator
148         */
149        Iterator getIterator();
150    
151    }