File: ConcurrentReadStreamInterface.java

package info (click to toggle)
bbmap 39.20%2Bdfsg-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 26,024 kB
  • sloc: java: 312,743; sh: 18,099; python: 5,247; ansic: 2,074; perl: 96; makefile: 39; xml: 38
file content (72 lines) | stat: -rwxr-xr-x 2,523 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
package stream;

import structures.ListNum;

public interface ConcurrentReadStreamInterface extends Runnable{
	
	/** Start this in a new thread. */
	public void start();
	
	/** Fetch the next list of reads.  Returns an empty list when end of input is reached. */
	public ListNum<Read> nextList();
	
	/** Re-calls returnList(returnList(ln.id, ln.list.isEmpty()) */
	public void returnList(ListNum<Read> ln);
	
	/** When the nextList() caller is done processing a list, it MUST be returned using this method.
	 * The 'poison' flag should be set to false normally.  When a consumer thread receives an empty list from nextList(),
	 * it should be returned with the poison flag set to true, then the consumer should terminate.
	 * This will return a list to the 'full' queue, allowing another thread to pull the empty list and terminate.  */
	public void returnList(long listNumber, boolean poison);
	
	/** This must be called (indirectly, via Thread.start()) before reads will be generated. */
	@Override
	public void run();
	
	/** Indicate to producer threads that no more reads are desired, and interrupts them. */
	public void shutdown();

	/** Reset state to allow production of reads from the beginning of the input files.
	 * Does not work with stdin (may cause strange behavior). */
	public void restart();
	
	/** Calls shutdown, then shuts down all threads and closes all associated files. */
	public void close();
	
	/** Returns true for paired-end stream, false for single-end stream. */
	public boolean paired();
	
	/** Name of the file or resource underlying this stream */
	public String fname();
	
	/** Returns the underlying read object producer(s), such as ReadInputStreams.  Optional method for things such as error messages. */
	public Object[] producers();
	
	/** Return true if this stream or its producers have detected an error. */
	public boolean errorState();
	
	/**
	 * Set the read sampling rate.  Optional method.
	 * @param rate Fraction of reads to use, 0-1.
	 * @param seed Random number generator seed when positive.  If negative, a random seed will be used.
	 */
	public void setSampleRate(float rate, long seed);
	
	/**
	 * @return Number of bases read by this stream.
	 */
	public long basesIn();
	
	/**
	 * @return Number of reads read by this stream.
	 */
	public long readsIn();
	
	/**
	 * @return Value of verbose field.
	 */
	public boolean verbose();
	
//	public String classname(); //e.g. getClass().getName()
	
}