Class MultiFileCatalog

java.lang.Object
tritechgemini.fileio.MultiFileCatalog
All Implemented Interfaces:
Serializable

public class MultiFileCatalog extends Object implements 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 Details

    • MultiFileCatalog

      public MultiFileCatalog()
      constructor doesn't actually do any cataloging. Call catalogFiles(...) to build it.
  • Method Details

    • catalogFile

      public boolean catalogFile(String fileOrFolder)
      Having trouble calling from R so trying a name for the function that isn't overloaded.
      Parameters:
      fileOrFolder -
      Returns:
    • catalogFiles

      public boolean catalogFiles(String fileOrFolder)
      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

      public boolean catalogFiles(String fileOrFolder, boolean subFolders)
      Catalog a single file or a folder of files
      Parameters:
      fileOrFolder - a single file or folder name
      subFolders - only applies if cataloguing a folder
    • catalogFiles

      public void catalogFiles(String[] fileList)
      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

      public SonarImageRecordI getRecord(int iRecord)
      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

      public SonarImageRecordI getRecord(int iRecord, boolean loadFully)
      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

      public SonarImageRecordI getSonarRecord(int sonarID, int iRecord)
      Get the ith record for the specified sonar ...
    • findRecordCatalog

      public GeminiFileCatalog findRecordCatalog(SonarImageRecordI geminiRecord)
      Find the catalogue for a given record.
      Parameters:
      geminiRecord -
      Returns:
    • findRecordCatalog

      public GeminiFileCatalog findRecordCatalog(int deviceId, long recordTime)
      find which catalog it is for the sonar id and time
      Parameters:
      deviceId -
      recordTime -
      Returns:
      catalog reference or null
    • findRecordForTime

      public SonarImageRecordI findRecordForTime(int sonarID, long timeMillis)
      Find the closest record for the given sonar id to the time in milliseconds
      Parameters:
      sonarID - sonar ID
      timeMillis - time milliseconds
      Returns:
      record or null
    • findRelativeRecord

      public SonarImageRecordI findRelativeRecord(SonarImageRecordI baseRecord, int recordOffset)
      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

      public ArrayList<GeminiFileCatalog> getCatalogList()
    • addObserver

      public void addObserver(CatalogObserver observer)
    • removeObserver

      public void removeObserver(CatalogObserver observer)
    • 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

      public boolean loadFully(SonarImageRecordI imageRecord)
      call if a record has not been loaded fully. will need to find the right catalog, then load.
      Parameters:
      imageRecord -
      Returns: