1 package stream;
2 
3 import structures.ListNum;
4 
5 public interface ConcurrentReadStreamInterface extends Runnable{
6 
7 	/** Start this in a new thread. */
start()8 	public void start();
9 
10 	/** Fetch the next list of reads.  Returns an empty list when end of input is reached. */
nextList()11 	public ListNum<Read> nextList();
12 
13 	/** Re-calls returnList(returnList(ln.id, ln.list.isEmpty()) */
returnList(ListNum<Read> ln)14 	public void returnList(ListNum<Read> ln);
15 
16 	/** When the nextList() caller is done processing a list, it MUST be returned using this method.
17 	 * The 'poison' flag should be set to false normally.  When a consumer thread receives an empty list from nextList(),
18 	 * it should be returned with the poison flag set to true, then the consumer should terminate.
19 	 * This will return a list to the 'full' queue, allowing another thread to pull the empty list and terminate.  */
returnList(long listNumber, boolean poison)20 	public void returnList(long listNumber, boolean poison);
21 
22 	/** This must be called (indirectly, via Thread.start()) before reads will be generated. */
23 	@Override
run()24 	public void run();
25 
26 	/** Indicate to producer threads that no more reads are desired, and interrupts them. */
shutdown()27 	public void shutdown();
28 
29 	/** Reset state to allow production of reads from the beginning of the input files.
30 	 * Does not work with stdin (may cause strange behavior). */
restart()31 	public void restart();
32 
33 	/** Calls shutdown, then shuts down all threads and closes all associated files. */
close()34 	public void close();
35 
36 	/** Returns true for paired-end stream, false for single-end stream. */
paired()37 	public boolean paired();
38 
39 	/** Returns the underlying read object producer(s), such as ReadInputStreams.  Optional method for things such as error messages. */
producers()40 	public Object[] producers();
41 
42 	/** Return true if this stream or its producers have detected an error. */
errorState()43 	public boolean errorState();
44 
45 	/**
46 	 * Set the read sampling rate.  Optional method.
47 	 * @param rate Fraction of reads to use, 0-1.
48 	 * @param seed Random number generator seed when positive.  If negative, a random seed will be used.
49 	 */
setSampleRate(float rate, long seed)50 	public void setSampleRate(float rate, long seed);
51 
52 	/**
53 	 * @return Number of bases read by this stream.
54 	 */
basesIn()55 	public long basesIn();
56 
57 	/**
58 	 * @return Number of reads read by this stream.
59 	 */
readsIn()60 	public long readsIn();
61 
62 	/**
63 	 * @return Value of verbose field.
64 	 */
verbose()65 	public boolean verbose();
66 
67 //	public String classname(); //e.g. getClass().getName()
68 
69 }
70