package compbio.engine.archive;
-import java.io.File;
import java.io.FileNotFoundException;
-import java.io.InputStream;
+
import java.util.Iterator;
-import java.util.Scanner;
//import compbio.util.Util;
*/
public class ArchiveManager implements Iterator<ArchivedJob> {
Archive archive;
- //private final Scanner input;
+
+ // private final Scanner input;
/**
* Delimiter for the scanner
*/
- //private final String DELIM = ">";
+ // private final String DELIM = ">";
/**
* Header data can contain non-ASCII symbols and read in UTF8
*/
public ArchiveManager(final String mainPath) throws FileNotFoundException {
/*
- input = new Scanner(new File(mainPath), "UTF8");
- input.useDelimiter(DELIM);
- Runtime.getRuntime().addShutdownHook(new Thread() {
-
- @Override
- public void run() {
- if (input != null) {
- input.close();
- }
- }
- });
- */
+ * input = new Scanner(new File(mainPath), "UTF8");
+ * input.useDelimiter(DELIM); Runtime.getRuntime().addShutdownHook(new
+ * Thread() {
+ *
+ * @Override public void run() { if (input != null) { input.close(); } }
+ * });
+ */
}
-
+
public ArchiveManager(Archive ar) {
archive = ar;
}
-
/**
* {@inheritDoc}
*
*/
@Override
public boolean hasNext() {
- //return input.hasNext();
+ // return input.hasNext();
return true;
}
public ArchivedJob next() {
String path = "bla-bla-bla";
/*
- String path = input.next();
- while (fastaHeader.indexOf("\n") < 0 && input.hasNext()) {
- path = fastaHeader.concat(">");
- path = fastaHeader.concat(input.next());
- }
- */
+ * String path = input.next(); while (fastaHeader.indexOf("\n") < 0 &&
+ * input.hasNext()) { path = fastaHeader.concat(">"); path =
+ * fastaHeader.concat(input.next()); }
+ */
return new ArchivedJob(path);
}
* instance of the FastaReader will be possible after calling this method.
*/
public void close() {
- //input.close();
+ // input.close();
}
private static ArchivedJob toFastaSequence(final String singleFastaEntry) {
int nlineidx = singleFastaEntry.indexOf("\n");
if (nlineidx < 0) {
- throw new AssertionError(
- "The FASTA sequence must contain the header information"
- + " separated by the new line from the sequence. Given sequence does not appear to "
- + "contain the header! Given data:\n "
- + singleFastaEntry);
+ throw new AssertionError("The FASTA sequence must contain the header information"
+ + " separated by the new line from the sequence. Given sequence does not appear to "
+ + "contain the header! Given data:\n " + singleFastaEntry);
}
String header = singleFastaEntry.substring(0, nlineidx);