Package PamguardMVC.dataSelector
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
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.
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 Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
Clear all data selectors for this datablock.abstract DataSelector
createDataSelector
(String selectorName, boolean allowScores, String selectorType) Create a data selector with a given name.abstract DataSelectParams
createNewParams
(String name) boolean
destroyDataSelector
(String selectorName) Destroy a data selector.findDataSelector
(String selectorName) Find a data selector with a given name.getDataSelector
(String selectorName, boolean allowScores, String selectorType) Get a data selector of a given name including all possible options for super detections and annotations.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 detectionslong
static void
Clear all data selectors from all lists.boolean
restoreSettings
(PamControlledUnitSettings pamControlledUnitSettings)
-
Constructor Details
-
DataSelectorCreator
-
-
Method Details
-
getDataSelector
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 nameallowScores
- allow scoresselectorType
-includeAnnotations
- include options from any annotators of this data streamincludeSuperDetections
- include any possible super detection data selectors.- Returns:
- data selector for given name with appropriate options.
-
destroyDataSelector
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
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
- Returns:
- the pamDataBlock
-
getUnitName
- Specified by:
getUnitName
in interfaceSettingsNameProvider
- Returns:
- A Name specific to this instance of the particular class, e.g. Sperm whale detector, Beaked whale detector, etc.
-
getUnitType
- Specified by:
getUnitType
in interfacePamSettings
- Returns:
- A Name specific to the type, e.g. Click detector
-
getSettingsReference
- Specified by:
getSettingsReference
in interfacePamSettings
- Returns:
- The serialisable object that will be stored
-
getSettingsVersion
public long getSettingsVersion()- Specified by:
getSettingsVersion
in interfacePamSettings
- Returns:
- An integer version number for the settings
-
restoreSettings
- Specified by:
restoreSettings
in interfacePamSettings
- 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
-