JAL-2321 isParseImmediately() allows the parse() method to determine if it was called...
authorJim Procter <jprocter@issues.jalview.org>
Mon, 7 May 2018 16:36:28 +0000 (17:36 +0100)
committerJim Procter <jprocter@issues.jalview.org>
Mon, 7 May 2018 16:36:28 +0000 (17:36 +0100)
src/jalview/io/AlignFile.java

index 2340283..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();