public class PamDataBlock<Tunit extends PamDataUnit> extends PamObservable
PamDataBlocks manage the data from PamProcesses.
New data, either from external sources (sound cards, GPS, etc.) or detector output (clicks or whistles, etc.) are placed in PamDataUnits. The job of a PamDataBlock is to manage those PamDataUnits.
Processes that require the data from a PamDataBlock must implement PamObserver and subscribe as listeners to the PamDataBlock. When a new PamDataUnit is added to a data block, all listeners will be notified and sent references both to the data block and the data unit.
Each PamDatablock is also responsible for deleting old data. Since only the observers of PamDataBlocks know how much historical data is required, before deleting any data each PamDataBlock asks all the PamObservers for their required data history in milliseconds and takes the maximum value returned by all observers. The PamDataBlock will then calculate the time of the first required data unit and delete all preceding units. This operation takes place approximately once per second.
For example, a whistle detector, while searching for whistles, may only require the last two or three data units from the data block containing FFT data, but when it's found a complete whistle, it may need to go back and look at the FFT data from other channels in order to calculate a location, or it may require the raw data in order to look at the original waveform. As another example, the map panel may want to hold several hours of data in memory for display purposes.
It is essential that PamProcesses are realistic about how much data they can ask a PamDataBlock to hold - if they consistently ask for too much data to be stored, the computer will run out of memory.
PamDataUnit
,
PamProcess
Modifier and Type | Field and Description |
---|---|
static int |
ITERATOR_END |
static int |
MATCH_AFTER
If there is not exact time match, set the iterator so that the
first element it returns will be the element after the requested time.
|
static int |
MATCH_BEFORE
If there is not exact time match, set the iterator so that the
first element it returns will be the element before the requested time.
|
static int |
MATCH_EXACT
Only accept an iterator for a unit that matches the time exactly
|
static int |
MIX_DONOTHING |
static int |
MIX_INTODATABASE |
static int |
MIX_OUTOFDATABASE |
static int |
NOTIFY_NEW_DATA |
static int |
NOTIFY_UPDATE_DATA |
static int |
OFFLINE_DATA_CANCEL |
static int |
OFFLINE_DATA_INTERRUPT |
static int |
OFFLINE_DATA_WAIT |
java.lang.Object |
orderLock |
static int |
POSITION_AFTER
Set the iterator so that a call to next() will give the first wanted element
|
static int |
POSITION_BEFORE
Set the iterator so that a call to previous() will give the first wanted element
|
static int |
REFERENCE_ABSOLUTE
When getting a DataUnit from the Datablock, get the absolute data unit,
i.e.
|
static int |
REFERENCE_CURRENT
When getting a DataUnit from the Datablock, get the current data unit,
i.e.
|
static int |
REQUEST_DATA_LOADED
Data loaded for requested time period.
|
static int |
REQUEST_DATA_PARTIAL_LOAD
Data partially loaded for requested time period
|
static int |
REQUEST_EXCEPTION
The request threw an exception of some sort.
|
static int |
REQUEST_INTERRUPTED
The request was interrupted (in multi thread load)
|
static int |
REQUEST_NO_DATA
No data available for offline loading.
|
static int |
REQUEST_SAME_REQUEST
this is exactly the same data as requested last time.
|
Constructor and Description |
---|
PamDataBlock(java.lang.Class unitClass,
java.lang.String dataName,
PamProcess parentProcess,
int channelMap)
PamDataBlock constructor.
|
Modifier and Type | Method and Description |
---|---|
void |
addDataAnnotationType(DataAnnotationType dataAnnotationType)
Add a data annotation type to a datablock.
|
void |
addLocalisationContents(int localisationContents) |
void |
addObserver(PamObserver o)
Adds a PamObserver, which will then receive notifications when data is
added.
|
void |
addObserver(PamObserver o,
boolean reThread) |
void |
addOfflineDataMap(OfflineDataMap offlineDataMap)
Adds a new offline datamap to the data block
|
void |
addPamData(Tunit pamDataUnit)
Adds a new PamDataUnit to the PamDataBlock.
|
void |
autoSetDataBlockMixMode() |
void |
cancelDataOrder() |
void |
clearAll()
Clears all PamDataUnits from memory
|
void |
clearChannelIterators() |
void |
clearDeletedList() |
int |
createProcessAnnotations(PamDataBlock sourceData,
ProcessAnnotator newAnnotations)
Copies all annotations over from the source DataBlock, then adds in the new ones
from the new datablock.
|
int |
createProcessAnnotations(PamDataBlock sourceData,
ProcessAnnotator newAnnotations,
boolean notifyDownstream)
Copies all annotations over from the source DataBlock, then adds in the new ones
from the new datablock.
|
void |
dumpBlockContents() |
ProcessAnnotation |
findAnnotation(ProcessAnnotation template)
Finds an annotation with the same type and name as the template annotation
|
ProcessAnnotation |
findAnnotation(java.lang.String type,
java.lang.String name)
Finds an annotation with the given type and name
|
Tunit |
findByDatabaseIndex(int databaseIndex)
Find a dataunit based on it's database index.
|
Tunit |
findDataUnit(long timeMS,
int channels)
Find a data unit.
|
Tunit |
findDataUnit(long timeMS,
int channels,
int absStartPos)
Find a unit that starts at a specific time.
|
java.util.ArrayList<Tunit> |
findUnitsinInterval(long startTime,
long endTime)
Find a group of data units within a time window.
|
BinaryDataSource |
getBinaryDataSource() |
boolean |
getCanLog() |
ChannelIterator<Tunit> |
getChannelIterator(int channelMap,
int whereFrom)
Get an iterator which can iterator through only data units with data from particular
channels in a databock.
|
int |
getChannelIteratorCount()
Get the number of stored channel iterators for a datablock.
|
int |
getChannelMap() |
Tunit |
getClosestUnitMillis(long startTime)
Find the closest data unit to a given time.
|
Tunit |
getClosestUnitMillis(long startTime,
int channelMap)
Find the closest data unit to a given time.
|
long |
getCurrentViewDataEnd() |
long |
getCurrentViewDataStart() |
DataAnnotationType |
getDataAnnotationType(int index) |
double |
getDataGain(int iChan)
Return the gain applied to any data created into this
datablock.
|
OfflineDataMap |
getDatagrammedMap()
Get a data map which has a datagram
|
DatagramProvider |
getDatagramProvider() |
java.lang.String |
getDataName() |
DataSelectorCreator |
getDataSelectCreator() |
DataSelector |
getDataSelector(java.lang.String selectorName,
boolean allowScores)
Convenience method to save programmer from having to call into
the creator all the time.
|
Tunit |
getDataUnit(int ref,
int refType)
Gets a reference to a data unit.
|
Tunit |
getFirstUnit()
Gets the first data unit stored
|
Tunit |
getFirstUnit(int channelMap)
Get the first unit for a specific channel map (any match of channels allowed).
|
Tunit |
getFirstUnitAfter(long timems)
Return the first DataUnit that is on or after
the given time
|
Tunit |
getLastUnit()
Gets the last data unit stored
|
Tunit |
getLastUnit(int channelMap)
Get the last unit for a specific channel map (any match of channels allowed).
|
java.util.ListIterator<Tunit> |
getListIterator(int whereFrom) |
java.util.ListIterator<Tunit> |
getListIterator(long startTimeMillis,
int channels,
int match,
int position) |
java.util.ListIterator<Tunit> |
getListIteratorFromEnd(long startTime,
int channels,
int match,
int position) |
java.util.ListIterator<Tunit> |
getListIteratorFromStart(long startTime,
int channels,
int match,
int position) |
int |
getLocalisationContents() |
SQLLogging |
getLogging() |
java.lang.String |
getLoggingName() |
java.lang.String |
getLongDataName() |
int |
getMixedDirection() |
int |
getNaturalLifetime() |
int |
getNaturalLifetimeMillis() |
long |
getNextDataStart(long timeMillis)
Get the next data start point.
|
Tunit |
getNextUnit(java.util.ListIterator<Tunit> listIterator,
long startTime,
int channelMap)
Finds the data unit after the given start time that has the same channel map.
|
Tunit |
getNextUnit(long startTime,
int channelMap)
Simple function to find the data unit at or following the given
start time that has a given channel bitmap
|
int |
getNumDataAnnotationTypes() |
int |
getNumOfflineDataMaps() |
int |
getNumRequiredBeforeLoadTime()
Get the number of pam data units that are required prior to the load times
that get sent to loadViewerData.
|
int |
getOfflineData(PamObserver observer,
PamObserver endUser,
long startMillis,
long endMillis,
boolean allowRepeats,
RequestCancellationObject cancellationObject)
Gets data for offline display, playback, etc.
|
OfflineDataMap |
getOfflineDataMap(int iMap) |
OfflineDataMap |
getOfflineDataMap(OfflineDataStore dataSource) |
boolean |
getOrderStatus() |
PamProcess |
getParentProcess() |
Tunit |
getPreceedingUnit(java.util.ListIterator<Tunit> listIterator,
long startTime)
Finds the data unit before the given start time.
|
Tunit |
getPreceedingUnit(java.util.ListIterator<Tunit> listIterator,
long startTime,
int channelMap)
Finds the data unit before the given start time that has the same channel map.
|
Tunit |
getPreceedingUnit(long startTime)
Simple function to find the data unit at or before the given
start time.
|
Tunit |
getPreceedingUnit(long startTime,
int channelMap)
Simple function to find the data unit at or before the given
start time that has a given channel bitmap
|
long |
getPrevDataEnd(long timeMillis)
Get the previous data end point.
|
OfflineDataMap |
getPrimaryDataMap()
New plan - always use the binary store if it has any data at all.
|
java.util.Vector<ProcessAnnotation> |
getProcessAnnotations() |
int |
getQuickId()
Quick integer datablock id which is based on the dataname
|
PamRawDataBlock |
getRawSourceDataBlock() |
PamRawDataBlock |
getRawSourceDataBlock2()
Tries to find the raw data block source of the current data block.
|
Tunit |
getRecycledUnit()
Gets a recycled data unit if one is available.
|
int |
getRecyclingStoreLength() |
java.util.List<Tunit> |
getRemovedItems() |
ReverseChannelIterator<Tunit> |
getReverseChannelIterator(int channelMap)
Get an iterator which can go backwards through a datablock, but only selects
dataunits that have a channel map that overlaps with channelMap.
|
float |
getSampleRate() |
SaveRequirements |
getSaveRequirements(OfflineDataStore dataStore)
Work out some basic information about the elements that need saving from these data.
|
boolean |
getShouldBinary(PamDataUnit pamDataUnit)
Get flag to say whether data should be stored in the binary store
|
boolean |
getShouldLog(PamDataUnit pamDataUnit)
Should log the data unit to the database ?
|
PamDataBlock |
getSourceDataBlock() |
PamProcess |
getSourceProcess() |
java.lang.Class |
getUnitClass() |
int |
getUnitIndex(Tunit dataUnit) |
int |
getUnitsCount() |
int |
getUnitsCountFromTime(long countStart) |
boolean |
isCanClipGenerate() |
boolean |
isClearAtStart()
Flag to say that data should be cleared every time
PAMGuard starts.
|
boolean |
isLinkGpsData() |
boolean |
isRecycling() |
boolean |
loadViewerData(long dataStart,
long dataEnd,
ViewLoadObserver loadObserver)
Instruction from the viewer scroll manager to load new data.
|
void |
masterClockUpdate(long milliSeconds,
long clockSample) |
void |
noteNewSettings()
Tell all observers of this datablock that some
control parameters have changed.
|
void |
notifyModelChanged(int changeType)
Receive notifications from the main PamController.
|
void |
orderOfflineData(PamObserver dataObserver,
LoadObserver loadObserver,
long startMillis,
long endMillis,
int interrupt)
Similar functionality to getOfflineData, but this will launch a separate worker thread to
do the actual work getting the data.
|
void |
orderOfflineData(PamObserver dataObserver,
LoadObserver loadObserver,
long startMillis,
long endMillis,
int interrupt,
boolean allowRepeats)
Similar functionality to getOfflineData, but this will launch a separate worker thread to
do the actual work getting the data.
|
void |
remove() |
boolean |
remove(Tunit aDataUnit) |
void |
removeOfflineDataMap(OfflineDataStore dataSource)
remove a no longer needed offline data map.
|
void |
reset()
Reset a datablock.
|
boolean |
saveViewerData()
Saves data in this data block in offline viewer mode.
|
void |
setBinaryDataSource(BinaryDataSource binaryDataSource) |
void |
setCanClipGenerate(boolean canClipGenerate) |
void |
setChannelMap(int channelMap) |
void |
setClearAtStart(boolean clearAtStart)
Flag to say that data should be cleared every time
PAMGuard starts.
|
void |
setDatagramProvider(DatagramProvider datagramProvider) |
void |
setDataName(java.lang.String dataName) |
void |
setLinkGpsData(boolean linkGpsData) |
void |
setLocalisationContents(int localisationContents) |
void |
SetLogging(SQLLogging logging) |
void |
setMixedDirection(int mixedDirection) |
void |
setNaturalLifetime(int naturalLifetime)
Set the natural lifetime of the data if there are no observers asking to
keep it for longer
|
void |
setNaturalLifetimeMillis(int naturalLifetime) |
void |
setRecordingTrigger(RecorderTrigger recorderTrigger) |
void |
setRecycling(boolean recycling) |
void |
setRecyclingStoreLength(int recyclingStoreLength) |
void |
setSampleRate(float sampleRate,
boolean notify)
Sets the sample rate for the block (e.g.
|
void |
setShouldBinary(boolean shouldBinary)
Set flag to say if data should be stored in the binary store.
|
void |
setShouldLog(boolean shouldLog)
Set if data should be logged to the database.
|
boolean |
shouldNotify() |
void |
sortData()
Sorts all the data units in the data block in order of time (unless a
a data unit class choses to overwrite the compareTo function.
|
java.lang.String |
toString() |
void |
updatePamData(Tunit pamDataUnit,
long updateTimeMillis)
update a dataunit.
|
canDraw, clearchanged, countObservers, createKeyItem, deleteObserver, deleteObservers, drawDataUnit, findThreadedObserver, getCPUPercent, getCPUPercent, getHoverText, getLongestObserver, getPamObservers, getRequiredHistory, hasOptionsDialog, notifyObservers, notifyObservers, setChanged, setOverlayDraw, showOptions, waitForThreadedObservers
public static final int REFERENCE_ABSOLUTE
public static final int REFERENCE_CURRENT
public static final int MIX_DONOTHING
public static final int MIX_OUTOFDATABASE
public static final int MIX_INTODATABASE
public static final int REQUEST_NO_DATA
public static final int REQUEST_DATA_LOADED
public static final int REQUEST_DATA_PARTIAL_LOAD
public static final int REQUEST_SAME_REQUEST
This flag will be used with one of the other three.
public static final int REQUEST_INTERRUPTED
public static final int REQUEST_EXCEPTION
public static final int NOTIFY_NEW_DATA
public static final int NOTIFY_UPDATE_DATA
public static final int ITERATOR_END
public static final int MATCH_EXACT
public static final int MATCH_BEFORE
public static final int MATCH_AFTER
public static final int POSITION_BEFORE
public static final int POSITION_AFTER
public static final int OFFLINE_DATA_INTERRUPT
public static final int OFFLINE_DATA_WAIT
public static final int OFFLINE_DATA_CANCEL
public java.lang.Object orderLock
public PamDataBlock(java.lang.Class unitClass, java.lang.String dataName, PamProcess parentProcess, int channelMap)
unitClass
- class of data unit to hold in this data blockdataName
- name of data blockparentProcess
- parent PamProcesschannelMap
- bitmap of channels which may be represented in data units in this data block.public void remove()
public int getUnitsCount()
public int getUnitsCountFromTime(long countStart)
public java.util.List<Tunit> getRemovedItems()
public Tunit getFirstUnitAfter(long timems)
timems
- Milliseconds - UTC in standard Java epochpublic Tunit findDataUnit(long timeMS, int channels, int absStartPos)
timeMS
- start time of data unitchannels
- channel bitmap of data unit, or 0 for any data unitabsStartPos
- start position for search, -1 if you
want to start searching backwards from the end.public ReverseChannelIterator<Tunit> getReverseChannelIterator(int channelMap)
channelMap
- channel map for searchpublic Tunit findDataUnit(long timeMS, int channels)
timeMS
- start time of PamDataUnitchannels
- channel bitmap of PamDataUnitpublic int getUnitIndex(Tunit dataUnit)
public Tunit findByDatabaseIndex(int databaseIndex)
databaseIndex
- Index to search for.public java.util.ArrayList<Tunit> findUnitsinInterval(long startTime, long endTime)
startTime
- time to search from in millisendTime
- time to search to in millispublic void clearAll()
In viewer mode, data are also re-saved.
public void reset()
public long getCurrentViewDataStart()
public long getCurrentViewDataEnd()
public boolean loadViewerData(long dataStart, long dataEnd, ViewLoadObserver loadObserver)
dataStart
- data start time in millisdataEnd
- data end time in millis.public boolean saveViewerData()
public int getNumRequiredBeforeLoadTime()
public void addPamData(Tunit pamDataUnit)
pamDataUnit
- Reference to a PamDataUnitpublic void updatePamData(Tunit pamDataUnit, long updateTimeMillis)
pamDataUnit
- updateTimeMillis
- public boolean shouldNotify()
public boolean remove(Tunit aDataUnit)
public Tunit getRecycledUnit()
public PamDataBlock getSourceDataBlock()
public Tunit getDataUnit(int ref, int refType)
ref
- number of the data unitrefType
- REFERENCE_ABSOLUTE or REFERENCE_CURRENTpublic Tunit getLastUnit()
public Tunit getLastUnit(int channelMap)
channelMap
- channel mappublic Tunit getFirstUnit()
public Tunit getFirstUnit(int channelMap)
channelMap
- channel mappublic Tunit getPreceedingUnit(java.util.ListIterator<Tunit> listIterator, long startTime)
This implementation is passed an iterator which has already been initialised to be at the END of the list. In this way, the calling function has access to the iterator and can access nearby elements.
listIterator
- pre initialised ListIteratorstartTime
- search time in millisecondsListIterator
public Tunit getPreceedingUnit(java.util.ListIterator<Tunit> listIterator, long startTime, int channelMap)
This implementation is passed an iterator which has already been initialised to be at the END of the list. In this way, the calling function has access to the iterator and can access nearby elements.
listIterator
- pre initialised ListIteratorstartTime
- search time in millisecondschannelMap
- Channel bitmapListIterator
public Tunit getPreceedingUnit(long startTime)
startTime
- search time in millisecondspublic Tunit getPreceedingUnit(long startTime, int channelMap)
startTime
- search time in millisecondschannelMap
- Channel bitmappublic Tunit getNextUnit(java.util.ListIterator<Tunit> listIterator, long startTime, int channelMap)
This implementation is passed an iterator which has already been initialised to be at the END of the list. In this way, the calling function has access to the iterator and can access nearby elements.
listIterator
- pre initialised ListIteratorstartTime
- search time in millisecondschannelMap
- Channel bitmapListIterator
public Tunit getNextUnit(long startTime, int channelMap)
startTime
- search time in millisecondschannelMap
- Channel bitmappublic Tunit getClosestUnitMillis(long startTime)
startTime
- Start time of data unit (milliseconds)public Tunit getClosestUnitMillis(long startTime, int channelMap)
startTime
- Start time of data unit (milliseconds)channelMap
- Channel map - must be some overlap, not an exact match.public float getSampleRate()
public java.lang.String getDataName()
public java.lang.String getLongDataName()
public void setSampleRate(float sampleRate, boolean notify)
sampleRate
- The new sample rate in Hz.notify
- set true if Observers should be notifiedpublic void masterClockUpdate(long milliSeconds, long clockSample)
public void noteNewSettings()
public java.lang.String toString()
toString
in class java.lang.Object
public int getNaturalLifetime()
public void setNaturalLifetimeMillis(int naturalLifetime)
public int getNaturalLifetimeMillis()
public void setNaturalLifetime(int naturalLifetime)
naturalLifetime
- in seconds (NOT milliseconds)public boolean isLinkGpsData()
public void setLinkGpsData(boolean linkGpsData)
public int getChannelMap()
public double getDataGain(int iChan)
Example 1: The amplifier module will just return it's gain
Example 2: The FFT module will return the loss due to windowing the data.
To convert to dB use 20*log10(Math.abs(getDataGain()));
iChan
- channel numberpublic void setChannelMap(int channelMap)
public void setDataName(java.lang.String dataName)
dataName
- The dataName to set.public java.lang.String getLoggingName()
public PamProcess getParentProcess()
public PamProcess getSourceProcess()
public PamRawDataBlock getRawSourceDataBlock()
public PamRawDataBlock getRawSourceDataBlock2()
Note that this does not search specifically for a PamRawDataBlock; it searches for the first data block in the chain, and then tests to see whether that data block is of class PamRawDataBlock.
public void addObserver(PamObserver o)
PamObservable
addObserver
in class PamObservable
o
- Reference to the observerpublic void addObserver(PamObserver o, boolean reThread)
addObserver
in class PamObservable
public java.lang.Class getUnitClass()
public void autoSetDataBlockMixMode()
public int getMixedDirection()
public void setMixedDirection(int mixedDirection)
public int getLocalisationContents()
public void setLocalisationContents(int localisationContents)
public void addLocalisationContents(int localisationContents)
public java.util.ListIterator<Tunit> getListIterator(int whereFrom)
public java.util.ListIterator<Tunit> getListIterator(long startTimeMillis, int channels, int match, int position)
public java.util.ListIterator<Tunit> getListIteratorFromStart(long startTime, int channels, int match, int position)
public void dumpBlockContents()
public java.util.ListIterator<Tunit> getListIteratorFromEnd(long startTime, int channels, int match, int position)
public java.util.Vector<ProcessAnnotation> getProcessAnnotations()
public int createProcessAnnotations(PamDataBlock sourceData, ProcessAnnotator newAnnotations)
sourceData
- source DatablocknewAnnotations
- source of new annotationspublic int createProcessAnnotations(PamDataBlock sourceData, ProcessAnnotator newAnnotations, boolean notifyDownstream)
sourceData
- source DatablocknewAnnotations
- source of new annotationsnotifydownstream
- notify downstream modules.public ProcessAnnotation findAnnotation(java.lang.String type, java.lang.String name)
type
- annotation typename
- annotation namepublic ProcessAnnotation findAnnotation(ProcessAnnotation template)
template
- template annotationpublic void setRecycling(boolean recycling)
recycling
- the recycling to setpublic boolean isRecycling()
public void setRecyclingStoreLength(int recyclingStoreLength)
recyclingStoreLength
- the recyclingStoreLength to setpublic int getRecyclingStoreLength()
public void notifyModelChanged(int changeType)
changeType
- public void setBinaryDataSource(BinaryDataSource binaryDataSource)
siterBinaryDataSource
- the siterBinaryDataSource to setpublic BinaryDataSource getBinaryDataSource()
public void SetLogging(SQLLogging logging)
public SQLLogging getLogging()
public final boolean getCanLog()
public boolean getShouldLog(PamDataUnit pamDataUnit)
pamDataUnit
- dataunit to considerpublic final void setShouldLog(boolean shouldLog)
shouldLog
- flag to log data.public boolean getShouldBinary(PamDataUnit pamDataUnit)
pamDataUnit
- data unitpublic void setShouldBinary(boolean shouldBinary)
shouldBinary
- flag to say data shoule be stored.public void addOfflineDataMap(OfflineDataMap offlineDataMap)
Note that there may be several maps from different types of storage (although only one should have anything in it in a sensible world).
It's also possible that these will be recreated during a run, and we don't want two of the same type in the same datablock, so check that there isn't already one and remove it
offlineDataMap
- public int getNumOfflineDataMaps()
public OfflineDataMap getOfflineDataMap(int iMap)
iMap
- index of map (see getNumOfflineDataMaps)public OfflineDataMap getOfflineDataMap(OfflineDataStore dataSource)
dataSource
- an offline data source (e.g. binaray storage, database storage, etc.public OfflineDataMap getPrimaryDataMap()
public OfflineDataMap getDatagrammedMap()
public void removeOfflineDataMap(OfflineDataStore dataSource)
dataSource
- data source (e.g. binary, database, raw data, etc.public SaveRequirements getSaveRequirements(OfflineDataStore dataStore)
dataStore
- data source that want's to save the data.public void orderOfflineData(PamObserver dataObserver, LoadObserver loadObserver, long startMillis, long endMillis, int interrupt)
getOfflineData will probably (if not overridden) be sending data to the update member function of the observer, but from the worker thread. Once it's complete, it will send a message to say that data are loaded.
It's possible that the user will do something which causes this to be called again before the previous thread completed execution, in which case there are three options:
OFFLINE_DATA_INTERRUPT - previous thread will be terminated
OFFLINE_DATA_WAIT - wait for previous thread to terminate, then start this load
OFFLINE_DATA_CANCEL - give up and return
dataObserver
- observer of the loaded dataloadObserver
- observer to get status information on the load.startMillis
- data start time in imillisecondsendMillis
- data end time in milliseconds.interrupt
- interrupt options.public void orderOfflineData(PamObserver dataObserver, LoadObserver loadObserver, long startMillis, long endMillis, int interrupt, boolean allowRepeats)
getOfflineData will probably (if not overridden) be sending data to the update member function of the observer, but from the worker thread. Once it's complete, it will send a message to say that data are loaded.
It's possible that the user will do something which causes this to be called again before the previous thread completed execution, in which case there are three options:
OFFLINE_DATA_INTERRUPT - previous thread will be terminated
OFFLINE_DATA_WAIT - wait for previous thread to terminate, then start this load
OFFLINE_DATA_CANCEL - give up and return
dataObserver
- observer of the loaded dataloadObserver
- observer to get status information on the load.startMillis
- data start time in imillisecondsendMillis
- data end time in milliseconds.interrupt
- interrupt options.allowRepeats
- allow repeated loads of exactly the same data.public void cancelDataOrder()
public boolean getOrderStatus()
public int getOfflineData(PamObserver observer, PamObserver endUser, long startMillis, long endMillis, boolean allowRepeats, RequestCancellationObject cancellationObject)
This is used to get data from some upstream process which is quite different to the function loadViewerData(...) which loads data directly associated with this data block.
For example, this might be called in the FFT data block by the spectrogram which wants some data to display. The FFT data block does not have this data, so it passes the request up to it's process which will in turn pass the request on until it reaches a module which is capable of loading data into data units and sending them back down the line.
observer
- data observer which will receive the datastartMillis
- start time in millisecondsendMillis
- end time in millisecondsallowRepeats
- allow the same data to be loaded a second time.cancellationObject
- public void clearDeletedList()
public long getNextDataStart(long timeMillis)
timeMillis
- current time in millisecondspublic long getPrevDataEnd(long timeMillis)
timeMillis
- current time in millisecondspublic void setDatagramProvider(DatagramProvider datagramProvider)
public DatagramProvider getDatagramProvider()
public boolean isCanClipGenerate()
public void setCanClipGenerate(boolean canClipGenerate)
canClipGenerate
- the canClipGenerate to setpublic int getQuickId()
public void sortData()
public void setRecordingTrigger(RecorderTrigger recorderTrigger)
public ChannelIterator<Tunit> getChannelIterator(int channelMap, int whereFrom)
In viewer mode, channel iterators are saved for reuse but will be deleted / cleared if data are removed or added to the datablock to avoid concurrency exceptions.
channelMap
- channel mapwhereFrom
- 0, start at start,public void clearChannelIterators()
public int getChannelIteratorCount()
public void addDataAnnotationType(DataAnnotationType dataAnnotationType)
dataAnnotationType
- public int getNumDataAnnotationTypes()
public DataAnnotationType getDataAnnotationType(int index)
public boolean isClearAtStart()
public void setClearAtStart(boolean clearAtStart)
clearAtStart
- the clearAtStart to setpublic DataSelectorCreator getDataSelectCreator()
public DataSelector getDataSelector(java.lang.String selectorName, boolean allowScores)
selectorName
- allowScores
-