Class AudioAnnotation

  • All Implemented Interfaces:
    adams.core.CloneHandler, adams.data.container.DataPoint, Serializable, Comparable

    public class AudioAnnotation
    extends adams.data.container.AbstractDataPoint
    Represents a single annotation in an audio trail.
    Author:
    FracPete (fracpete at waikato dot ac dot nz)
    See Also:
    Serialized Form
    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected static adams.core.DateFormat m_DateFormat
      for formatting the timestamp.
      protected HashMap<String,​Object> m_MetaData
      the optional meta-data.
      protected adams.core.TimeMsec m_Timestamp
      the timestamp of the step.
      • Fields inherited from class adams.data.container.AbstractDataPoint

        m_Parent
    • Constructor Summary

      Constructors 
      Constructor Description
      AudioAnnotation()
      Initializes the step with default values.
      AudioAnnotation​(adams.core.TimeMsec timestamp)
      Initializes the step with the given timestamp, but no meta-data.
      AudioAnnotation​(adams.core.TimeMsec timestamp, HashMap<String,​Object> metaData)
      Initializes the step with the given timestamp and meta-data.
    • Field Detail

      • m_Timestamp

        protected adams.core.TimeMsec m_Timestamp
        the timestamp of the step.
      • m_DateFormat

        protected static adams.core.DateFormat m_DateFormat
        for formatting the timestamp.
    • Constructor Detail

      • AudioAnnotation

        public AudioAnnotation()
        Initializes the step with default values.
      • AudioAnnotation

        public AudioAnnotation​(adams.core.TimeMsec timestamp)
        Initializes the step with the given timestamp, but no meta-data.
        Parameters:
        timestamp - the timestamp
      • AudioAnnotation

        public AudioAnnotation​(adams.core.TimeMsec timestamp,
                               HashMap<String,​Object> metaData)
        Initializes the step with the given timestamp and meta-data.
        Parameters:
        timestamp - the timestamp
        metaData - the meta-data, can be null
    • Method Detail

      • assign

        public void assign​(adams.data.container.DataPoint other)
        Obtains the stored variables from the other data point.
        Specified by:
        assign in interface adams.data.container.DataPoint
        Overrides:
        assign in class adams.data.container.AbstractDataPoint
        Parameters:
        other - the data point to get the values from
      • setTimestamp

        public void setTimestamp​(adams.core.TimeMsec value)
        Sets the timestamp.
        Parameters:
        value - the timestamp
      • getTimestamp

        public adams.core.TimeMsec getTimestamp()
        Returns the timestamp.
        Returns:
        the timestamp
      • hasMetaData

        public boolean hasMetaData()
        Checks whether any meta-data is present.
        Returns:
        true if meta-data present
      • setMetaData

        public void setMetaData​(HashMap<String,​Object> value)
        Sets the meta-data to use.
        Parameters:
        value - the meta-data, can be null
      • getMetaData

        public HashMap<String,​Object> getMetaData()
        Returns the meta-data, if any.
        Returns:
        the meta-data, null if none available
      • addMetaData

        public void addMetaData​(String key,
                                Object value)
        Adds the meta-data.
        Parameters:
        key - the key
        value - the value
      • compareTo

        public int compareTo​(Object o)
        Compares the object to another. Only uses timestamp, x and y.
        Specified by:
        compareTo in interface Comparable
        Specified by:
        compareTo in class adams.data.container.AbstractDataPoint
        Parameters:
        o - the object to be compared.
        Returns:
        -1 of smaller, 0 if equal, +1 if larger
      • equals

        public boolean equals​(Object obj)
        Checks whether the provided object is a Step with the same timestamp and X/Y.
        Overrides:
        equals in class adams.data.container.AbstractDataPoint
        Parameters:
        obj - the reference object with which to compare.
        Returns:
        true if the same step
        See Also:
        compareTo(Object)
      • toString

        public String toString()
        Returns a string representation of the point.
        Specified by:
        toString in class adams.data.container.AbstractDataPoint
        Returns:
        the string representation