PamguardMVC
Class PamRawDataBlock

java.lang.Object
  extended by PamguardMVC.PamObservable
      extended by PamguardMVC.PamDataBlock<Tunit>
          extended by PamguardMVC.AcousticDataBlock<RawDataUnit>
              extended by PamguardMVC.PamRawDataBlock
All Implemented Interfaces:
PanelOverlayDraw
Direct Known Subclasses:
AmplifiedDataBlock, ClickTriggerFunctionDataBlock, PatchPanelDataBlock

public class PamRawDataBlock
extends AcousticDataBlock<RawDataUnit>

Extension of RecyclingDataBlock that is used for Raw audio data.

Has the extra function for getting raw data samples out of the blocks. Also has some special constructors that set the parent and source data blocks to null. However, Raw data my be poduced by intermediate processes as well, in which case parent and source blocks will not be null

Author:
Doug Gillespie

Nested Class Summary
 
Nested classes/interfaces inherited from class PamguardMVC.PamDataBlock
PamDataBlock.OrderData
 
Field Summary
 
Fields inherited from class PamguardMVC.PamDataBlock
channelMap, dataName, ITERATOR_END, MATCH_AFTER, MATCH_BEFORE, MATCH_EXACT, MIX_DONOTHING, MIX_INTODATABASE, MIX_OUTOFDATABASE, naturalLifetime, NOTIFY_NEW_DATA, NOTIFY_UPDATE_DATA, OFFLINE_DATA_CANCEL, OFFLINE_DATA_INTERRUPT, OFFLINE_DATA_WAIT, orderLock, pamDataUnits, parentProcess, POSITION_AFTER, POSITION_BEFORE, REFERENCE_ABSOLUTE, REFERENCE_CURRENT, REQUEST_DATA_LOADED, REQUEST_DATA_PARTIAL_LOAD, REQUEST_EXCEPTION, REQUEST_INTERRUPTED, REQUEST_NO_DATA, REQUEST_SAME_REQUEST, t, unitsAdded, unitsRemoved, unitsUpdated
 
Fields inherited from class PamguardMVC.PamObservable
masterClockSample, objectChanged, overlayDraw, pamObservers, pamProfiler, totalCalls
 
Constructor Summary
  PamRawDataBlock(java.lang.String name, PamProcess parentProcess, int channelMap, float sampleRate)
           
protected PamRawDataBlock(java.lang.String name, PamProcess parentProcess, int channelMap, float sampleRate, boolean autoDisplay)
           
 
Method Summary
private  boolean checkIntegrity()
          Check the data block integrity - that is that all units are in order and that the sample numbers increase correctly.
 ChannelListManager getChannelListManager()
           
 double[][] getSamples(long startSample, int duration, int channelMap)
          Creates an array and fills it with raw data samples.
 double[][] getSamples(long startSample, int duration, int channelMap, double[][] wavData)
          Gets samples of raw data into a pre existing array.
private  boolean getTheSamples(long startSample, int duration, int channelMap, double[][] waveData)
          Does the work for the above two functions.
protected  int removeOldUnitsT(long currentTimeMS)
          Keep a record of the last sample added.
private  void reportProblem(int nErrors, int index, java.lang.String str, RawDataUnit unit)
           
 
Methods inherited from class PamguardMVC.AcousticDataBlock
findParentSource, getParentSourceData, notifyModelChanged, prepareAmplitudeCalculations, prepareChannelLists
 
Methods inherited from class PamguardMVC.PamDataBlock
addLocalisationContents, addObserver, addObserver, addOfflineDataMap, addPamData, autoSetDataBlockMixMode, clearAll, clearDeletedList, createAnnotations, createAnnotations, dumpBlockContents, findAnnotation, findAnnotation, findByDatabaseIndex, findDataUnit, findDataUnit, getAbsoluteDataUnit, getAnnotations, getBinaryDataSource, getCanLog, getChannelMap, getClosestUnitMillis, getCurrentViewDataEnd, getCurrentViewDataStart, getDataGain, getDataName, getDataUnit, getFirstUnit, getFirstUnitAfter, getLastUnit, getListIterator, getListIterator, getListIteratorFromEnd, getListIteratorFromStart, getLocalisationContents, getLogging, getLoggingName, getLongDataName, getMixedDirection, getNaturalLifetime, getNaturalLifetimeMillis, getNextDataStart, getNumOfflineDataMaps, getOfflineData, getOfflineData, getOfflineDataMap, getOfflineDataMap, getOrderStatus, getParentProcess, getPreceedingUnit, getPreceedingUnit, getPreceedingUnit, getPreceedingUnit, getPrevDataEnd, getPrimaryDataMap, getRawSourceDataBlock, getRecycledUnit, getRecyclingStoreLength, getRemovedItems, getSampleRate, getSaveRequirements, getShouldLog, getSourceDataBlock, getSourceProcess, getUnitClass, getUnitIndex, getUnitsCount, getUnitsCountFromTime, isLinkGpsData, isRecycling, loadViewerData, masterClockUpdate, noteNewSettings, orderOfflineData, orderOfflineData, remove, remove, removeOldUnitsS, saveViewerData, setBinaryDataSource, setChannelMap, setDataName, setLinkGpsData, setLocalisationContents, SetLogging, setMixedDirection, setNaturalLifetime, setNaturalLifetimeMillis, setRecycling, setRecyclingStoreLength, setSampleRate, setShouldLog, shouldNotify, toString, updatePamData
 
Methods inherited from class PamguardMVC.PamObservable
canDraw, clearchanged, countObservers, createKeyItem, deleteObserver, deleteObservers, drawDataUnit, findThreadedObserver, getCPUPercent, getCPUPercent, getHoverText, getLongestObserver, getPamObservers, getRequiredHistory, notifyObservers, notifyObservers, setChanged, setOverlayDraw, waitForThreadedObservers
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

PamRawDataBlock

public PamRawDataBlock(java.lang.String name,
                       PamProcess parentProcess,
                       int channelMap,
                       float sampleRate)

PamRawDataBlock

protected PamRawDataBlock(java.lang.String name,
                          PamProcess parentProcess,
                          int channelMap,
                          float sampleRate,
                          boolean autoDisplay)
Method Detail

removeOldUnitsT

protected int removeOldUnitsT(long currentTimeMS)
Keep a record of the last sample added.

Overrides:
removeOldUnitsT in class PamDataBlock<RawDataUnit>
Parameters:
currentTimeMS - Time in milliseconds of the first data which must be kept
Returns:
the number of units removed

checkIntegrity

private boolean checkIntegrity()
Check the data block integrity - that is that all units are in order and that the sample numbers increase correctly.

Returns:

reportProblem

private void reportProblem(int nErrors,
                           int index,
                           java.lang.String str,
                           RawDataUnit unit)

getSamples

public double[][] getSamples(long startSample,
                             int duration,
                             int channelMap)
Creates an array and fills it with raw data samples.

Parameters:
startSample -
duration -
channelMap -
Returns:
double array of raw data

getSamples

public double[][] getSamples(long startSample,
                             int duration,
                             int channelMap,
                             double[][] wavData)
Gets samples of raw data into a pre existing array. If the array is the wrong size or does not exist, then a new one is created.

Parameters:
startSample -
duration -
channelMap -
wavData -
Returns:
double array of raw data

getTheSamples

private boolean getTheSamples(long startSample,
                              int duration,
                              int channelMap,
                              double[][] waveData)
Does the work for the above two functions.

Parameters:
startSample -
duration -
channelMap -
waveData -
Returns:
copies data into a double array, taking if from multiple raw datablocks if necessary

getChannelListManager

public ChannelListManager getChannelListManager()
Overrides:
getChannelListManager in class AcousticDataBlock<RawDataUnit>