Package PamguardMVC

Class DataUnitBaseData

java.lang.Object
PamguardMVC.DataUnitBaseData
All Implemented Interfaces:
Cloneable

public class DataUnitBaseData extends Object implements Cloneable
Class for data unit basic data. this has been separated into a separate class so that it can be passed around more easily during file and network read write ops when a whole data unit may not be available.
Author:
dg50
  • Field Details

    • S1_TIMEMILLISECONDS

      public static final short S1_TIMEMILLISECONDS
      See Also:
    • S1_TIMENANOSECONDS

      public static final short S1_TIMENANOSECONDS
      See Also:
    • S1_CHANNELMAP

      public static final short S1_CHANNELMAP
      See Also:
    • S1_UID

      public static final short S1_UID
      See Also:
    • S1_STARTSAMPLE

      public static final short S1_STARTSAMPLE
      See Also:
    • S1_SAMPLEDURATION

      public static final short S1_SAMPLEDURATION
      See Also:
    • S1_FREQUENCYLIMITS

      public static final short S1_FREQUENCYLIMITS
      See Also:
    • S1_MILLISDURATION

      public static final short S1_MILLISDURATION
      See Also:
    • S1_TIMEDELAYSSECONDS

      public static final short S1_TIMEDELAYSSECONDS
      See Also:
    • S1_HASBINARYANNOTATIONS

      public static final short S1_HASBINARYANNOTATIONS
      See Also:
    • S1_HASSEQUENCEMAP

      public static final short S1_HASSEQUENCEMAP
      See Also:
    • S1_HASNOISE

      public static final short S1_HASNOISE
      See Also:
    • S1_HASSIGNAL

      public static final short S1_HASSIGNAL
      See Also:
    • S1_HASSIGNALEXCESS

      public static final short S1_HASSIGNALEXCESS
      See Also:
    • S1_SEARCHS2

      public static final short S1_SEARCHS2
      See Also:
    • AMPLITUDE_SCALE_DBREMPA

      public static final int AMPLITUDE_SCALE_DBREMPA
      Amplitude value is in dB relative to 1 micropascal
      See Also:
    • AMPLITUDE_SCALE_LINREFSD

      public static final int AMPLITUDE_SCALE_LINREFSD
      Amplitude scale is linear relative to full scale
      See Also:
    • binarySpace

      public int[] binarySpace
      Used to calculate the number of bytes in the base data. The order of the numbers in the array must match the order of the data identifiers given above. The value in array is related to how the data is actually written to the binary file, and not what type the data itself is. Data types and corresponding byte sizes are:
        short = 2
        int = 4
        float = 4
        long = 8
      For example, the first number in the array corresponds to S1_TIMEMILLISECONDS. This is a long variable, and it's written as a long to the binary file. Therefore the value is 8. The second number corresponds to S1_TIMENANOSECONDS, and is the same. The 6th number corresponds to S1_SAMPLEDURATION which is also a long variable, however it's written to the binary file as an int. Therefore the value in the array is 4 not 8.

      Similarly, the 7th value in the array corresponds to S1_FREQUENCYLIMITS, which is a 2-cell double array. That would mean it should take 16 bytes to store (2*8=16) BUT it's actually being stored as a float, so the value in binarySpace is actually 8 (2*4=8).

      Note also that 9th value corresponds to S1_TIMEDELAYSSECONDS. This is a double array of variable length. Therefore, the value in the array below is 0 and it is handled as a special case in the getBaseDataBinaryLength method.

    • S1_S2

      public static final short S1_S2
      Special flag to say that there is another set of up to 16 more flags indicating other data types.
      See Also:
  • Constructor Details

    • DataUnitBaseData

      public DataUnitBaseData()
    • DataUnitBaseData

      public DataUnitBaseData(long timeMilliseconds, int channelBitmap, Long timeNanoseconds)
      Parameters:
      timeMilliseconds -
      channelBitmap -
      timeNanoseconds -
    • DataUnitBaseData

      public DataUnitBaseData(long timeMilliseconds, int channelBitmap, long startSample, long duration)
      Constructor used to hand the basic data to AcousticDataUnit.
      Parameters:
      timeMilliseconds -
      channelBitmap -
      startSample -
      duration -
    • DataUnitBaseData

      public DataUnitBaseData(long timeMilliseconds, int channelBitmap)
      Parameters:
      timeMilliseconds -
      channelBitmap -
      timeNanoseconds -
  • Method Details

    • getTimeMilliseconds

      public long getTimeMilliseconds()
      Returns:
      the timeMilliseconds
    • setTimeMilliseconds

      public void setTimeMilliseconds(long timeMilliseconds)
      Parameters:
      timeMilliseconds - the timeMilliseconds to set
    • getTimeNanoseconds

      public Long getTimeNanoseconds()
      Returns:
      the timeNanoseconds
    • setTimeNanoseconds

      public void setTimeNanoseconds(Long timeNanoseconds)
      Parameters:
      timeNanoseconds - the timeNanoseconds to set
    • getChannelBitmap

      public int getChannelBitmap()
      Returns:
      the channelBitmap
    • setChannelBitmap

      public void setChannelBitmap(int channelBitmap)
      Parameters:
      channelBitmap - the channelBitmap to set
    • getUID

      public long getUID()
      Returns:
      the uid
    • setUID

      public void setUID(long uid)
      Parameters:
      uid - the uid to set
    • getStartSample

      public Long getStartSample()
      Returns:
      the startSample
    • setStartSample

      public void setStartSample(Long startSample)
      Parameters:
      startSample - the startSample to set
    • getSampleDuration

      public Long getSampleDuration()
      Returns:
      the sampleDuration
    • setSampleDuration

      public void setSampleDuration(Long sampleDuration)
      Parameters:
      sampleDuration - the sampleDuration to set
    • getMillisecondDuration

      public Double getMillisecondDuration()
      Returns:
      the millisecondDuration
    • setMillisecondDuration

      public void setMillisecondDuration(Double millisecondDuration)
      Parameters:
      millisecondDuration - the millisecondDuration to set
    • getS1Contents

      public short getS1Contents()
      Returns:
      the s1Contents
    • getBaseDataBinaryLength

      public int getBaseDataBinaryLength()
      Get the number of bytes which are going to be written to save all this data. Note that currently the S1_TIMEDELAYSSECONDS flag corresponds to the timeDelaysSeconds array, which is variable length. Therefore it is handled as a special case in the code below.
      Returns:
      number of bytes to be written.
    • readBaseData

      public boolean readBaseData(DataInputStream inputStream, int fileVersion) throws IOException
      Read basic data for data units from an input stream.
      Parameters:
      inputStream - Input stream (generally a file, network socket or byte array)
      fileVersion - Format version number.
      Returns:
      true
      Throws:
      IOException
    • writeBaseData

      public boolean writeBaseData(DataOutputStream outputStream, int fileVersion) throws IOException
      Write base Data Unit data to an output stream
      Parameters:
      outputStream - output stream (generally a file, network socket or byte array)
      fileVersion - file version
      Returns:
      true
      Throws:
      IOException
    • getFrequency

      public double[] getFrequency()
      Set the frequency limits
      Returns:
    • setFrequency

      public void setFrequency(double[] frequency)
      Get the current frequency limits for the data unit
      Parameters:
      frequency -
    • getMeasuredAmplitude

      public double getMeasuredAmplitude()
      Get the measured amplitude
      Returns:
    • setMeasuredAmplitude

      public void setMeasuredAmplitude(double measuredAmplitude)
      set the measured amplitude
      Parameters:
      measuredAmplitude -
    • getMeasuredAmplitudeType

      public int getMeasuredAmplitudeType()
    • setMeasuredAmplitudeType

      public void setMeasuredAmplitudeType(int measuredAmplitudeType)
    • getCalculatedAmlitudeDB

      public double getCalculatedAmlitudeDB()
    • setCalculatedAmlitudeDB

      public void setCalculatedAmlitudeDB(double calculatedAmlitudeDB)
    • getTimeDelaysSeconds

      public double[] getTimeDelaysSeconds()
    • setTimeDelaysSeconds

      public void setTimeDelaysSeconds(double[] timeDelaysSeconds)
    • mergeBaseData

      public void mergeBaseData(DataUnitBaseData baseData)
      Extract any data from baseData that's not already in this one, and add it !
      Parameters:
      dataUnitBaseData -
    • getSequenceBitmap

      public Integer getSequenceBitmap()
      Returns:
      the sequenceBitmap
    • setSequenceBitmap

      public void setSequenceBitmap(Integer sequenceBitmap)
      Parameters:
      sequenceBitmap - the sequenceBitmap to set
    • getSignalExcess

      public float getSignalExcess()
      Returns:
      the signalExcess
    • setSignalExcess

      public void setSignalExcess(float signalExcess)
      Parameters:
      signalExcess - the signalExcess to set
    • setHasBinaryAnnotations

      public void setHasBinaryAnnotations(boolean has)
      Quick method to set flag saying binary store has annotation data which will immediately follow the main data unit data.
      Parameters:
      has - flag to say has annotation data.
    • isHasBinaryAnnotation

      public boolean isHasBinaryAnnotation()
      Returns:
      true if the header indicates that binary annotations are present.
    • clone

      public DataUnitBaseData clone()
    • setEndTime

      public void setEndTime(long endTime)
      Set the end time in milliseconds.
      Parameters:
      endTime -
    • getEndTime

      public long getEndTime()
      Returns:
      The data units end time in milliseconds. If a duration has not been set this will be the same as the start time
    • getNoiseBackground

      public Float getNoiseBackground()
      Returns:
      the noiseBackground
    • setNoiseBackground

      public void setNoiseBackground(Float noiseBackground)
      Parameters:
      noiseBackground - the noiseBackground to set
    • getSignalSPL

      public Float getSignalSPL()
      Returns:
      the signalSPL
    • setSignalSPL

      public void setSignalSPL(Float signalSPL)
      Parameters:
      signalSPL - the signalSPL to set