summaryrefslogtreecommitdiff
path: root/src/main/java/bjc/esodata/Spool.java
blob: f065093f443bc49b7382498ecf25170282d95e8f (plain)
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
package bjc.esodata;

import java.util.Iterator;
import java.util.function.Consumer;

/**
 * A single spool, or batch of input.
 * 
 * @author bjcul
 * 
 * @param <T> The type contained by the spool
 */
public interface Spool<T> {
	/**
	 * Get the label that identifies this spool, if it has one.
	 * 
	 * @return The label of the spool, or null if it is unlabeled.
	 */
	public String label();

	/**
	 * Get the group that this spool belongs to, if it belongs to one.
	 * 
	 * @return The group the spool is in, or null if it is not in a group.
	 */
	public String group();

	/**
	 * Get a function that will add input to this spool
	 * 
	 * @return A function that will add input to this spool.
	 */
	public Consumer<T> getInput();

	/**
	 * Get an iterator that will iterate over the data contained in this spool.
	 * 
	 * @return An iterator over the data in this spool.
	 */
	public Iterator<T> getOutput();

	/**
	 * Is this spool closed, meaning it can accept no more input?
	 * 
	 * @return Whether the spool is closed
	 */
	public boolean isClosed();
}