Class IdMatch


  • public class IdMatch
    extends IdUtterance
    A serializer/deserializer which can be used to generate or interpret a String ID for a search results match.

    This is a subclass of IdUtterance, using the same schema for IDs, with the following extensions:

    • matching subparts can be identified by appending a list of annotation UIDs for insertion into matchAnnotationUids, the keys being enclosed in square brackets:
      ...;[key]=uid;[key]=uid
      e.g. g_243;n_72700-n_72709;[0,0]=ew_0_123;[1,0]ew_0_234
    • a target annotation by appending a uid prefixed by #=:
      ...;#=uid
      e.g. g_243;n_72700-n_72709;#=ew_0_123
    Author:
    Robert Fromont robert@fromont.net.nz
    • Constructor Detail

      • IdMatch

        public IdMatch()
        Default constructor
      • IdMatch

        public IdMatch​(String sId)
        Constructor from string ID.
      • IdMatch

        public IdMatch​(IdMatch other)
        Copy constructor.
    • Method Detail

      • getMatchAnnotationUids

        public Map<String,​String> getMatchAnnotationUids()
        Getter for matchAnnotationUids: A map of keys to annotation UIDs that identify the annotations that matched the query. The keys identify which part of the query was matched.
        Returns:
        A map of keys to annotation UIDs that identify the annotations that matched the query. The keys identify which part of the query was matched.
      • getTargetAnnotationUid

        public String getTargetAnnotationUid()
        The UID of the targeted annotation, which may or may not be listed in matchAnnotationUids.
        Returns:
        The UID of the targeted annotation, which may or may not be listed in matchAnnotationUids.
      • setTargetAnnotationUid

        public IdMatch setTargetAnnotationUid​(String newTargetAnnotationUid)
        The UID of the targeted annotation, which may or may not be listed in matchAnnotationUids.
        Parameters:
        newTargetAnnotationUid - The UID of the targeted annotation, which may or may not be listed in matchAnnotationUids.
      • addMatchAnnotationUid

        public IdMatch addMatchAnnotationUid​(String key,
                                             String uid)
        Adds a single match UID to matchAnnotationUids.
        Parameters:
        key -
        uid -
        Returns:
        This object.
      • setId

        public void setId​(String sId)
        Sets the utterance's attributes using the given identifier.
        Overrides:
        setId in class IdUtterance
        Parameters:
        sId -
      • getId

        public String getId()
        Generates an identifier for this utterance.
        Overrides:
        getId in class IdUtterance
        Returns:
        A uniformly-formatted identifier for this utterance.
      • equals

        public boolean equals​(Object o)
        Determines whether another IMatch is equal to this one.
        Overrides:
        equals in class IdUtterance
        Parameters:
        o - The other object to compare to.
        Returns:
        true if the critical attributes match, false otherwise.
      • hashCode

        @Deprecated
        public int hashCode()
        Deprecated.
        Returns a hash code value for the object. This method is supported for the benefit of hashtables such as those provided by java.util.Hashtable.
        Overrides:
        hashCode in class Object