clickDetector.offlineFuncs
Class OfflineEventDataUnit

java.lang.Object
  extended by PamguardMVC.PamDataUnit
      extended by PamDetection.AcousticDataUnit
          extended by PamDetection.PamDetection<ClickDetection,PamDetection>
              extended by clickDetector.offlineFuncs.OfflineEventDataUnit
All Implemented Interfaces:
java.lang.Comparable<PamDataUnit>

public class OfflineEventDataUnit
extends PamDetection<ClickDetection,PamDetection>

OfflineEventDataUnit replicates the RainbowClick functionality in OfflineRCEvent.

A lot of the functionality required to associate clicks with an event is already wrapped up in the base classes of PamDataBlock and PamDataUnit.

Author:
Doug Gillespie

Field Summary
private  java.lang.Short bestNumber
          Best estimate of number of animals in event
private  java.lang.Integer colourIndex
          specific colour index - can be null.
private  java.lang.String comment
           
private  long eventEndTime
          Event end time.
private  java.lang.String eventType
           
private  java.lang.Short maxNumber
          Maximum number of animals in event
private  java.lang.Short minNumber
          Minimum number of animals in event
private  int nClicks
           
private  boolean suspectEventTimes
          Flag to say that event times may be a bit dodgy.
 
Fields inherited from class PamDetection.AcousticDataUnit
AMPLITUDE_SCALE_DBREMPA, AMPLITUDE_SCALE_LINREFSD, duration, frequency, startSample
 
Fields inherited from class PamguardMVC.PamDataUnit
absBlockIndex, channelBitmap, localisation, oLL, timeMilliseconds
 
Constructor Summary
OfflineEventDataUnit(java.lang.String eventType, java.lang.Integer colourIndex, ClickDetection firstClick)
           
 
Method Summary
 void addClicks(java.util.List<ClickDetection> markedClicks)
          Add a list of clicks to an event.
 void addSubDetection(ClickDetection subDetection)
          Add a new click to the event.
 void addSubDetection(ClickDetection subDetection, boolean countClick)
          Add a sub detection with the option of not increasing the click count.
 java.lang.Short getBestNumber()
           
 short getColourIndex()
           
 java.lang.String getComment()
           
 long getEventEndTime()
           
 int getEventNumber()
           
 java.lang.String getEventType()
           
 java.lang.Short getMaxNumber()
           
 java.lang.Short getMinNumber()
           
 int getNClicks()
           
 boolean isSuspectEventTimes()
           
 void notifyUpdate()
          Quick way for events to tell observers of the data block that they have updated.
 void removeSubDetection(ClickDetection subDetection)
           
 void setBestNumber(java.lang.Short bestNumber)
           
 void setComment(java.lang.String comment)
           
 void setEventEndTime(long eventEndTime)
           
 void setEventType(java.lang.String eventType)
           
 void setMaxNumber(java.lang.Short maxNumber)
           
 void setMinNumber(java.lang.Short minNumber)
           
 void setNClicks(int nClicks)
           
 void setSuspectEventTimes(boolean suspectEventTimes)
           
private  void setUniqueEvent(ClickDetection clickDetection, OfflineEventDataUnit event)
          Ensure that there is only one event superdetection per click.
 
Methods inherited from class PamDetection.PamDetection
addSuperDetection, getDetectionType, getPeakTime, getSubDetection, getSubDetectionsCount, getSubDetectionSyncronisation, getSuperDetection, getSuperDetection, getSuperDetectionsCount, getSuperDetectionSyncronisation, removeSuperDetection, setDetectionType, setPeakTime, setUniqueSuperDetection
 
Methods inherited from class PamDetection.AcousticDataUnit
amplifyMeasuredAmplitudeByDB, amplifyMeasuredAmplitudeByLinear, compareTo, getAmplitudeDB, getCalculatedAmlitudeDB, getDuration, getFrequency, getFrequencyOverlap, getLastSample, getMeasuredAmplitude, getMeasuredAmplitudeType, getSeconds, getStartSample, getTimeOverlap, setCalculatedAmlitudeDB, setDuration, setFrequency, setInfo, setMeasuredAmplitude, setMeasuredAmplitude, setMeasuredAmplitudeType, setStartSample
 
Methods inherited from class PamguardMVC.PamDataUnit
clearUpdateCount, getAbsBlockIndex, getChannelBitmap, getDatabaseIndex, getDatabaseUpdateOf, getDataUnitFileInformation, getGpsPosition, getLastUpdateTime, getLocalisation, getOriginLatLong, getPairAngle, getParentDataBlock, getTimeMilliseconds, getUpdateCount, setAbsBlockIndex, setChannelBitmap, setDatabaseIndex, setDatabaseUpdateOf, setDataUnitFileInformation, setLastUpdateTime, setLocalisation, setOriginLatLong, setParentDataBlock, setTimeMilliseconds, updateDataUnit
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

eventType

private java.lang.String eventType

comment

private java.lang.String comment

nClicks

private int nClicks

eventEndTime

private long eventEndTime
Event end time.


suspectEventTimes

private boolean suspectEventTimes
Flag to say that event times may be a bit dodgy. This will happen if an event is only partially loaded into memory when some clicks are deleted and it may be impossible to work out what the true start and end times are.


colourIndex

private java.lang.Integer colourIndex
specific colour index - can be null.


minNumber

private java.lang.Short minNumber
Minimum number of animals in event

(can be null)


bestNumber

private java.lang.Short bestNumber
Best estimate of number of animals in event

(can be null)


maxNumber

private java.lang.Short maxNumber
Maximum number of animals in event

(can be null)

Constructor Detail

OfflineEventDataUnit

public OfflineEventDataUnit(java.lang.String eventType,
                            java.lang.Integer colourIndex,
                            ClickDetection firstClick)
Method Detail

addClicks

public void addClicks(java.util.List<ClickDetection> markedClicks)
Add a list of clicks to an event.

Parameters:
markedClicks - List of marked clicks.

addSubDetection

public void addSubDetection(ClickDetection subDetection,
                            boolean countClick)
Add a sub detection with the option of not increasing the click count. This is used when setting up data as it's read from the database, not when adding new clicks under normal operation

Parameters:
subDetection - click to add to event
countClick - true if click count should be increased.

addSubDetection

public void addSubDetection(ClickDetection subDetection)
Add a new click to the event. As each click is added, some checks are done to make sure that the click is not already part of some other event, and if all events are removed from some other event, make sure that that other event get's deleted.

Overrides:
addSubDetection in class PamDetection<ClickDetection,PamDetection>
Parameters:
subDetection - a new click to add.

removeSubDetection

public void removeSubDetection(ClickDetection subDetection)
Overrides:
removeSubDetection in class PamDetection<ClickDetection,PamDetection>

setUniqueEvent

private void setUniqueEvent(ClickDetection clickDetection,
                            OfflineEventDataUnit event)
Ensure that there is only one event superdetection per click.

Parameters:
clickDetection -
event -

getEventType

public java.lang.String getEventType()
Returns:
the eventType

getColourIndex

public short getColourIndex()

setEventType

public void setEventType(java.lang.String eventType)
Parameters:
eventType - the eventType to set

getComment

public java.lang.String getComment()
Returns:
the comment

setComment

public void setComment(java.lang.String comment)
Parameters:
comment - the comment to set

getEventEndTime

public long getEventEndTime()
Returns:
The event end time in milliseconds

setEventEndTime

public void setEventEndTime(long eventEndTime)
Parameters:
eventEndTime - the eventEndTime to set in milliseconds

getEventNumber

public int getEventNumber()
Returns:
the eventNumber

getMinNumber

public java.lang.Short getMinNumber()

setMinNumber

public void setMinNumber(java.lang.Short minNumber)

getBestNumber

public java.lang.Short getBestNumber()

setBestNumber

public void setBestNumber(java.lang.Short bestNumber)

getMaxNumber

public java.lang.Short getMaxNumber()

setMaxNumber

public void setMaxNumber(java.lang.Short maxNumber)

getNClicks

public int getNClicks()

setNClicks

public void setNClicks(int nClicks)

isSuspectEventTimes

public boolean isSuspectEventTimes()
Returns:
the suspectEventTimes

setSuspectEventTimes

public void setSuspectEventTimes(boolean suspectEventTimes)
Parameters:
suspectEventTimes - the suspectEventTimes to set

notifyUpdate

public void notifyUpdate()
Quick way for events to tell observers of the data block that they have updated.