Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
PuttableStream |
|
| 0.0;0 |
1 | /* | |
2 | Copyright 2004-2008 Paul R. Holser, Jr. All rights reserved. | |
3 | Licensed under the Academic Free License version 3.0 | |
4 | */ | |
5 | ||
6 | package jaggregate; | |
7 | ||
8 | /** | |
9 | * Provides protocol for a stream that allows objects to be added to its <dfn>past | |
10 | * sequence values</dfn>. | |
11 | * | |
12 | * @param <E> the type of elements in the stream | |
13 | * @author <a href="mailto:pholser@alumni.rice.edu">Paul Holser</a> | |
14 | * @version $Id: PuttableStream.java,v 1.3 2008/05/05 00:57:13 pholser Exp $ | |
15 | */ | |
16 | public interface PuttableStream<E> { | |
17 | /** | |
18 | * Writes the given new element to this stream. | |
19 | * <p/> | |
20 | * Appends {@code newElement} to the past sequence values. If the future sequence | |
21 | * values is not empty, removes its first object. | |
22 | * | |
23 | * @param newElement the element to add | |
24 | * @throws java.util.NoSuchElementException if there is no next element to replace | |
25 | */ | |
26 | void nextPut( E newElement ); | |
27 | ||
28 | /** | |
29 | * Enumerates the given collection, adding each new element to this stream. | |
30 | * <p/> | |
31 | * This message has the effect of enumerating {@code newElements} with | |
32 | * {@link Collection#forEachDo(UnaryFunctor) forEachDo} and adding each element to | |
33 | * this stream with {@link #nextPut(Object) nextPut}. | |
34 | * | |
35 | * @param newElements the elements to add | |
36 | * @throws NullPointerException if {@code newElements} is {@code null} | |
37 | * @throws java.util.NoSuchElementException if the put overruns the number of | |
38 | * elements in the stream | |
39 | */ | |
40 | void nextPutAll( Collection<? extends E> newElements ); | |
41 | } |