AIS
Class AISDataBlock

java.lang.Object
  extended by PamguardMVC.PamObservable
      extended by PamguardMVC.PamDataBlock<AISDataUnit>
          extended by AIS.AISDataBlock
All Implemented Interfaces:
NMEAEmulator, PanelOverlayDraw

public class AISDataBlock
extends PamDataBlock<AISDataUnit>
implements NMEAEmulator


Field Summary
private  AISControl aisControl
           
private  long emulatorTimeOffset
           
 
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
AISDataBlock(AISControl aisControl, PamProcess parentProcess)
           
 
Method Summary
 boolean addAISData(AISDataUnit newAISUnit)
          aisDataUnit is always a new unit extracted from a group of AIS strings, but with a single lot of data.
 AISDataUnit findAISDataUnit(int mmsiNumber)
          Find and AIS unit based on it's MMSI Number.
 EmulatedData getNextData()
           
 boolean loadViewerData(long dataStart, long dataEnd)
          Instruction from the viewer scroll manager to load new data.
 boolean prepareDataSource(long[] timeLimits, long timeOffset)
          Prepare the data to be read into the emulator.
private  boolean wantData(AISDataUnit existingUnit, AISDataUnit newUnit)
           
 
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, masterClockUpdate, noteNewSettings, notifyModelChanged, orderOfflineData, orderOfflineData, remove, remove, removeOldUnitsS, removeOldUnitsT, 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
 

Field Detail

aisControl

private AISControl aisControl

emulatorTimeOffset

private long emulatorTimeOffset
Constructor Detail

AISDataBlock

public AISDataBlock(AISControl aisControl,
                    PamProcess parentProcess)
Method Detail

addAISData

public boolean addAISData(AISDataUnit newAISUnit)
aisDataUnit is always a new unit extracted from a group of AIS strings, but with a single lot of data. Depending on what type of data it was, it will contain either static or position data. If the transponder has already sent data, then update it. Otherwise, create a new unit.

Whether or not we actually want this data is a complicated question.

If there is no limitation to range, we want it.

If range is limited and the new data is a position report we want it if it's in range.

If it's static data and does not match an existing set of data we don't want it since we don't know if it's in range or not.

If it's static data and matches existing data, then we want it.

If a new unit is created, notifications are sent out automatically. otherwise, generate one to notify observers.

Parameters:
newAISUnit - new AIS data unit
Returns:
true if it's updating an old unit, false if it's a new one.

wantData

private boolean wantData(AISDataUnit existingUnit,
                         AISDataUnit newUnit)

findAISDataUnit

public AISDataUnit findAISDataUnit(int mmsiNumber)
Find and AIS unit based on it's MMSI Number. Returns the PamDataUnit rather than the AISData since that's needed in a wee while.

Parameters:
mmsiNumber -
Returns:
An existing AIS dataunit with the same mmsi number

getNextData

public EmulatedData getNextData()
Specified by:
getNextData in interface NMEAEmulator
Returns:
the next emulated data, or null if there are no more.

prepareDataSource

public boolean prepareDataSource(long[] timeLimits,
                                 long timeOffset)
Description copied from interface: NMEAEmulator
Prepare the data to be read into the emulator.

The task may be as simple as setting up an interator to go through the data already read into the datablock or it may involve setting up a new database query to get back to raw data.

Specified by:
prepareDataSource in interface NMEAEmulator
Parameters:
timeLimits - time limits for the emulation
timeOffset - time offset - between when the data were collected and the time they should be emulated at.
Returns:
true if OK

loadViewerData

public boolean loadViewerData(long dataStart,
                              long dataEnd)
Description copied from class: PamDataBlock
Instruction from the viewer scroll manager to load new data.

Overrides:
loadViewerData in class PamDataBlock<AISDataUnit>
Parameters:
dataStart - data start time in millis
dataEnd - data end time in millis.