001    //$HeadURL: svn+ssh://rbezema@svn.wald.intevation.org/deegree/base/branches/2.2_testing/src/org/deegree/model/metadata/iso19115/Phone.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.metadata.iso19115;
046    
047    import java.util.ArrayList;
048    
049    /**
050     * Represents a contact phone number.
051     * 
052     * @author <a href="mailto:poth@lat-lon.de">Andreas Poth </a>
053     * @author last edited by: $Author: apoth $
054     * 
055     * @version 2.0, $Revision: 9343 $
056     * 
057     * @since 2.0
058     */
059    public class Phone {
060    
061        private ArrayList<String> facsimile;
062    
063        private ArrayList<String> other;
064    
065        private ArrayList<String> othertype;
066    
067        private ArrayList<String> voice;
068    
069        private Phone() {
070            this.facsimile = new ArrayList<String>();
071            this.other = new ArrayList<String>();
072            this.othertype = new ArrayList<String>();
073            this.voice = new ArrayList<String>();
074        }
075    
076        /**
077         * Creates a new instance of Phone
078         * 
079         * @param facsimile
080         * @param voice
081         */
082        public Phone( String[] facsimile, String[] voice ) {
083            this();
084    
085            setFacsimile( facsimile );
086            setVoice( voice );
087        }
088    
089        /**
090         * Creates a new instance of Phone
091         * 
092         * @param facsimile
093         * @param other
094         * @param othertype
095         * @param voice
096         */
097        public Phone( String[] facsimile, String[] other, String[] othertype, String[] voice ) {
098            this();
099    
100            setFacsimile( facsimile );
101            setOther( other );
102            setOtherType( othertype );
103            setVoice( voice );
104        }
105    
106        /**
107         * @return fax
108         */
109        public String[] getFacsimile() {
110            return facsimile.toArray( new String[facsimile.size()] );
111        }
112    
113        /**
114         * @see #getFacsimile()
115         * @param facsimile
116         */
117        public void addFacsimile( String facsimile ) {
118            this.facsimile.add( facsimile );
119        }
120    
121        /**
122         * @see #getFacsimile()
123         * @param facsimile
124         */
125        public void setFacsimile( String[] facsimile ) {
126            this.facsimile.clear();
127            for ( int i = 0; i < facsimile.length; i++ ) {
128                this.facsimile.add( facsimile[i] );
129            }
130        }
131    
132        /**
133         * @return other phones
134         */
135        public String[] getOther() {
136            return other.toArray( new String[other.size()] );
137        }
138    
139        /**
140         * @see #getOther()
141         * @param other
142         */
143        public void addOther( String other ) {
144            this.other.add( other );
145        }
146    
147        /**
148         * @see #getOther()
149         * @param other
150         */
151        public void setOther( String[] other ) {
152            this.other.clear();
153            if ( other != null ) {
154                for ( int i = 0; i < other.length; i++ ) {
155                    this.other.add( other[i] );
156                }
157            }
158        }
159    
160        /**
161         * @return other types
162         * 
163         */
164        public String[] getOtherType() {
165            return othertype.toArray( new String[othertype.size()] );
166        }
167    
168        /**
169         * @see #getOtherType()
170         * @param othertype
171         */
172        public void addOtherType( String othertype ) {
173            this.othertype.add( othertype );
174        }
175    
176        /**
177         * @see #getOtherType()
178         * @param othertype
179         */
180        public void setOtherType( String[] othertype ) {
181            this.othertype.clear();
182            if ( othertype != null ) {
183                for ( int i = 0; i < othertype.length; i++ ) {
184                    this.othertype.add( othertype[i] );
185                }
186            }
187        }
188    
189        /**
190         * @return voice
191         */
192        public String[] getVoice() {
193            return voice.toArray( new String[voice.size()] );
194        }
195    
196        /**
197         * @see #getVoice()
198         * @param voice
199         */
200        public void addVoice( String voice ) {
201            this.voice.add( voice );
202        }
203    
204        /**
205         * @see #getVoice()
206         * @param voice
207         */
208        public void setVoice( String[] voice ) {
209            this.voice.clear();
210            for ( int i = 0; i < voice.length; i++ ) {
211                this.voice.add( voice[i] );
212            }
213        }
214    
215        /**
216         * to String method
217         * 
218         * @return string representation
219         */
220        public String toString() {
221            String ret = null;
222            ret = "facsimile = " + facsimile + "\n";
223            ret += "other = " + other + "\n";
224            ret += "othertype = " + othertype + "\n";
225            ret += "voice = " + voice + "\n";
226            return ret;
227        }
228    
229    }