clickDetector
Class ClickBinaryDataSource

java.lang.Object
  extended by binaryFileStorage.BinaryDataSource
      extended by clickDetector.ClickBinaryDataSource

public class ClickBinaryDataSource
extends BinaryDataSource


Field Summary
private  java.io.ByteArrayOutputStream bos
           
private static int bytesPerSamples
           
static int CLICK_DETECTOR_CLICK
           
private  ClickDetector clickDetector
           
private  ClickBinaryModuleFooter clickFooter
           
private  ClickMapDrawing clickMapDrawing
           
private static int currentVersion
           
private  java.io.DataOutputStream dos
           
private  java.lang.String streamName
           
 
Constructor Summary
ClickBinaryDataSource(ClickDetector clickDetector, PamDataBlock sisterDataBlock, java.lang.String streamName)
           
 
Method Summary
 byte[] getModuleFooterData()
           
 byte[] getModuleHeaderData()
           
 int getModuleVersion()
          Get a version number for the module.
 DataMapDrawing getSpecialDrawing()
          REturn a class capable of overriding the normal drawing on the data map
 java.lang.String getStreamName()
           
 int getStreamVersion()
           
private  double getWaveMax(double[][] waveData)
          get the maximum value of the wavedata.
 void newFileOpened(java.io.File outputFile)
          Called from the BinaryOutputStream whenever a new output file is opened.
 void saveData(ClickDetection cd)
          Save a click to the binary data store
 void saveData(PamDataUnit pamDataUnit)
          Save data into the binary stream
 PamDataUnit sinkData(BinaryObjectData binaryObjectData, BinaryHeader bh, int moduleVersion)
          Convert data read back in in viewer mode into the correct type of PamDataUnit.
 ModuleFooter sinkModuleFooter(BinaryObjectData binaryObjectData, BinaryHeader bh, ModuleHeader mh)
          Do something with module footer information
 ModuleHeader sinkModuleHeader(BinaryObjectData binaryObjectData, BinaryHeader bh)
          Do something with module header information
 
Methods inherited from class binaryFileStorage.BinaryDataSource
getBinaryStorageStream, getModuleName, getModuleType, getSisterDataBlock, setBinaryStorageStream, storeData
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

streamName

private java.lang.String streamName

bytesPerSamples

private static final int bytesPerSamples
See Also:
Constant Field Values

currentVersion

private static final int currentVersion
See Also:
Constant Field Values

CLICK_DETECTOR_CLICK

public static final int CLICK_DETECTOR_CLICK
See Also:
Constant Field Values

clickDetector

private ClickDetector clickDetector

clickFooter

private ClickBinaryModuleFooter clickFooter

bos

private java.io.ByteArrayOutputStream bos

dos

private java.io.DataOutputStream dos

clickMapDrawing

private ClickMapDrawing clickMapDrawing
Constructor Detail

ClickBinaryDataSource

public ClickBinaryDataSource(ClickDetector clickDetector,
                             PamDataBlock sisterDataBlock,
                             java.lang.String streamName)
Method Detail

newFileOpened

public void newFileOpened(java.io.File outputFile)
Description copied from class: BinaryDataSource
Called from the BinaryOutputStream whenever a new output file is opened.

Specified by:
newFileOpened in class BinaryDataSource
Parameters:
outputFile - file information.

getModuleVersion

public int getModuleVersion()
Description copied from class: BinaryDataSource
Get a version number for the module.

This is different to the version number in the main file header and allows individual modules to update their format and maintain backwards compatibility with old data

Specified by:
getModuleVersion in class BinaryDataSource
Returns:
integer module version number

getModuleHeaderData

public byte[] getModuleHeaderData()
Specified by:
getModuleHeaderData in class BinaryDataSource
Returns:
Additional information (e.g. a control structure for a detector) to be stored in the Module Specific Control structure

getModuleFooterData

public byte[] getModuleFooterData()
Overrides:
getModuleFooterData in class BinaryDataSource
Returns:
data for the binary footer, or null.

getStreamName

public java.lang.String getStreamName()
Specified by:
getStreamName in class BinaryDataSource
Returns:
Stream name to be stored in the file header

getStreamVersion

public int getStreamVersion()
Specified by:
getStreamVersion in class BinaryDataSource
Returns:
Stream version name to be stored in the Module Specific Control structure

saveData

public void saveData(PamDataUnit pamDataUnit)
Description copied from class: BinaryDataSource
Save data into the binary stream

Specified by:
saveData in class BinaryDataSource

saveData

public void saveData(ClickDetection cd)
Save a click to the binary data store

Parameters:
cd - click detection

sinkModuleHeader

public ModuleHeader sinkModuleHeader(BinaryObjectData binaryObjectData,
                                     BinaryHeader bh)
Description copied from class: BinaryDataSource
Do something with module header information

Specified by:
sinkModuleHeader in class BinaryDataSource
Parameters:
binaryObjectData - data for the module header.
bh - Binary header information

sinkModuleFooter

public ModuleFooter sinkModuleFooter(BinaryObjectData binaryObjectData,
                                     BinaryHeader bh,
                                     ModuleHeader mh)
Description copied from class: BinaryDataSource
Do something with module footer information

Specified by:
sinkModuleFooter in class BinaryDataSource
Parameters:
binaryObjectData - data for the module header.
bh - Binary header information

sinkData

public PamDataUnit sinkData(BinaryObjectData binaryObjectData,
                            BinaryHeader bh,
                            int moduleVersion)
Description copied from class: BinaryDataSource
Convert data read back in in viewer mode into the correct type of PamDataUnit.

DO NOT add this unit directly to the datablock, but pass it back to the calling process which will add it to the datablock if necessary.

Specified by:
sinkData in class BinaryDataSource
Parameters:
binaryObjectData - Binary data read back from a file.
bh - binary header from start of file.
Returns:
the PamDataUnit created from these data

getWaveMax

private double getWaveMax(double[][] waveData)
get the maximum value of the wavedata. Will be used for scaling.

Parameters:
waveData - wavedata 2D array
Returns:
maximum absolute value.

getSpecialDrawing

public DataMapDrawing getSpecialDrawing()
Description copied from class: BinaryDataSource
REturn a class capable of overriding the normal drawing on the data map

Overrides:
getSpecialDrawing in class BinaryDataSource
Returns:
null if nothign exists.