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