de.hpi.fgis.dude.output.statisticoutput
Class AbstractStatisticOutput

java.lang.Object
  extended by de.hpi.fgis.dude.output.statisticoutput.AbstractStatisticOutput
All Implemented Interfaces:
StatisticOutput, AutoJsonable
Direct Known Subclasses:
CSVStatisticOutput, SimpleStatisticOutput

public abstract class AbstractStatisticOutput
extends Object
implements StatisticOutput

AbstractStatisticOuput is an abstract class that provides functionality common to most classes implementing StatisticOutput. Every concrete StatisticOutput implementation may inherit from this class instead of implementing the StatisticOutput interface itself.

Author:
Fabian Lindenberg, Uwe Draisbach

Field Summary
protected static String[] defaultLabels
          Default labels.
 
Constructor Summary
protected AbstractStatisticOutput()
          Internal constructor for Jsonable deserialization.
  AbstractStatisticOutput(StatisticComponent statsComponent)
          Initializes a AbstractStatisticOutput with the passed StatisticComponent.
 
Method Summary
abstract  void close()
          Closes the underlying stream.
 String[] getLabels()
          Returns the labels for the measurements.
protected  Map<String,String> getOptionalEntries()
          Returns all extension columns' label and value.
 StatisticComponent getStatistics()
          Returns the current statistic component that is used by the output.
 void resetOptionalStatisticEntries()
          Resets the values of all optional labels using empty Strings.
 boolean setOptionalStatisticEntry(String label)
          Sets a new optional label with no value.
 boolean setOptionalStatisticEntry(String label, String value)
          Sets a new optional label with the passed value.
 void setStatistics(StatisticComponent statistics)
          Sets the current statistic component that is used by the output.
abstract  void writeStatistics()
          Writes the stored statistics.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

defaultLabels

protected static final String[] defaultLabels
Default labels.

Constructor Detail

AbstractStatisticOutput

public AbstractStatisticOutput(StatisticComponent statsComponent)
Initializes a AbstractStatisticOutput with the passed StatisticComponent.

Parameters:
statsComponent - The StatisticComponent whose data shall be printed.

AbstractStatisticOutput

protected AbstractStatisticOutput()
Internal constructor for Jsonable deserialization.

Method Detail

writeStatistics

public abstract void writeStatistics()
                              throws IOException
Description copied from interface: StatisticOutput
Writes the stored statistics. May throw an IOException.

Specified by:
writeStatistics in interface StatisticOutput
Throws:
IOException - If an error occurs while writing to the output.

close

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

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

getLabels

public String[] getLabels()
Description copied from interface: StatisticOutput
Returns the labels for the measurements.

Specified by:
getLabels in interface StatisticOutput
Returns:
An array of Strings containing all labels that are used during the print-out.

getStatistics

public StatisticComponent getStatistics()
Description copied from interface: StatisticOutput
Returns the current statistic component that is used by the output.

Specified by:
getStatistics in interface StatisticOutput
Returns:
Current StatisticComponent.

setStatistics

public void setStatistics(StatisticComponent statistics)
Description copied from interface: StatisticOutput
Sets the current statistic component that is used by the output.

Specified by:
setStatistics in interface StatisticOutput
Parameters:
statistics - StatisticComponent that is to be set.

resetOptionalStatisticEntries

public void resetOptionalStatisticEntries()
Description copied from interface: StatisticOutput
Resets the values of all optional labels using empty Strings. The columns are not removed.

Specified by:
resetOptionalStatisticEntries in interface StatisticOutput

setOptionalStatisticEntry

public boolean setOptionalStatisticEntry(String label,
                                         String value)
Description copied from interface: StatisticOutput
Sets a new optional label with the passed value.

Specified by:
setOptionalStatisticEntry in interface StatisticOutput
Parameters:
label - The entry's identifier.
value - The entry's value.
Returns:
true, if a new statistic entry was added (no old value was overwritten); otherwise false.

setOptionalStatisticEntry

public boolean setOptionalStatisticEntry(String label)
Description copied from interface: StatisticOutput
Sets a new optional label with no value.

Specified by:
setOptionalStatisticEntry in interface StatisticOutput
Parameters:
label - The entry's identifier.
Returns:
true, if a new statistic entry was added (no old value was overwritten); otherwise false.

getOptionalEntries

protected Map<String,String> getOptionalEntries()
Returns all extension columns' label and value.

Returns:
All entries that were added for extending the default output.


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