package utp;

public interface IActiveGenerator<T> {
		T value() throws StopException;
		IActiveGenerator<T> next();
		
		public default T maybeValue()
		{
			try {
				return value();
			} catch (StopException e) {
				return null;
			}
		}
		
		public default boolean hasValue()
		{
			try {
				value();
				return true;
			} catch (StopException e) {
				return false;
			}
		}
		
		public default IPassiveGenerator<T> passive()
		{
			return new PassiveGenerator<T>(this);
		}
}
