Package org.anchoranalysis.io.generator
Class TransformingGeneratorBridge<S,T,V>
Object
TransformingGeneratorBridge<S,T,V>
- Type Parameters:
S
- generator-typeT
- exposed-iterator typeV
- hidden-iterator-type
- All Implemented Interfaces:
Generator<T>
,TransformingGenerator<T,
,S> ElementWriter<T>
public class TransformingGeneratorBridge<S,T,V>
extends Object
implements TransformingGenerator<T,S>
Allows us to call an
SingleFileTypeGenerator<V,S>
as if it was an
SingleFileTypeGenerator<T,S>
using an function to connect the two.- Author:
- Owen Feehan
-
Constructor Summary
ConstructorsConstructorDescriptionTransformingGeneratorBridge
(TransformingGenerator<V, S> delegate, CheckedFunction<T, V, ? extends Throwable> elementBridge) -
Method Summary
Modifier and TypeMethodDescriptionApplies any necessary preprocessing to create an element suitable for writing to the filesystem.void
write
(T element, OutputNameStyle outputNameStyle, ElementOutputter outputter) Writes a non-indexable output (an output that isn't part of a collection of other similar items).void
writeWithIndex
(T element, String index, IndexableOutputNameStyle outputNameStyle, ElementOutputter outputter) Writes an indexable output (many outputs of the same type, uniquely identified by an index).
-
Constructor Details
-
TransformingGeneratorBridge
public TransformingGeneratorBridge(TransformingGenerator<V, S> delegate, CheckedFunction<T, V, ? extends Throwable> elementBridge)
-
-
Method Details
-
transform
Description copied from interface:TransformingGenerator
Applies any necessary preprocessing to create an element suitable for writing to the filesystem.- Specified by:
transform
in interfaceTransformingGenerator<S,
T> - Parameters:
element
- element to be assigned and then transformed.- Returns:
- the transformed element after necessary preprocessing.
- Throws:
OutputWriteFailedException
- if anything goes wrong.
-
write
public void write(T element, OutputNameStyle outputNameStyle, ElementOutputter outputter) throws OutputWriteFailedException Description copied from interface:ElementWriter
Writes a non-indexable output (an output that isn't part of a collection of other similar items).- Specified by:
write
in interfaceElementWriter<S>
- Parameters:
element
- the element to write.outputNameStyle
- how to write output-names.outputter
- how the element is outputted.- Throws:
OutputWriteFailedException
- if the write operation fails.
-
writeWithIndex
public void writeWithIndex(T element, String index, IndexableOutputNameStyle outputNameStyle, ElementOutputter outputter) throws OutputWriteFailedException Description copied from interface:ElementWriter
Writes an indexable output (many outputs of the same type, uniquely identified by an index).- Specified by:
writeWithIndex
in interfaceElementWriter<S>
- Parameters:
element
- the element to write.index
- a string that uniquely identifies this element compared to others in the same write operation.outputNameStyle
- how to write output-names.outputter
- how the element is outputted.- Throws:
OutputWriteFailedException
- if the write operation fails.
-