001    //$HeadURL: svn+ssh://rbezema@svn.wald.intevation.org/deegree/base/tags/2.1/src/org/deegree/model/metadata/iso19115/Phone.java $
002    /*
003     * ---------------- FILE HEADER ------------------------------------------
004     * 
005     * This file is part of deegree. Copyright (C) 2001-2006 by: EXSE, Department of
006     * Geography, University of Bonn http://www.giub.uni-bonn.de/deegree/ lat/lon
007     * Fitzke/Fretter/Poth GbR http://www.lat-lon.de
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     * 
014     * This library is distributed in the hope that it will be useful, but WITHOUT
015     * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
016     * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
017     * details.
018     * 
019     * You should have received a copy of the GNU Lesser General Public License
020     * along with this library; if not, write to the Free Software Foundation, Inc.,
021     * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
022     * 
023     * Contact:
024     * 
025     * Andreas Poth lat/lon GmbH Aennchenstr. 19 53115
026     * Bonn Germany E-Mail: poth@lat-lon.de
027     * 
028     * Prof. Dr. Klaus Greve Department of Geography University of Bonn Meckenheimer Allee 166
029     * 53115 Bonn Germany E-Mail: greve@giub.uni-bonn.de
030     * 
031     * 
032     * ---------------------------------------------------------------------------
033     */
034    
035    package org.deegree.model.metadata.iso19115;
036    
037    import java.util.ArrayList;
038    
039    /**
040     * Represents a contact phone number.
041     * 
042     * @author <a href="mailto:poth@lat-lon.de">Andreas Poth </a>
043     * @author last edited by: $Author: apoth $
044     * 
045     * @version 2.0, $Revision: 6704 $
046     * 
047     * @since 2.0
048     */
049    public class Phone {
050    
051        private ArrayList<String> facsimile;
052    
053        private ArrayList<String> other;
054    
055        private ArrayList<String> othertype;
056    
057        private ArrayList<String> voice;
058    
059        private Phone() {
060            this.facsimile = new ArrayList<String>();
061            this.other = new ArrayList<String>();
062            this.othertype = new ArrayList<String>();
063            this.voice = new ArrayList<String>();
064        }
065    
066        /**
067         * Creates a new instance of Phone
068         * 
069         * @param facsimile
070         * @param voice
071         */
072        public Phone( String[] facsimile, String[] voice ) {
073            this();
074    
075            setFacsimile( facsimile );
076            setVoice( voice );
077        }
078    
079        /**
080         * Creates a new instance of Phone
081         * 
082         * @param facsimile
083         * @param other
084         * @param othertype
085         * @param voice
086         */
087        public Phone( String[] facsimile, String[] other, String[] othertype, String[] voice ) {
088            this();
089    
090            setFacsimile( facsimile );
091            setOther( other );
092            setOtherType( othertype );
093            setVoice( voice );
094        }
095    
096        /**
097         * @return fax
098         */
099        public String[] getFacsimile() {
100            return facsimile.toArray( new String[facsimile.size()] );
101        }
102    
103        /**
104         * @see #getFacsimile()
105         * @param facsimile
106         */
107        public void addFacsimile( String facsimile ) {
108            this.facsimile.add( facsimile );
109        }
110    
111        /**
112         * @see #getFacsimile()
113         * @param facsimile
114         */
115        public void setFacsimile( String[] facsimile ) {
116            this.facsimile.clear();
117            for ( int i = 0; i < facsimile.length; i++ ) {
118                this.facsimile.add( facsimile[i] );
119            }
120        }
121    
122        /**
123         * @return other phones
124         */
125        public String[] getOther() {
126            return other.toArray( new String[other.size()] );
127        }
128    
129        /**
130         * @see #getOther()
131         * @param other
132         */
133        public void addOther( String other ) {
134            this.other.add( other );
135        }
136    
137        /**
138         * @see #getOther()
139         * @param other
140         */
141        public void setOther( String[] other ) {
142            this.other.clear();
143            if ( other != null ) {
144                for ( int i = 0; i < other.length; i++ ) {
145                    this.other.add( other[i] );
146                }
147            }
148        }
149    
150        /**
151         * @return other types
152         * 
153         */
154        public String[] getOtherType() {
155            return othertype.toArray( new String[othertype.size()] );
156        }
157    
158        /**
159         * @see #getOtherType()
160         * @param othertype
161         */
162        public void addOtherType( String othertype ) {
163            this.othertype.add( othertype );
164        }
165    
166        /**
167         * @see #getOtherType()
168         * @param othertype
169         */
170        public void setOtherType( String[] othertype ) {
171            this.othertype.clear();
172            if ( othertype != null ) {
173                for ( int i = 0; i < othertype.length; i++ ) {
174                    this.othertype.add( othertype[i] );
175                }
176            }
177        }
178    
179        /**
180         * @return voice
181         */
182        public String[] getVoice() {
183            return voice.toArray( new String[voice.size()] );
184        }
185    
186        /**
187         * @see #getVoice()
188         * @param voice
189         */
190        public void addVoice( String voice ) {
191            this.voice.add( voice );
192        }
193    
194        /**
195         * @see #getVoice()
196         * @param voice
197         */
198        public void setVoice( String[] voice ) {
199            this.voice.clear();
200            for ( int i = 0; i < voice.length; i++ ) {
201                this.voice.add( voice[i] );
202            }
203        }
204    
205        /**
206         * to String method
207         * 
208         * @return string representation
209         */
210        public String toString() {
211            String ret = null;
212            ret = "facsimile = " + facsimile + "\n";
213            ret += "other = " + other + "\n";
214            ret += "othertype = " + othertype + "\n";
215            ret += "voice = " + voice + "\n";
216            return ret;
217        }
218    
219    }