Class DataSelectorCreator

java.lang.Object
PamguardMVC.dataSelector.DataSelectorCreator
All Implemented Interfaces:
PamSettings, SettingsNameProvider
Direct Known Subclasses:
AnnotationDataSelCreator, ClickDataSelectCreator, ClickTrainDataSelectorCreator, ControlDataSelCreator, CPODDataSelectorCreator, CTDataSelectCreator, DifarDataSelectCreator, FormDataSelCreator, FormsDataSelectorCreator, Group3DDataSelectCreator, NullDataSelectorCreator, RWDataSelCreator, WMDDataSelectCreator, WslClsDataSelectCreator

public abstract class DataSelectorCreator extends Object implements PamSettings
Something that creates data selectors. It also keeps a list of available data selectors, which are each named with a string so when asked for one, will be able to either give the existing one, or will create a new one.
In this way, it's possible for multiple objects to use the same data selector, but DataBlocks that use these things should create separate settings for each so that different parts of the system can work with different selections.

Finally, these things can also keep a central register of all data selectors, so that their settings can get serialised when settings are saved.

16 April 2017. Rewrote how settings are saved. Previous system of each DS handlingit's own settings wasn't working since if a DS was never used in a PAMGuard run it's settings fell out of the settings list since they were never registered, so were never saved. Have now put a hashtable of settings into every DSCreator which will always get read and saved even if DS's never get made in a particular PAMGuard run. This is similar to a problem in SymbolChoosers which suffered in the same way if nothing got plotted on a particular display for a particular run.

Author:
Doug Gillespie
  • Constructor Details

    • DataSelectorCreator

      public DataSelectorCreator(PamDataBlock pamDataBlock)
  • Method Details

    • getDataSelector

      public DataSelector getDataSelector(String selectorName, boolean allowScores, String selectorType)
      Get a data selector of a given name including all possible options for super detections and annotations.
      Parameters:
      selectorName -
      allowScores -
      Returns:
      data selector for given name.
    • getDataSelector

      public DataSelector getDataSelector(String selectorName, boolean allowScores, String selectorType, boolean includeAnnotations, boolean includeSuperDetections)
      Get a data selector of a given name with optional inclusion of options for annotations and super detections
      Parameters:
      selectorName - data selector name
      allowScores - allow scores
      selectorType -
      includeAnnotations - include options from any annotators of this data stream
      includeSuperDetections - include any possible super detection data selectors.
      Returns:
      data selector for given name with appropriate options.
    • destroyDataSelector

      public boolean destroyDataSelector(String selectorName)
      Destroy a data selector. Very rarely called, but for neatness might call this if a module that was using a data selector was removed from PAMGuard.
      Parameters:
      selectorName - Name of data selector
      Returns:
      true if it existed.
    • createDataSelector

      public abstract DataSelector createDataSelector(String selectorName, boolean allowScores, String selectorType)
      Create a data selector with a given name.
      Parameters:
      selectorName -
      Returns:
      a new data selector.
    • findDataSelector

      public DataSelector findDataSelector(String selectorName)
      Find a data selector with a given name.
      Parameters:
      selectorName - Name of data selector
      Returns:
      selector, or null.
    • globalClear

      public static void globalClear()
      Clear all data selectors from all lists. This is to be called after annotations change, which may require a data selector to rebuild itself with different annotation options.
    • clearDataSelectors

      public void clearDataSelectors()
      Clear all data selectors for this datablock. This probably needs data selectors to be saved first.
    • getPamDataBlock

      public PamDataBlock getPamDataBlock()
      Returns:
      the pamDataBlock
    • getUnitName

      public String getUnitName()
      Specified by:
      getUnitName in interface SettingsNameProvider
      Returns:
      A Name specific to this instance of the particular class, e.g. Sperm whale detector, Beaked whale detector, etc.
    • getUnitType

      public String getUnitType()
      Specified by:
      getUnitType in interface PamSettings
      Returns:
      A Name specific to the type, e.g. Click detector
    • getSettingsReference

      public Serializable getSettingsReference()
      Specified by:
      getSettingsReference in interface PamSettings
      Returns:
      The serialisable object that will be stored
    • getSettingsVersion

      public long getSettingsVersion()
      Specified by:
      getSettingsVersion in interface PamSettings
      Returns:
      An integer version number for the settings
    • restoreSettings

      public boolean restoreSettings(PamControlledUnitSettings pamControlledUnitSettings)
      Specified by:
      restoreSettings in interface PamSettings
      Returns:
      true if successful The object performs final checks (if needed) and then casts the settings data pamcontrolledunitSettings.settings into the correct type and uses as required
    • createNewParams

      public abstract DataSelectParams createNewParams(String name)