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.voidwrite(T element, OutputNameStyle outputNameStyle, ElementOutputter outputter) Writes a non-indexable output (an output that isn't part of a collection of other similar items).voidwriteWithIndex(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:TransformingGeneratorApplies any necessary preprocessing to create an element suitable for writing to the filesystem.- Specified by:
transformin 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:ElementWriterWrites a non-indexable output (an output that isn't part of a collection of other similar items).- Specified by:
writein 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:ElementWriterWrites an indexable output (many outputs of the same type, uniquely identified by an index).- Specified by:
writeWithIndexin 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.
-