package org.gcube.data.streams.generators; import org.gcube.data.streams.Iteration; import org.gcube.data.streams.Stream; import org.gcube.data.streams.exceptions.StreamSkipSignal; import org.gcube.data.streams.exceptions.StreamStopSignal; /** * Yields elements of a {@link Stream} from elements of another {@link Stream}. * * @author Fabio Simeoni * * @param the type of elements in the input stream * @param the type of elements in the output stream * * @see Stream */ public interface Generator { /** The ongoing iteration. */ static final Iteration iteration = new Iteration(); /** * Yields an element of a {@link Stream} from an element of another {@link Stream}. * * @param element the input element * @return the output element * @throws StreamSkipSignal if no element should be yielded from the input element (i.e. the element should * not contribute to the output stream) * @throws StreamStopSignal if no further element should be yielded * @throws RuntimeException if no element can be yielded from the input element */ E2 yield(E1 element) throws StreamSkipSignal,StreamStopSignal; }