001/*
002
003 *                    BioJava development code
004
005 *
006
007 * This code may be freely distributed and modified under the
008
009 * terms of the GNU Lesser General Public Licence.  This should
010
011 * be distributed with the code.  If you do not have a copy,
012
013 * see:
014
015 *
016
017 *      http://www.gnu.org/copyleft/lesser.html
018
019 *
020
021 * Copyright for this code is held jointly by the individual
022
023 * authors.  These should be listed in @author doc comments.
024
025 *
026
027 * For more information on the BioJava project and its aims,
028
029 * or to join the biojava-l mailing list, visit the home page
030
031 * at:
032
033 *
034
035 *      http://www.biojava.org/
036
037 *
038
039 */
040
041package org.biojava.bio.seq.io.agave;
042
043
044
045/**
046
047 * @author Hanning Ni    Doubletwist Inc
048  * @author Greg Cox
049
050 */
051
052public class AGAVEMapLocation {
053
054  private AGAVEMapPosition first ;
055
056  private AGAVEMapPosition second ;
057
058  private String map_type ;
059
060  private String source ;
061
062  private String units ;
063
064  private String chromosome ;
065
066  private String subseq_start ;
067
068  private String orientation ;
069
070  public AGAVEMapLocation() {
071
072  }
073
074  public void  addPosition(AGAVEMapPosition pos)
075
076  {
077
078      if( first == null )
079
080          first = pos ;
081
082      else
083
084          second = pos ;
085
086  }
087
088  public AGAVEMapPosition getPosition1()
089
090  {
091
092      return first ;
093
094  }
095
096
097
098  public AGAVEMapPosition getPosition2()
099
100  {
101
102      return second;
103
104  }
105
106
107
108  public void setMapType(String value)
109
110  {
111
112      map_type = value ;
113
114  }
115
116  public String getMapType()
117
118  {
119
120     return map_type ;
121
122  }
123
124  public void setUnits(String value)
125
126  {
127
128      units = value ;
129
130  }
131
132  public String getUnits()
133
134  {
135
136      return units ;
137
138  }
139
140  public void setSource(String value)
141
142  {
143
144      source= value ;
145
146  }
147
148  public String getSource()
149
150  {
151
152      return source ;
153
154  }
155
156  public void setChromosome(String value)
157
158  {
159
160      chromosome = value ;
161
162  }
163
164  public String getChromosome()
165
166  {
167
168      return chromosome ;
169
170  }
171
172  public void setSubSeqStart(String value)
173
174  {
175
176      subseq_start = value ;
177
178  }
179
180  public String getSubSeqStart()
181
182  {
183
184      return subseq_start ;
185
186  }
187
188    public void setOrientation(String value)
189
190  {
191
192      orientation = value ;
193
194  }
195
196  public String getOrientation()
197
198  {
199
200      return orientation ;
201
202  }
203
204  public String toString(String indent, String indent_unit)
205
206  {
207
208      StringBuffer tmp = new StringBuffer() ;
209
210      tmp.append(indent + "<map_location ") ;
211
212      if( map_type != null )
213
214         tmp.append( " map_type=\"" + map_type + "\" " );
215
216      if( source != null )
217
218         tmp.append( " source=\"" + source + "\" " );
219
220      if( units != null )
221
222         tmp.append( " units=\"" + units + "\" " );
223
224      if( orientation != null )
225
226         tmp.append( " orientation=\"" + orientation + "\" " );
227
228      if( chromosome != null )
229
230         tmp.append( " chromosome=\"" + chromosome + "\" " );
231
232      if( subseq_start != null )
233
234         tmp.append( " subseq_start=\"" + subseq_start + "\" " );
235
236      tmp.append( ">" + "\n") ;
237
238      if( first != null )
239
240         tmp.append ( first.toString(indent + indent_unit, indent_unit) ) ;
241
242      if( second != null )
243
244         tmp.append( second.toString(indent + indent_unit, indent_unit) ) ;
245
246      tmp.append(indent + "</map_location>"+ "\n" ) ;
247
248      return tmp.substring(0) ;
249
250  }
251
252  public String toString()
253
254  {
255
256      StringBuffer tmp = new StringBuffer() ;
257
258      tmp.append("<map_location ") ;
259
260      if( map_type != null )
261
262         tmp.append( " map_type=\"" + map_type + "\" " );
263
264      if( source != null )
265
266         tmp.append( " source=\"" + source + "\" " );
267
268      if( units != null )
269
270         tmp.append( " units=\"" + units + "\" " );
271
272      if( orientation != null )
273
274         tmp.append( " orientation=\"" + orientation + "\" " );
275
276      if( chromosome != null )
277
278         tmp.append( " chromosome=\"" + chromosome + "\" " );
279
280      if( subseq_start != null )
281
282         tmp.append( " subseq_start=\"" + subseq_start + "\" " );
283
284      tmp.append( ">" + "\n") ;
285
286      if( first != null )
287
288         tmp.append ( first ) ;
289
290      if( second != null )
291
292         tmp.append( second ) ;
293
294      tmp.append( "</map_location>"+ "\n" ) ;
295
296      return tmp.substring(0) ;
297
298  }
299
300
301
302}