Package PamguardMVC.blockprocess
Class PamBlockProcess
java.lang.Object
PamguardMVC.PamProcess
PamguardMVC.blockprocess.PamBlockProcess
- All Implemented Interfaces:
 PamObserver,ProcessAnnotator
- Direct Known Subclasses:
 GPLProcess
Modified PamProcess which can block data for analysis in chunks rather than a continuous data stream. 
 There are two or three options with block processes and some messing about to do at PAMGuard starts and stops:
 1. Calls into parent process are separated for processing background and processing data
 2. Can also handle reverse input buffering
 3. Extra things to think about and decide upon at end of a file / run, ie. whether or not to process an incomplete block. 
 Complicated threading so a block can be simultaneously filling and emptying at the same time.  
- Author:
 - dg50
 
- 
Field Summary
Fields inherited from class PamguardMVC.PamProcess
outputDataBlocks, parentDataBlock, processName, sampleRate - 
Constructor Summary
ConstructorsConstructorDescriptionPamBlockProcess(PamControlledUnit pamControlledUnit, PamDataBlock parentDataBlock) PamBlockProcess(PamControlledUnit pamControlledUnit, PamDataBlock parentDataBlock, String processName)  - 
Method Summary
Modifier and TypeMethodDescriptionlongabsSamplesToMilliseconds(long samples) Convert am ADC sample number to a millisecond time.abstract voidaddBlockData(PamBlockDataList blockDataList) Called in sequence for data in a block so it can make background measurementsabstract voidaddSingleData(PamObservable o, PamDataUnit dataUnit) Called in sequence for data in a block so it can run detectorschannelSplitList(PamBlockDataList dataList) Split a data list into individual channels.protected voiddebugMessage(String message) abstract PamBlockParamsbooleanisLastChannel(PamObservable obs, PamDataUnit dataUnit) Is this the last channel in a group from that datablock ?final voidnewData(PamObservable o, PamDataUnit dataUnit) Override the PamProcess new data call.voidpamStart()Called for each process to tell it to start (may not be necessary for processes which are listening for data anyway).voidpamStop()Stops the process.voidreceiveSourceNotification(int type, Object object) Receive a notification from the data source - typically a change in DAQ status.reverseDataList(PamBlockDataList dataList) Reverse a data list into a new list.abstract voidsetBlockState(BlockState state) Set the block state - tell it what to expect next so that it can clean up at the start middle and end of a block of data.voidsetParentDataBlock(PamDataBlock newParentDataBlock, boolean reThread) Set a parent data block for the process with the option to rethread the data exchange process.Methods inherited from class PamguardMVC.PamProcess
absMillisecondsToSamples, addData, addMultiPlexDataBlock, addOutputDataBlock, changedThreading, clearOldData, createAnnotations, destroyProcess, dumpBufferStatus, flushDataBlockBuffers, getAncestorDataBlock, getAnnotation, getChainPosition, getCompatibleDataUnits, getCpuPercent, getFrequencyRange, getLastSourceNotificationObject, getLastSourceNotificationType, getMuiltiplexDataBlock, getNumAnnotations, getNumMuiltiplexDataBlocks, getNumOutputDataBlocks, getObserverName, getObserverObject, getOfflineData, getOfflineData, getOutputDataBlock, getOutputDataBlocks, getPamControlledUnit, getParentDataBlock, getParentDataBlocks, getParentProcess, getProcessCheck, getProcessName, getRawSourceDataBlock, getRawSourceDataBlock, getRequiredDataHistory, getSampleRate, getSourceDataBlock, getSourceProcess, hasOutputDatablock, isCanMultiThread, isExternalProcess, isMultiplex, makePamProcess, masterClockUpdate, noteNewSettings, notifyModelChanged, prepareProcess, prepareProcessOK, processNewBuoyData, relMillisecondsToSamples, relSamplesToMilliseconds, removeAllDataBlocks, removeAllMultiPlexDataBlocks, removeMultiPlexDataBlock, removeObservable, removeOutputDatablock, resetDataBlocks, saveViewerData, setCanMultiThread, setExternalProcess, setMultiplex, setParentDataBlock, setProcessCheck, setProcessName, setSampleRate, setupProcess, toString, updateData 
- 
Constructor Details
- 
PamBlockProcess
 - 
PamBlockProcess
public PamBlockProcess(PamControlledUnit pamControlledUnit, PamDataBlock parentDataBlock, String processName)  
 - 
 - 
Method Details
- 
setParentDataBlock
Description copied from class:PamProcessSet a parent data block for the process with the option to rethread the data exchange process. This is overridden to false if the main PAMGUARD option to rethread is off.- Overrides:
 setParentDataBlockin classPamProcess- Parameters:
 newParentDataBlock- source data blockreThread- rethread if multithreading is enabled.
 - 
pamStart
public void pamStart()Description copied from class:PamProcessCalled for each process to tell it to start (may not be necessary for processes which are listening for data anyway).- Specified by:
 pamStartin classPamProcess
 - 
pamStop
public void pamStop()Description copied from class:PamProcessStops the process.- Specified by:
 pamStopin classPamProcess
 - 
newData
Override the PamProcess new data call. It's here that we're going to stack up all the input data into blocks. Then pass on to two separate functions blockBackground and blockData.- Overrides:
 newDatain classPamProcess
 - 
absSamplesToMilliseconds
public long absSamplesToMilliseconds(long samples) Convert am ADC sample number to a millisecond time. This function was re-written on 11/11/08 to deal with problems of sound card clocks not running at same speed as PC clock, so milliseconds from PC clock and milliseconds based on samples would drift apart. This new system bases the calculation on the times of the most recently received data unit.- Overrides:
 absSamplesToMillisecondsin classPamProcess- Parameters:
 samples- sample number (from start of run)- Returns:
 - Millisecond time (UTC milliseconds from the epoch - the standard Java way)
 
 - 
receiveSourceNotification
Description copied from interface:PamObserverReceive a notification from the data source - typically a change in DAQ status. See the constants listed in AcquisitionProcess for potential change types.- Specified by:
 receiveSourceNotificationin interfacePamObserver- Overrides:
 receiveSourceNotificationin classPamProcess- Parameters:
 type- the type of changeobject- generic object added here so that we can include anything in the future
 - 
isLastChannel
Is this the last channel in a group from that datablock ?- Parameters:
 channelMap-- Returns:
 
 - 
getBlockParams
 - 
setBlockState
Set the block state - tell it what to expect next so that it can clean up at the start middle and end of a block of data.- Parameters:
 state-
 - 
channelSplitList
Split a data list into individual channels.- Parameters:
 dataList- data list with multiple channels of data. Assuming it's a type of data which only has one channel per data unit (e.g. raw or fft)- Returns:
 - list of data separated by channel. If channels were not continuous, then there may be some nulls.
 
 - 
reverseDataList
Reverse a data list into a new list. Swap channel orders, so channels are in correct order, but time is reversed.- Parameters:
 blockDataList-- Returns:
 
 - 
addBlockData
Called in sequence for data in a block so it can make background measurements- Parameters:
 blockDataList- blocked list of data units (possibly interleaved by channel)
 - 
addSingleData
Called in sequence for data in a block so it can run detectors- Parameters:
 o-dataUnit-
 - 
debugMessage
 
 -