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 043import java.util.ArrayList; 044import java.util.Iterator; 045import java.util.List; 046 047 048 049/** 050 051 * 052 053 * @author Hanning Ni Doubletwist Inc 054 * @author Greg Cox 055 056 */ 057 058public class AGAVEMapPosition { 059 060 private String pos ; 061 062 private List db_ids ; 063 064 065 066 public AGAVEMapPosition() { 067 068 } 069 070 public void setPos(String pos) 071 072 { 073 074 this.pos = pos ; 075 076 } 077 078 public String getPos() 079 080 { 081 082 return pos ; 083 084 } 085 086 public void addDbId(AGAVEDbId id) 087 088 { 089 090 if( db_ids == null ) 091 092 db_ids = new ArrayList(1) ; 093 094 db_ids.add( id ); 095 096 } 097 098 public Iterator getDbIds() 099 100 { 101 102 return db_ids.iterator() ; 103 104 } 105 106 public String toString(String indent, String indent_unit) 107 108 { 109 110 StringBuffer tmp = new StringBuffer() ; 111 112 tmp.append(indent + "<map_position pos=\"" + pos + "\">" + "\n" ) ; 113 114 Iterator it = db_ids.iterator() ; 115 116 while( it.hasNext() ) 117 118 { 119 120 tmp.append( ((AGAVEDbId) it.next()).toString(indent + indent_unit, indent_unit) ) ; 121 122 } 123 124 tmp.append(indent + "</map_position>") ; 125 126 return tmp.substring(0) ; 127 128 } 129 130 public String toString() 131 132 { 133 134 StringBuffer tmp = new StringBuffer() ; 135 136 tmp.append("<map_position pos=\"" + pos + "\">" + "\n" ) ; 137 138 Iterator it = db_ids.iterator() ; 139 140 while( it.hasNext() ) 141 142 { 143 144 tmp.append( (AGAVEDbId) it.next() ) ; 145 146 } 147 148 tmp.append("</map_position>") ; 149 150 return tmp.substring(0) ; 151 152 } 153 154}