Package tritechgemini.fileio
Class MultiFileCatalog
java.lang.Object
tritechgemini.fileio.MultiFileCatalog
- All Implemented Interfaces:
Serializable
Catalog of sonar data which can take multiple files.
This can catalogue all supported file file types using
maps of different catalogues for different underlying file types.
Generally, it's easiest just to program to this, and let it handle
the catalogues of the specific file types.
- Author:
- Doug Gillespie
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddObserver(CatalogObserver observer) booleancatalogFile(String fileOrFolder) Having trouble calling from R so trying a name for the function that isn't overloaded.booleancatalogFiles(String fileOrFolder) Catalog a single file or a folder of filesvoidcatalogFiles(String[] fileList) Build a catalogue from a list of files.booleancatalogFiles(String fileOrFolder, boolean subFolders) Catalog a single file or a folder of filesfindRecordCatalog(int deviceId, long recordTime) find which catalog it is for the sonar id and timefindRecordCatalog(SonarImageRecordI geminiRecord) Find the catalogue for a given record.findRecordForTime(int sonarID, long timeMillis) Find the closest record for the given sonar id to the time in millisecondsfindRelativeRecord(SonarImageRecordI baseRecord, int recordOffset) Used when scrolling by record number.voidfreeImageData(long currentTime, long timeWinMillis) Free image data from all records, but with a window around the time of interest.intGet max records for a single sonar.getRecord(int iRecord) Get the ith record from the total catalogue.getRecord(int iRecord, boolean loadFully) Get the ith record from the total catalogue.int[]Get the ID's of the sonars in this catalogue.getSonarRecord(int sonarID, int iRecord) Get the ith record for the specified sonar ...intGet the total number of records in all files.booleanloadFully(SonarImageRecordI imageRecord) call if a record has not been loaded fully.voidremoveObserver(CatalogObserver observer) void
-
Constructor Details
-
MultiFileCatalog
public MultiFileCatalog()constructor doesn't actually do any cataloging. Call catalogFiles(...) to build it.
-
-
Method Details
-
catalogFile
Having trouble calling from R so trying a name for the function that isn't overloaded.- Parameters:
fileOrFolder-- Returns:
-
catalogFiles
Catalog a single file or a folder of files- Parameters:
fileOrFolder- a single file or folder name If it's a folder, will automatically do sub folders.
-
catalogFiles
Catalog a single file or a folder of files- Parameters:
fileOrFolder- a single file or folder namesubFolders- only applies if cataloguing a folder
-
catalogFiles
Build a catalogue from a list of files.- Parameters:
fileList-
-
getTotalRecords
public int getTotalRecords()Get the total number of records in all files.- Returns:
-
getMaxDeviceRecords
public int getMaxDeviceRecords()Get max records for a single sonar.- Returns:
- max records for a single sonar.
-
getRecord
Get the ith record from the total catalogue. Load full record.- Parameters:
iRecord- record index.- Returns:
- ith record or null if it doesn't exit.
-
getRecord
Get the ith record from the total catalogue.- Parameters:
iRecord- record index.loadFully- load the full record data (don't do this for too many units at once)- Returns:
- ith record or null if it doesn't exit.
-
getSonarRecord
Get the ith record for the specified sonar ... -
findRecordCatalog
Find the catalogue for a given record.- Parameters:
geminiRecord-- Returns:
-
findRecordCatalog
find which catalog it is for the sonar id and time- Parameters:
deviceId-recordTime-- Returns:
- catalog reference or null
-
findRecordForTime
Find the closest record for the given sonar id to the time in milliseconds- Parameters:
sonarID- sonar IDtimeMillis- time milliseconds- Returns:
- record or null
-
findRelativeRecord
Used when scrolling by record number. Allows to take the current time, then move by a small number of records forwards or backwards.- Parameters:
sonarID-timeMillis-recordOffest-- Returns:
- relative image record in list.
-
getSonarIDs
public int[] getSonarIDs()Get the ID's of the sonars in this catalogue.- Returns:
- array of IDs (these are the things written on the sonar, not their indexes)
-
getCatalogList
-
addObserver
-
removeObserver
-
freeImageData
public void freeImageData(long currentTime, long timeWinMillis) Free image data from all records, but with a window around the time of interest.- Parameters:
currentTime- current time (in Viewer ?)timeWinMillis- time window about current time.
-
stopCataloging
public void stopCataloging() -
loadFully
call if a record has not been loaded fully. will need to find the right catalog, then load.- Parameters:
imageRecord-- Returns:
-