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

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

public class SimpleStatisticOutput
extends AbstractStatisticOutput
implements Jsonable

SimpleStatisticOutput prints the statistics in a simple, formatted fashion. It is preferably used for console output.

Author:
Fabian Lindenberg, Uwe Draisbach, Cindy Faehnrich

Field Summary
 
Fields inherited from class de.hpi.fgis.dude.output.statisticoutput.AbstractStatisticOutput
defaultLabels
 
Constructor Summary
protected SimpleStatisticOutput()
          Internal constructor for Jsonable deserialization.
  SimpleStatisticOutput(File out)
          Initializes a SimpleStatisticOutput with no statistics.
  SimpleStatisticOutput(File out, StatisticComponent statistics)
          Initializes the SimpleStatisticOutput.
  SimpleStatisticOutput(OutputStream out)
          Initializes a SimpleStatisticOutput with no statistics.
  SimpleStatisticOutput(OutputStream out, StatisticComponent statistics)
          Initializes the SimpleStatisticOutput.
 
Method Summary
 void close()
          Closes the underlying stream.
 boolean equals(Object obj)
           
 void fromJson(DuDeJsonParser<?> jsonParser)
          Initializes the current instance using the passed DuDeJsonParser.
 int hashCode()
           
static void main(String[] args)
           
 void toJson(DuDeJsonGenerator jsonGenerator)
          Generates the Json code using the passed DuDeJsonGenerator.
 String toString()
           
 void writeStatistics()
          Writes the stored statistics.
 
Methods inherited from class de.hpi.fgis.dude.output.statisticoutput.AbstractStatisticOutput
getLabels, getOptionalEntries, getStatistics, resetOptionalStatisticEntries, setOptionalStatisticEntry, setOptionalStatisticEntry, setStatistics
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

SimpleStatisticOutput

protected SimpleStatisticOutput()
Internal constructor for Jsonable deserialization.


SimpleStatisticOutput

public SimpleStatisticOutput(File out)
                      throws FileNotFoundException
Initializes a SimpleStatisticOutput with no statistics. The statistics need to be set later on.

Parameters:
out - The output stream that is used for the output.
Throws:
FileNotFoundException - If the given file object does not denote an existing, writable regular file and a new regular file of that name cannot be created, or if some other error occurs while opening or creating the file

SimpleStatisticOutput

public SimpleStatisticOutput(File out,
                             StatisticComponent statistics)
                      throws FileNotFoundException
Initializes the SimpleStatisticOutput.

Parameters:
out - The file that is used for the output.
statistics - The StatisticComponent instance that provides all the statistics.
Throws:
FileNotFoundException - If the given file object does not denote an existing, writable regular file and a new regular file of that name cannot be created, or if some other error occurs while opening or creating the file

SimpleStatisticOutput

public SimpleStatisticOutput(OutputStream out)
Initializes a SimpleStatisticOutput with no statistics. The statistics need to be set later on.

Parameters:
out - The output stream that is used for the output.

SimpleStatisticOutput

public SimpleStatisticOutput(OutputStream out,
                             StatisticComponent statistics)
Initializes the SimpleStatisticOutput.

Parameters:
out - The file that is used for the output.
statistics - The StatisticComponent instance that provides all the statistics.
Method Detail

main

public static void main(String[] args)
Parameters:
args -

close

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

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

equals

public boolean equals(Object obj)
Overrides:
equals in class Object

fromJson

public void fromJson(DuDeJsonParser<?> jsonParser)
              throws org.codehaus.jackson.JsonParseException,
                     IOException
Description copied from interface: Jsonable
Initializes the current instance using the passed DuDeJsonParser.

Specified by:
fromJson in interface Jsonable
Parameters:
jsonParser - The parser that is used for extracting the data out of the Json.
Throws:
org.codehaus.jackson.JsonParseException - If an error occurs while parsing the Json.
IOException - If an error occurs while reading from the stream.

hashCode

public int hashCode()
Overrides:
hashCode in class Object

toJson

public void toJson(DuDeJsonGenerator jsonGenerator)
            throws org.codehaus.jackson.JsonGenerationException,
                   IOException
Description copied from interface: Jsonable
Generates the Json code using the passed DuDeJsonGenerator.

Specified by:
toJson in interface Jsonable
Parameters:
jsonGenerator - The DuDeJsonGenerator that is used internally.
Throws:
org.codehaus.jackson.JsonGenerationException - If an error occurs while generating the Json syntax.
IOException - If an error occurs while writing to the output.

toString

public String toString()
Overrides:
toString in class Object

writeStatistics

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

Specified by:
writeStatistics in interface StatisticOutput
Specified by:
writeStatistics in class AbstractStatisticOutput


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