de.hpi.fgis.dude.output
Class MultipleOutput

java.lang.Object
  extended by de.hpi.fgis.dude.output.MultipleOutput
All Implemented Interfaces:
DuDeOutput, AutoJsonable

public class MultipleOutput
extends Object
implements DuDeOutput

The MultipleOutput to support more than one output formats. This class aggregates multiple outputs and delegates all DuDeOutput operations to each of the aggregated DuDeOutputs.

Author:
David Sonnabend

Constructor Summary
MultipleOutput()
          The default constructor initialized the MultipleOutput.
MultipleOutput(DuDeOutput... outputs)
          The default constructor initialized the MultipleOutput.
 
Method Summary
 boolean addOutput(DuDeOutput output)
          Adds an output to the list of DuDeOutputs.
 void close()
          Closes the stream.
 MultipleOutput withData()
          Enables printing the data.
 MultipleOutput withoutData()
          Disables printing the data.
 void write(DuDeObjectPair pair)
          Writes the DuDeObjectPair onto an stream.
 void writeDuplicatesOnly(DuDeObjectPair pair)
          Writes the passed DuDeObjectPair onto the stream, if it is flagged as a duplicate.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MultipleOutput

public MultipleOutput(DuDeOutput... outputs)
The default constructor initialized the MultipleOutput.

Parameters:
outputs - The outputs that shall be added.

MultipleOutput

public MultipleOutput()
The default constructor initialized the MultipleOutput.

Method Detail

addOutput

public boolean addOutput(DuDeOutput output)
Adds an output to the list of DuDeOutputs.

Parameters:
output - The output to add.
Returns:
True if output was added successfully, false otherwise.

close

public void close()
           throws IOException
Description copied from interface: DuDeOutput
Closes the stream.

Specified by:
close in interface DuDeOutput
Throws:
IOException - If an error occurs while closing the stream.

write

public void write(DuDeObjectPair pair)
           throws IOException
Description copied from interface: DuDeOutput
Writes the DuDeObjectPair onto an stream.

Specified by:
write in interface DuDeOutput
Parameters:
pair - A pair of two DuDeObjects that are written into an OutputStream.
Throws:
IOException - If an error occurs while writing onto the stream.

writeDuplicatesOnly

public void writeDuplicatesOnly(DuDeObjectPair pair)
                         throws IOException
Description copied from interface: DuDeOutput
Writes the passed DuDeObjectPair onto the stream, if it is flagged as a duplicate.

Specified by:
writeDuplicatesOnly in interface DuDeOutput
Parameters:
pair - The pair that shall be written to the stream.
Throws:
IOException - If an error occurs while writing onto the stream.
See Also:
DuDeObjectPair.getDuplicateInfo()

withData

public MultipleOutput withData()
Description copied from interface: DuDeOutput
Enables printing the data. This means that the output does not only consist of the object ids but contains also the corresponding data.

Specified by:
withData in interface DuDeOutput
Returns:
The current instance.

withoutData

public MultipleOutput withoutData()
Description copied from interface: DuDeOutput
Disables printing the data. This means that each printed duplicate pair is only specified by their source and object ids.

Specified by:
withoutData in interface DuDeOutput
Returns:
The current instance.


Copyright © 2011 Hasso Plattner Institute - Chair of Information Systems. All Rights Reserved.