Class DataWriterBase

java.lang.Object
gda.data.scan.datawriter.DataWriterBase
All Implemented Interfaces:
DataWriter, IDataWriterExtender
Direct Known Subclasses:
DatapointCompletingDataWriter, DummyDataWriter, IncrementalFile, MacDataWriter, NexusDataWriter, NexusScanDataWriter, XasAsciiNexusDataWriter

public abstract class DataWriterBase extends Object implements DataWriter, IDataWriterExtender
Base class for datahandler objects
  • Field Details

    • delimiter

      public static String delimiter
      when arrays of data written to file, this will be placed between each element
    • terminalPrinter

      protected final ITerminalPrinter terminalPrinter
  • Constructor Details

    • DataWriterBase

      public DataWriterBase()
  • Method Details

    • getDetectorData

      public static String getDetectorData(Object dataPoint, boolean isFirst)
      To help write data to a data file. If its an array, then writes out each element of the array with a delimiter mark between each.
      Parameters:
      dataPoint - An element of a vector passed from a scan object
      isFirst - if a leading delimiter should be omitted.
      Returns:
      String
    • getDetectorData

      public static String[] getDetectorData(Object dataPoint)
      Returns the parts of this element of data as a string array.
      Parameters:
      dataPoint - The element of a vector from a scan
      Returns:
      String[]
    • setHeader

      public void setHeader(ArrayList<String> header)
      Description copied from interface: DataWriter
      Sets the header of the datahandler
      Specified by:
      setHeader in interface DataWriter
      Parameters:
      header - ArrayList
    • getHeader

      public ArrayList<String> getHeader()
      Description copied from interface: DataWriter
      header is a publicly accessible string which will be written to the file (or saved to a database) during the prepareForCollection method. Before this method is called, the header object may be added to using these accessor methods.
      Specified by:
      getHeader in interface DataWriter
      Returns:
      an ArrayList containing header information
    • addData

      public void addData(IScanDataPoint newData) throws Exception
      Description copied from interface: DataWriter
      for incremental addition of data
      Specified by:
      addData in interface DataWriter
      Parameters:
      newData - Object
      Throws:
      Exception
    • addDataWriterExtender

      public void addDataWriterExtender(IDataWriterExtender dataWriterExtender)
      Description copied from interface: DataWriter
      Adds an additional IDataWriterExtender to handle DataWriter events
      Specified by:
      addDataWriterExtender in interface DataWriter
      Specified by:
      addDataWriterExtender in interface IDataWriterExtender
      Parameters:
      dataWriterExtender -
    • completeCollection

      public void completeCollection() throws Exception
      Description copied from interface: DataWriter
      Called when data collection has been completed
      Specified by:
      completeCollection in interface DataWriter
      Throws:
      Exception
    • addData

      public void addData(IDataWriterExtender parent, IScanDataPoint dataPoint) throws Exception
      Description copied from interface: IDataWriterExtender
      called by a DataWriter after it has processed addData
      Specified by:
      addData in interface IDataWriterExtender
      Parameters:
      parent -
      dataPoint -
      Throws:
      Exception
    • completeCollection

      public void completeCollection(IDataWriterExtender parent)
      Description copied from interface: IDataWriterExtender
      called by a DataWriter after it has processed completeCollection
      Specified by:
      completeCollection in interface IDataWriterExtender
      Parameters:
      parent -
    • removeDataWriterExtender

      public void removeDataWriterExtender(IDataWriterExtender dataWriterExtender)
      Description copied from interface: DataWriter
      Remove a IDataWriterExtender to handle DataWriter events.
      Specified by:
      removeDataWriterExtender in interface DataWriter
      Specified by:
      removeDataWriterExtender in interface IDataWriterExtender
      Parameters:
      dataWriterExtender -
    • configureScanNumber

      public void configureScanNumber(int scanNumber) throws Exception
      If filenumber not set then read from scandatapoint or from num tracker
      Specified by:
      configureScanNumber in interface DataWriter
      Parameters:
      scanNumber -
      Throws:
      InstantiationException
      Exception