* @author $author$
* @version $Revision$
*/
-public abstract class AlignFile extends FileParse implements
- AlignmentFileReaderI, AlignmentFileWriterI
+public abstract class AlignFile extends FileParse
+ implements AlignmentFileReaderI, AlignmentFileWriterI
{
int noSeqs = 0;
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.
* @throws IOException
*/
public AlignFile(boolean parseImmediately, String dataObject,
- DataSourceType sourceType)
- throws IOException
+ DataSourceType sourceType) throws IOException
{
super(dataObject, sourceType);
initData();
{
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();
}
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);
- }
}
/**
{
if (key == null)
{
- throw new Error(
- MessageManager
- .getString("error.implementation_error_cannot_have_null_alignment"));
+ throw new Error(MessageManager.getString(
+ "error.implementation_error_cannot_have_null_alignment"));
}
if (value == null)
{