JAL-2321 isParseImmediately() allows the parse() method to determine if it was called...
[jalview.git] / src / jalview / io / AlignFile.java
index a603cca..7b1e84a 100755 (executable)
@@ -72,8 +72,21 @@ public abstract class AlignFile extends FileParse
 
   long end;
 
+  /**
+   * true if parse() has been called
+   */
   private boolean parseCalled;
 
+  private boolean parseImmediately;
+
+  /**
+   * @return if doParse() was called at construction time
+   */
+  protected boolean isParseImmediately()
+  {
+    return parseImmediately;
+  }
+
   /**
    * Creates a new AlignFile object.
    */
@@ -153,6 +166,11 @@ public abstract class AlignFile extends FileParse
   {
     super(source);
     initData();
+
+    // stash flag in case parse needs to know if it has to autoconfigure or was
+    // configured after construction
+    this.parseImmediately = parseImmediately;
+
     if (parseImmediately)
     {
       doParse();
@@ -174,11 +192,6 @@ public abstract class AlignFile extends FileParse
     }
     parseCalled = true;
     parse();
-    // sets the index of each sequence in the alignment
-    for (int i = 0, c = seqs.size(); i < c; i++)
-    {
-      seqs.get(i).setIndex(i);
-    }
   }
 
   /**