3535import java .io .IOException ;
3636import java .io .Reader ;
3737import java .util .ArrayList ;
38+ import java .util .Arrays ;
3839import java .util .List ;
3940import java .util .regex .Matcher ;
4041import java .util .regex .Pattern ;
4950 */
5051public class InsdcParser <S extends AbstractSequence <C >, C extends Compound >{
5152
53+ private boolean isSequenceCircular ;
54+ private long sequenceLength ;
55+
5256 private final DataSource dataSource ;
5357
5458 /**
@@ -80,7 +84,6 @@ public class InsdcParser <S extends AbstractSequence<C>, C extends Compound>{
8084 * Not really sure that they are not declared obsolete but they are still in
8185 * several files.
8286 */
83- //protected static final Pattern genbankSplitPattern = Pattern.compile("^\\s?(join|order|bond|complement|)\\(?([^\\)]+)\\)?");
8487 protected static final Pattern genbankSplitPattern = Pattern .compile ("^\\ s?(join|order|bond|complement|)\\ (?(.+)\\ )?" );
8588 /**
8689 * designed to recursively split a location string in tokens. Valid tokens
@@ -126,7 +129,13 @@ public DataSource getDataSource() {
126129 return dataSource ;
127130 }
128131
132+ public void setSequenceCircular (boolean sequenceCircular ) {
133+ isSequenceCircular = sequenceCircular ;
134+ }
129135
136+ public void setSequenceLength (long sequenceLength ) {
137+ this .sequenceLength = sequenceLength ;
138+ }
130139
131140 /**
132141 * Main method for parsing a location from a String instance
@@ -135,12 +144,12 @@ public DataSource getDataSource() {
135144 * @return The parsed location
136145 * @throws ParserException thrown in the event of any error during parsing
137146 */
138- public Location parse (String locationString , boolean isSequenceCircular ) throws ParserException {
147+ public Location parse (String locationString ) throws ParserException {
139148 featureGlobalStart = Integer .MAX_VALUE ;
140149 featureGlobalEnd = 1 ;
141150
142151 Location l ;
143- List <Location > ll = parseLocationString (locationString , 1 , isSequenceCircular );
152+ List <Location > ll = parseLocationString (locationString , 1 );
144153
145154 if (ll .size () == 1 ) {
146155 l = ll .get (0 );
@@ -155,10 +164,6 @@ public Location parse(String locationString, boolean isSequenceCircular) throws
155164 return l ;
156165 }
157166
158- public Location parse (String locationString ) throws ParserException {
159- return parse (locationString , false );
160- }
161-
162167 /**
163168 * Reader based version of the parse methods.
164169 *
@@ -173,7 +178,7 @@ public List<AbstractLocation> parse(Reader reader) throws IOException, ParserExc
173178 return null ;
174179 }
175180
176- private List <Location > parseLocationString (String string , int versus , boolean isSequenceCircular ) throws ParserException {
181+ private List <Location > parseLocationString (String string , int versus ) throws ParserException {
177182 Matcher m ;
178183 List <Location > boundedLocationsCollection = new ArrayList <Location >();
179184
@@ -192,7 +197,7 @@ private List<Location> parseLocationString(String string, int versus, boolean is
192197 //recursive case
193198 int localVersus = splitQualifier .equalsIgnoreCase ("complement" ) ? -1 : 1 ;
194199 List <Location > subLocations = parseLocationString (
195- splitString , versus * localVersus , isSequenceCircular );
200+ splitString , versus * localVersus );
196201
197202 switch (complexFeaturesAppendMode ) {
198203 case FLATTEN :
0 commit comments