Class SuperDetection<T extends PamDataUnit>

java.lang.Object
PamguardMVC.PamDataUnit<T,SuperDetection>
PamguardMVC.superdet.SuperDetection<T>
Type Parameters:
T -
All Implemented Interfaces:
Comparable<PamDataUnit>
Direct Known Subclasses:
CBDetectionMatcher.CBMatchGroup, DetectionGroupDataUnit, EventDataUnit, Group3DDataUnit, GroupDetDataUnit, GroupDetection, IshAnchorGroup, MarkGroupDataUnit, QADataUnit

public class SuperDetection<T extends PamDataUnit> extends PamDataUnit<T,SuperDetection>
Class added to a PAMDataunit which can be a SuperDetection. Pretty much contains functionality which was previously in every data unit, but now only in designated super detections implementing the SuperDetection interface.

A Major change now taking place is that the list of SubdetectionInfo's in viewer mode now contains all infos for the data unit, regardless of whether their actual data unit is there or not. Separating out the infos from the dataunit gives much better control over how superdetection data are handled.

Author:
Doug Gillespie
  • Constructor Details

    • SuperDetection

      public SuperDetection(DataUnitBaseData basicData)
    • SuperDetection

      public SuperDetection(long timeMilliseconds, int channelBitmap, long startSample, long durationSamples)
    • SuperDetection

      public SuperDetection(long timeMilliseconds)
  • Method Details

    • getSubDetectionSyncronisation

      public Object getSubDetectionSyncronisation()
    • isAllowSubdetectionSharing

      public boolean isAllowSubdetectionSharing()
    • addSubDetections

      public int addSubDetections(List<T> newSubDets)
      Add multiple sub detections from a list.
      Parameters:
      newSubDets - List of new sub detections
      Returns:
      total number of sub detections now in the super detection
    • addSubDetection

      public int addSubDetection(T subDetection)
      Add a sub detection to the sub detection list.
      Parameters:
      subDetection - - the sub detection to add.
      Returns:
      - the total number of sub detections now in the list. .
    • sortSubDetections

      public void sortSubDetections()
      Sorts sub detections into order. Uses the inbuilt comparator which compares the millisecond times of data units.

    • findSubdetectionInfo

      public int findSubdetectionInfo(T subToFind)
      Returns the index of the SubdetectionInfo object containing the passed subdetection
      Parameters:
      subToFind - the subdetection to find
      Returns:
      index position, or -1 if the subdetection wasn't found
    • findSubDetectionInfo

      public int findSubDetectionInfo(SubdetectionInfo otherInfo)
      find a sub detection info that has the same times, id's etc.
      Parameters:
      otherInfo -
      Returns:
      index of found item, or -1
    • getSubDetectionsCount

      public int getSubDetectionsCount()
      Get the number of sub detections in the super detection. note that they may not all be loaded in memory.
      Returns:
      Number of sub detections.
    • getLoadedSubDetectionsCount

      public int getLoadedSubDetectionsCount()
      Get the number of sub detections that are actually in memory.
      Returns:
      number of subdets linked in memory
    • getSubDetections

      public ArrayList<PamDataUnit<?,?>> getSubDetections()
      Get a basic list of sub detections without their associated info This may not be ALL of the sub detections, since they may not all be loaded.
      Returns:
      an array list of sub detection data units
    • getSubDetection

      public T getSubDetection(int ind)
    • findSubDetection

      public T findSubDetection(long timeMillis, int channelBitmap)
      find a sub detection based on it's time and it's channel map
      Parameters:
      timeMillis - time in milliseconds
      channelBitmap - channel map
      Returns:
      found sub detection, or null if none exists.
    • findSubDetection

      public T findSubDetection(long timeMillis, int channelBitmap, Class dataClass)
      Find a sub detection with a specific time, channel map and data unit class.
      Parameters:
      timeMillis -
      channelBitmap -
      dataClass -
      Returns:
      found sub detection or null.
    • findSubDetection

      public T findSubDetection(long UID)
      Find a subdetection with a specific UID
      Parameters:
      UID - the UID to find
      Returns:
      the found subdetection, or null
    • replaceSubDetection

      public void replaceSubDetection(T oldOne, T newOne)
      Replace a sub detection in an event.

      if the original sub detection does not exist, then the new one is added anyway.

      NOTE: not sure if this is working properly. I think that in the else block, it should simply do a removeSubDetection(oldOne) and addSubDetection(newOne), which properly sets things up to be added/removed from the database. The way it's written now, things are not deleted from the database. Should test this out before using this method

      DG - so far as I understand this method, it gets called when we've been scrolling back and forth through the data, so an event may already have sub detections which weren't cleared on data load but the sub dets were removed from the datablock but then reloaded with different id's, so the new objects need to replace the old ones, but other information doesn't need updating.
      but I ask why the events were'nt all cleared of all their sub detections when data were loaded?

      Parameters:
      oldOne - old sub detection
      newOne - new sub detection.
    • removeAllSubDetections

      public void removeAllSubDetections()
      Remove all sub detection information.
    • removeSubDetection

      public void removeSubDetection(T subDetection)
      Remove a sub detection from the data unit.
      Parameters:
      subDetection - - the sub detection to remove.
    • getPresentSubDetections

      public List<SubdetectionInfo<T>> getPresentSubDetections()
      Get a list of sub detections which are actually present.
      Returns:
      list of sub detections which have a non-null sub data unit.
    • getSubDetectionInfo

      public Vector<SubdetectionInfo<T>> getSubDetectionInfo()
      Get the full list of subdetection info's (which may not all have a sub detection in memory)
    • getSubdetectionInfo

      public SubdetectionInfo getSubdetectionInfo(int idx)
      Get sub detection info at a specified index.
      Parameters:
      idx -
    • getSubdetectionsRemoved

      public ArrayList<SubdetectionInfo<T>> getSubdetectionsRemoved()
      returns a list of the database indices of all subdetections that have been removed
      Returns:
    • clearSubdetectionsRemoved

      public void clearSubdetectionsRemoved()
      clears the list of subdetections that have been removed
    • addSubDetectionInfo

      public void addSubDetectionInfo(SubdetectionInfo<T> subDetInfo)
    • clearSubDetectionData

      public void clearSubDetectionData()
      Clears all sub detection data. i.e. the holders of sub detection informaiotn, should probably never be called.
    • clearSubDetectionObjects

      public void clearSubDetectionObjects()
      Clears actual detections from the sub detection data. This should be called whenever more viewer data are loaded, since we only want references to data units that are in the actual data unit list.