From 0669bcd76c254141146c1fc2628812c782571c0b Mon Sep 17 00:00:00 2001 From: Jim Procter Date: Mon, 7 May 2018 17:36:28 +0100 Subject: [PATCH] JAL-2321 isParseImmediately() allows the parse() method to determine if it was called by the constructor or after construction --- src/jalview/io/AlignFile.java | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/src/jalview/io/AlignFile.java b/src/jalview/io/AlignFile.java index 2340283..7b1e84a 100755 --- a/src/jalview/io/AlignFile.java +++ b/src/jalview/io/AlignFile.java @@ -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(); -- 1.7.10.2