Class Log

java.lang.Object
dataAnalysis.Log
All Implemented Interfaces:
AutoCloseable

public class Log extends Object implements AutoCloseable
This class creates a file with a getLog of strings. Do not worry about performance, it uses a buffered writer. Remember to close the Log!
Author:
federico
  • Constructor Summary

    Constructors
    Constructor
    Description
    Log(String logName)
    Creates a new instance of Log
    Log(String logName, int bufDim)
    Creates a new instance of Log
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    it closes the getLog.
    void
    writes a comment in the getLog file with the standard Matlab format %
    void
    write(double newSample)
    writes a a double in a new line: it is very useful to write logs in matlab format.
    void
    writes a string in the getLog file

    Methods inherited from class Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • Log

      public Log(String logName)
      Creates a new instance of Log
      Parameters:
      logName - name of getLog file
    • Log

      public Log(String logName, int bufDim)
      Creates a new instance of Log
      Parameters:
      logName - name of getLog file
      bufDim - dimension of buffer of chars
  • Method Details

    • write

      public void write(double newSample)
      writes a a double in a new line: it is very useful to write logs in matlab format. you can add comments with write(String str), if the text is preceded by %.
      Parameters:
      newSample - the new sample to be written
    • write

      public void write(String str)
      writes a string in the getLog file
      Parameters:
      str - the string
    • comment

      public void comment(String com)
      writes a comment in the getLog file with the standard Matlab format %
      Parameters:
      com - the comment
    • close

      public void close()
      it closes the getLog. Important you must close the getLog before closing the application, otherwise the file of getLog will be void.
      Specified by:
      close in interface AutoCloseable