Class OfflineDataLoading<T extends PamDataUnit>
- Author:
- Jamie Macaulay
-
Field Summary
Modifier and TypeFieldDescriptionstatic final int
If the current thread is not null then the new order will not be executed.static final int
The current thread will be cancelled.static final int
The current thread will continu and the next thread will be executed.static final int
Data loaded for requested time period.static final int
Data partially loaded for requested time periodstatic final int
The request threw an exception of some sort.static final int
The request was interrupted (in multi thread load)static final int
No data available for offline loading.static final int
this is exactly the same data as requested last time. -
Constructor Summary
ConstructorDescriptionOfflineDataLoading
(PamDataBlock<T> pamDataBlock) Constructor for the offline data loader. -
Method Summary
Modifier and TypeMethodDescriptionvoid
Cancels the current order.void
cancelDataOrder
(boolean que) int
getOfflineData
(OfflineDataLoadInfo offlineDataInfo) Gets data for offline display, playback, etc.boolean
boolean
void
notifyOfflineObservers
(T pamDataUnit) void
orderOfflineData
(OfflineDataLoadInfo offlineDataInfo) 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 loadKeepLayers, 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
setCurrentOfflineLoadKeep
(boolean currentOfflineLoadKeep)
-
Field Details
-
OFFLINE_DATA_INTERRUPT
public static final int OFFLINE_DATA_INTERRUPTThe current thread will be cancelled.- See Also:
-
OFFLINE_DATA_WAIT
public static final int OFFLINE_DATA_WAITThe current thread will continu and the next thread will be executed.- See Also:
-
OFFLINE_DATA_CANCEL
public static final int OFFLINE_DATA_CANCELIf the current thread is not null then the new order will not be executed.- See Also:
-
REQUEST_NO_DATA
public static final int REQUEST_NO_DATANo data available for offline loading.- See Also:
-
REQUEST_DATA_LOADED
public static final int REQUEST_DATA_LOADEDData loaded for requested time period.- See Also:
-
REQUEST_DATA_PARTIAL_LOAD
public static final int REQUEST_DATA_PARTIAL_LOADData partially loaded for requested time period- See Also:
-
REQUEST_SAME_REQUEST
public static final int REQUEST_SAME_REQUESTthis is exactly the same data as requested last time.This flag will be used with one of the other three.
- See Also:
-
REQUEST_INTERRUPTED
public static final int REQUEST_INTERRUPTEDThe request was interrupted (in multi thread load)- See Also:
-
REQUEST_EXCEPTION
public static final int REQUEST_EXCEPTIONThe request threw an exception of some sort.- See Also:
-
orderLock
-
-
Constructor Details
-
OfflineDataLoading
Constructor for the offline data loader.- Parameters:
pamDataBlock
- - the datablock.
-
-
Method Details
-
orderOfflineData
public void orderOfflineData(PamObserver dataObserver, LoadObserver loadObserver, long startMillis, long endMillis, int loadKeepLayers, int interrupt, boolean allowRepeats) Similar functionality to getOfflineData, but this will launch a separate worker thread to do the actual work getting the data. The worker thread will call getOfflineData.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
- Parameters:
dataObserver
- observer of the loaded dataloadObserver
- observer to get status information on the load.startMillis
- data start time in millisecondsendMillis
- data end time in milliseconds.loadKeepLayers
- Number of layers of datablock which should hang on to loaded data rather than delete it immediately.interrupt
- interrupt options.allowRepeats
- allow repeated loads of exactly the same data.
-
orderOfflineData
Similar functionality to getOfflineData, but this will launch a separate worker thread to do the actual work getting the data. The worker thread will call getOfflineData.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
OFFLINE_DATA_CANCEL - give up and return
- Parameters:
offlineDataInfo
- the OfflineDataLoadInfo object which stores all parameters for the data load.
-
cancelDataOrder
public void cancelDataOrder()Cancels the current order. -
cancelDataOrder
public void cancelDataOrder(boolean que) - Parameters:
que
-
-
getOrderStatus
public boolean getOrderStatus()- Returns:
- true if an order for data is currently still being processed.
-
getOfflineData
Gets data for offline display, playback, etc.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.
- Parameters:
observer
- data observer which will receive the datastartMillis
- start time in millisecondsendMillis
- end time in millisecondsloadKeepLayers
-allowRepeats
- allow the same data to be loaded a second time.cancellationObject
-- Returns:
- answer: .
-
notifyOfflineObservers
-
isCurrentOfflineLoadKeep
public boolean isCurrentOfflineLoadKeep() -
setCurrentOfflineLoadKeep
public void setCurrentOfflineLoadKeep(boolean currentOfflineLoadKeep)
-