T
- element-type in generatorpublic class OutputSequenceIncrementing<T> extends Object implements OutputSequence
Constructor and Description |
---|
OutputSequenceIncrementing(BoundOutputter<T> parameters) |
Modifier and Type | Method and Description |
---|---|
void |
add(T element)
Outputs an additional element in the sequence.
|
CheckedRunnable<OutputWriteFailedException> |
addAsynchronously(T element)
Like
add(Object) but does not immediately execute the underlying add operation,
instead returning an operation that can be called later. |
boolean |
isOn() |
Optional<RecordingWriters> |
writers() |
public OutputSequenceIncrementing(BoundOutputter<T> parameters) throws OutputWriteFailedException
OutputWriteFailedException
public void add(T element) throws OutputWriteFailedException
This method is thread-safe.
element
- the element to add.OutputWriteFailedException
- if the output cannot be successfully written.public CheckedRunnable<OutputWriteFailedException> addAsynchronously(T element) throws OutputWriteFailedException
add(Object)
but does not immediately execute the underlying add operation,
instead returning an operation that can be called later.
This is useful for separating the sequential (and therefore not thread-safe, and must be synchronized) from the actual write operation (which must not be synchronized, and is usually more expensive).
This method is thread-safe.
element
- the element to add.OutputWriteFailedException
- if the output cannot be successfully written.public boolean isOn()
isOn
in interface OutputSequence
public Optional<RecordingWriters> writers()
writers
in interface OutputSequence
Copyright © 2010–2023 Owen Feehan, ETH Zurich, University of Zurich, Hoffmann-La Roche. All rights reserved.