NMEA
Class NMEADataBlock

java.lang.Object
  extended by PamguardMVC.PamObservable
      extended by PamguardMVC.PamDataBlock<NMEADataUnit>
          extended by NMEA.NMEADataBlock
All Implemented Interfaces:
PanelOverlayDraw

public class NMEADataBlock
extends PamDataBlock<NMEADataUnit>

Special type of data block, just for NMEA data. Instead of deleting data on a timer or owing to the wishes of subscribers, it keeps exactly one copy of each NMEA sentence.

Author:
Doug Gillespie
See Also:
PamDataBlock

Field Summary
 
Fields inherited from class PamguardMVC.PamDataBlock
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, unitsAdded, unitsRemoved, unitsUpdated
 
Fields inherited from class PamguardMVC.PamObservable
masterClockSample, objectChanged, overlayDraw, pamObservers, pamProfiler
 
Constructor Summary
NMEADataBlock(java.lang.String dataName, PamProcess parentProcess, int channelMap)
           
 
Method Summary
 void addPamData(NMEADataUnit pamDataUnit)
          Adds a new PamDataUnit to the PamDataBlock.
static java.lang.String getSubString(java.lang.StringBuffer stringBuffer, int pos)
           
static boolean isNmeaStartCharacter(char ch)
           
protected  int removeOldUnitsT(long currentTimeMS)
          Removes olderPamDataUnits from memory, starting at the first unit and continuing until if finds one with data coming earlier than the given time in milliseconds.
private  void replaceOldString(int pos, NMEADataUnit pamDataUnit)
           
static NMEABitArray six2eight(java.lang.String charData, int fillBits)
           
 
Methods inherited from class PamguardMVC.PamDataBlock
addLocalisationContents, addObserver, addObserver, addOfflineDataMap, 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, notifyModelChanged, 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

NMEADataBlock

public NMEADataBlock(java.lang.String dataName,
                     PamProcess parentProcess,
                     int channelMap)
Method Detail

addPamData

public void addPamData(NMEADataUnit pamDataUnit)
Description copied from class: PamDataBlock
Adds a new PamDataUnit to the PamDataBlock. When the data unit is added, PamObservers that have subscribed to the block will be notified.

Overrides:
addPamData in class PamDataBlock<NMEADataUnit>
Parameters:
pamDataUnit - Reference to a PamDataUnit

isNmeaStartCharacter

public static boolean isNmeaStartCharacter(char ch)

getSubString

public static java.lang.String getSubString(java.lang.StringBuffer stringBuffer,
                                            int pos)

replaceOldString

private void replaceOldString(int pos,
                              NMEADataUnit pamDataUnit)

six2eight

public static NMEABitArray six2eight(java.lang.String charData,
                                     int fillBits)

removeOldUnitsT

protected int removeOldUnitsT(long currentTimeMS)
Description copied from class: PamDataBlock
Removes olderPamDataUnits from memory, starting at the first unit and continuing until if finds one with data coming earlier than the given time in milliseconds.

If the data are acoustic, it tries to find the data source and looks to see how much data has been placed in the source data unit and does the calculation in samples.

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