Class DataBlockSpeciesManager<T extends PamDataUnit>

java.lang.Object
tethys.species.DataBlockSpeciesManager<T>
Direct Known Subclasses:
ClickBlockSpeciesManager, ClickEventSpeciesManager, DLSpeciesManager, FixedSpeciesManager, RWSpeciesManager, WhistleSpeciesManager

public abstract class DataBlockSpeciesManager<T extends PamDataUnit> extends Object
Manage species conversion for a single datablock. there seem to be three types of manager:
1. Datablocks which have a totally free list of species codes, such as the click detector, or whistle classifier
1a. A slight variation on this is blocks which have a list and also a default for data units which aren't classified.
2. Datablocks which have a single type which may be unknown or partially known, but we want the possibility of overriding it. e.g. the whistle detector may default to odontocete, but may be overridden to a mystecete species.
3. Datablocks with no information, or where the list from (1.) is empty.

In all cases, we need to handle this reasonably sensibly. The code list is always the start of this and must always return something, even if it's 'unknown'.

Author:
dg50
  • Constructor Details

    • DataBlockSpeciesManager

      public DataBlockSpeciesManager(PamDataBlock<T> dataBlock)
  • Method Details

    • getSpeciesCodes

      public abstract DataBlockSpeciesCodes getSpeciesCodes()
      Object that contains a list of species codes. This may be fluid between configurations and may change during a session, e.g. through the addition of a new click type or changes to the whistle classifier settings.
      Returns:
      object containing a list of species types.
    • getSpeciesCode

      public abstract String getSpeciesCode(T dataUnit)
      Gets a species string for a specific data unit, This is abstracted since different detectors store this in non standard ways. The result of this should be within the set provided by getSpeciesCodes() which can then be used in the DataBlockSpeciesMap to look up an itis code.
      Parameters:
      dataUnit -
      Returns:
      A species code for a specific data unit. May be null (e.g. for an unclassified click)
    • getSpeciesItem

      public SpeciesMapItem getSpeciesItem(T dataUnit)
    • getAllSpeciesCodes

      public ArrayList<String> getAllSpeciesCodes()
      Get all PAMGuard species codes, which may come from the DataBlockSpeciesCodes object, or the defaultSpeciesCode, or the defaultDefaultSpecies name. Ideally, at least one of these should have something, or we'll stick in an "Unknown"
      Returns:
    • makeUniqueList

      public ArrayList<String> makeUniqueList(ArrayList<String> list)
      Make sure all entries in an array list are unique.
      Parameters:
      list -
      Returns:
      updated list.
    • getDatablockSpeciesMap

      public DataBlockSpeciesMap getDatablockSpeciesMap()
    • setDatablockSpeciesMap

      public void setDatablockSpeciesMap(DataBlockSpeciesMap datablockSpeciesMap)
    • showSpeciesDialog

      public void showSpeciesDialog()
    • getDataBlock

      public PamDataBlock<T> getDataBlock()
      Returns:
      the dataBlock
    • getDefaultDefaultSpecies

      public SpeciesMapItem getDefaultDefaultSpecies()
      Returns:
      the defaultSpecies
    • setDefaultDefaultSpecies

      public void setDefaultDefaultSpecies(SpeciesMapItem defaultDefaultSpecies)
      Parameters:
      defaultSpecies - the defaultSpecies to set
    • getDefaultSpeciesCode

      public String getDefaultSpeciesCode()
      Returns:
      the defaultName
    • setDefaultSpeciesCode

      public void setDefaultSpeciesCode(String defaultName)
      Parameters:
      defaultName - the defaultName to set
    • checkSpeciesMapError

      public String checkSpeciesMapError()
      Check the species map. Only return true if every species code has a map item. Otherwise it's not safe to export.
      Returns:
      null if all codes have a lookup, otherwise some sort of useful error information