X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fio%2FAlignFile.java;h=cea28705553b083dd7ab5ea083ec4c3e53d34048;hb=bc7283e7d80b1f7f5fb7d95c51b96bb3af31593d;hp=a603ccac45d6d9577a076be41a481c2bf253230c;hpb=f4766a7bbcfae845fc95923b01fa14ff83d589ff;p=jalview.git diff --git a/src/jalview/io/AlignFile.java b/src/jalview/io/AlignFile.java index a603cca..cea2870 100755 --- a/src/jalview/io/AlignFile.java +++ b/src/jalview/io/AlignFile.java @@ -72,7 +72,20 @@ public abstract class AlignFile extends FileParse long end; - private boolean parseCalled; + /** + * true if parse() has been called + */ + private boolean parseCalled = false; + + private boolean parseImmediately = true; + + /** + * @return if doParse() was called at construction time + */ + protected boolean isParseImmediately() + { + return parseImmediately; + } /** * Creates a new AlignFile object. @@ -99,7 +112,7 @@ public abstract class AlignFile extends FileParse * @param sourceType * What type of file to read from (File, URL, Pasted String) */ - public AlignFile(String dataObject, DataSourceType sourceType) + public AlignFile(Object dataObject, DataSourceType sourceType) throws IOException { this(true, dataObject, sourceType); @@ -117,9 +130,10 @@ public abstract class AlignFile extends FileParse * What type of file to read from (File, URL) * @throws IOException */ - public AlignFile(boolean parseImmediately, String dataObject, + public AlignFile(boolean parseImmediately, Object dataObject, DataSourceType sourceType) throws IOException { + // BH allows File or String super(dataObject, sourceType); initData(); if (parseImmediately) @@ -153,6 +167,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 +193,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); - } } /**