T
- - the data type loaded from a file. This could be a String, ArrayListpublic abstract class DataImport<T>
extends java.lang.Object
First getExtensionsStrings() defines which file types can be selected for import.
Before loading in any data we need to perform pre-checks with the function performPreChecks(). This function is called before the load thread is called. Often this will remain blank but say you needed extra user imput then this function could be used to create another dialog box before the data is loaded.
To create a new importer first we need to load a file into memory using the loadDataIntermediate(String filePath) function. This will create an ArrayList
Once the data has been loaded into memory it must be converted into a data unit and saved to a data block. The function createDataUnit(T dataLine) converts data into a PamDatUnit. This function would for example, convert an NMEA strings into a GPSDataUnit. The function
isDataFormatOK() needs to be used to check that each T is in the correct format.
Constructor and Description |
---|
DataImport() |
Modifier and Type | Method and Description |
---|---|
abstract PamDataUnit |
createDataUnit(T dataLine)
Create a data unit from the data loaded from the imported file.
|
abstract PamDataBlock |
getDataBlock()
Get the data block to to save data to.
|
java.lang.String |
getDataUnitName()
The name of the data unit to appear on the dialog boxes.
|
abstract java.lang.String[] |
getExtensionsStrings()
Return the file extensions that can be loaded.
|
abstract boolean |
isDataFormatOK(T dataLine)
Check that a row of imported data is in the correct format.
|
abstract java.util.ArrayList<T> |
loadDataIntermediate(java.lang.String filePath) |
boolean |
performPreChecks()
Use this function to perform any pre checks on data/ bring up extra dialog boxes before laoding data.
|
public abstract java.util.ArrayList<T> loadDataIntermediate(java.lang.String filePath)
public abstract boolean isDataFormatOK(T dataLine)
dataLine-a
- row of data loaded from filepublic boolean performPreChecks()
public abstract PamDataUnit createDataUnit(T dataLine)
dataLine-a
- row of data loaded from filepublic abstract PamDataBlock getDataBlock()
public abstract java.lang.String[] getExtensionsStrings()
public java.lang.String getDataUnitName()