net.sf.okapi.lib.xliff2.matches

## Class Match

- java.lang.Object
- - net.sf.okapi.lib.xliff2.matches.Match

- All Implemented Interfaces:
    IWithExtAttributes, IWithExtElements, IWithMetadata, IWithStore

      public class Match
      extends java.lang.Object
      implements IWithExtElements, IWithExtAttributes, IWithMetadata, IWithStore

  Represents the <match> element of the Translation Candidates module.

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static java.lang.String` | `DEFAULT_TYPE` Default value for the `type` attribute of <match>.

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `Match()` Creates a new empty `Match` object.
    `Match(Match original)` Copy constructor

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `static Match` | `annotate(Fragment fragment, int start, int end, Match match)` Tries to reuse an existing `mtc:match` annotation to add a given match.
    `java.lang.String` | `getAnnotatorRef()` Gets the ITS annotator reference for this match.
    `ExtAttributes` | `getExtAttributes()` Gets the `ExtAttributes` object for the parent object.
    `java.lang.String` | `getExtAttributeValue(java.lang.String namespaceURI, java.lang.String localName)` Gets the value for a given extension attribute.
    `ExtElements` | `getExtElements()` Gets the `ExtElements` object associated with this object.
    `java.lang.String` | `getId()` Gets the id for this match.
    `java.lang.Double` | `getMatchQuality()` Gets the quality for this match.
    `java.lang.Double` | `getMatchSuitability()` Gets the suitability for this match.
    `Metadata` | `getMetadata()` Gets the `Metadata` object for the parent, creates an empty of if there is none.
    `java.lang.Double` | `getMTConfidence()` Gets the ITS MT Confidence for this match.
    `java.lang.String` | `getOrigin()` Gets the origin for this match.
    `java.lang.String` | `getRef()` Gets the ref for this match.
    `java.lang.Double` | `getSimilarity()` Gets the similarity value for this match
    `Fragment` | `getSource()` Gets the source fragment for this match.
    `Directionality` | `getSourceDir()`
    `Store` | `getStore()` Gets the `Store` object associated with this match.
    `java.lang.String` | `getSubType()` Gets the subType for this match.
    `Fragment` | `getTarget()` Gets the target fragment for this match.
    `Directionality` | `getTargetDir()`
    `java.lang.String` | `getType()` Gets the type for this match.
    `boolean` | `hasExtAttribute()` Indicates if at least one extension attribute is present.
    `boolean` | `hasExtElements()` Indicates if there is a `ExtElements` object associated with this object.
    `boolean` | `hasMetadata()` Indicates if the object has metadata.
    `boolean` | `isIdUsed(java.lang.String id)` Indicates if a given id value is already in use in the object (for a `Part` or for a `Tag`).
    `boolean` | `isReference()` Gets the reference for this match.
    `void` | `setAnnoatorRef(java.lang.String annotatorRef)` Sets the the ITS annotator reference for this match.
    `void` | `setExtAttributes(ExtAttributes attributes)` Sets the `ExtAttributes` object associated with this object.
    `ExtElements` | `setExtElements(ExtElements elements)` Sets the `ExtElements` object associated with this object.
    `void` | `setId(java.lang.String id)` Sets the id for this match.
    `void` | `setMatchQuality(java.lang.Double matchQuality)` Sets the quality for this match.
    `void` | `setMatchSuitability(java.lang.Double matchSuitability)` Sets the suitability for this match.
    `void` | `setMetadata(Metadata metadata)` sets the `Metadata` object for the parent.
    `void` | `setMTConfidence(java.lang.Double mtConfidence)` Sets the ITS MT Confidence for this match.
    `void` | `setOrigin(java.lang.String origin)` Sets the origin for this match.
    `void` | `setRef(java.lang.String ref)` Sets the ref for this match.
    `void` | `setReference(boolean reference)` Sets the reference for this match.
    `void` | `setSimilarity(java.lang.Double similarity)` Sets the similarity value for this match.
    `void` | `setSource(Fragment source)` Sets the source fragment for this match.
    `void` | `setSourceDir(Directionality dir)`
    `void` | `setSubType(java.lang.String subType)` Sets the subType for this match.
    `void` | `setTarget(Fragment target)` Sets the target fragment for this match.
    `void` | `setTargetDir(Directionality dir)`
    `void` | `setType(java.lang.String type)` Sets the type for this match.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### DEFAULT_TYPE

          public static final java.lang.String DEFAULT_TYPE

      Default value for the `type` attribute of <match>.
      See Also:
        Constant Field Values

  - ### Constructor Detail

    - #### Match

          public Match()

      Creates a new empty `Match` object.

    - #### Match

          public Match(Match original)

      Copy constructor
      Parameters:
        `original` - the original object to duplicate.

  - ### Method Detail

    - #### annotate

          public static Match annotate(Fragment fragment,
                       int start,
                       int end,
                       Match match)

      Tries to reuse an existing `mtc:match` annotation to add a given match. If no existing annotation is found for the given span, one is created. The `ref` attribute of the match is set to the id of the annotation, and the match object is added to the list of matches for the unit.
      Parameters:
        `fragment` - the fragment to annotate.
        `start` - the start position (in the coded text)
        `end` - the position just after the last character of the span (in the coded text). You can use -1 to indicate the end of the fragment.
        `match` - the `Match` to set with the annotation.
      Returns:
        the match that was added.

    - #### getStore

          public Store getStore()

      Gets the `Store` object associated with this match.
      Returns:
        the store associated with this match (never null).

    - #### getId

          public java.lang.String getId()

      Gets the id for this match.
      Returns:
        the id for this match (can be null).

    - #### setId

          public void setId(java.lang.String id)

      Sets the id for this match.
      Parameters:
        `id` - the new id to set (can be null).

    - #### getType

          public java.lang.String getType()

      Gets the type for this match.
      Returns:
        the type for this match (never null).

    - #### setType

          public void setType(java.lang.String type)

      Sets the type for this match.
      Parameters:
        `type` - the type to set (Use null to set the default (`DEFAULT_TYPE`)).

    - #### getSubType

          public java.lang.String getSubType()

      Gets the subType for this match.
      Returns:
        the subType for this match (can be null).

    - #### setSubType

          public void setSubType(java.lang.String subType)

      Sets the subType for this match.
      Parameters:
        `subType` - the new subType to set (can be null).

    - #### getSimilarity

          public java.lang.Double getSimilarity()

      Gets the similarity value for this match
      Returns:
        the similarity value for this match (can be null).

    - #### setSimilarity

          public void setSimilarity(java.lang.Double similarity)

      Sets the similarity value for this match.
      Parameters:
        `similarity` - the new similarity value to set (can be null).

    - #### getMatchQuality

          public java.lang.Double getMatchQuality()

      Gets the quality for this match.
      Returns:
        the quality for this match (can be null).
      See Also:
        `getMTConfidence()`

    - #### setMatchQuality

          public void setMatchQuality(java.lang.Double matchQuality)

      Sets the quality for this match.
      Parameters:
        `matchQuality` - the new quality to set (can be null).
      See Also:
        `setMTConfidence(Double)`

    - #### getMatchSuitability

          public java.lang.Double getMatchSuitability()

      Gets the suitability for this match.
      Returns:
        the suitability for this match (can be null).

    - #### setMatchSuitability

          public void setMatchSuitability(java.lang.Double matchSuitability)

      Sets the suitability for this match.
      Parameters:
        `matchSuitability` - the new suitability to set (can be null).

    - #### getRef

          public java.lang.String getRef()

      Gets the ref for this match.
      Returns:
        the ref for this match.

    - #### setRef

          public void setRef(java.lang.String ref)

      Sets the ref for this match.
      Parameters:
        `ref` - the new ref value to set.

    - #### getOrigin

          public java.lang.String getOrigin()

      Gets the origin for this match.
      Returns:
        the origin for this match (can be null).

    - #### setOrigin

          public void setOrigin(java.lang.String origin)

      Sets the origin for this match.
      Parameters:
        `origin` - the new origin value for this match.

    - #### isReference

          public boolean isReference()

      Gets the reference for this match.
      Returns:
        the reference for this match.

    - #### setReference

          public void setReference(boolean reference)

      Sets the reference for this match.
      Parameters:
        `reference` - the new reference value for this match.

    - #### getSource

          public Fragment getSource()

      Gets the source fragment for this match.
      Returns:
        the source fragment for this match.

    - #### setSource

          public void setSource(Fragment source)

      Sets the source fragment for this match.
      Parameters:
        `source` - the new source fragment for this match.

    - #### getTarget

          public Fragment getTarget()

      Gets the target fragment for this match.
      Returns:
        the target fragment for this match.

    - #### setTarget

          public void setTarget(Fragment target)

      Sets the target fragment for this match.
      Parameters:
        `target` - the new target fragment for this match.

    - #### getExtElements

          public ExtElements getExtElements()

      Description copied from interface: `IWithExtElements`
      Gets the `ExtElements` object associated with this object. If none exists one is created.
      Specified by:
        `getExtElements` in interface `IWithExtElements`
      Returns:
        the `ExtElements` object associated with this object. If none exists one is created.

    - #### hasExtElements

          public boolean hasExtElements()

      Description copied from interface: `IWithExtElements`
      Indicates if there is a `ExtElements` object associated with this object.
      Specified by:
        `hasExtElements` in interface `IWithExtElements`
      Returns:
        true if there is a `ExtElements` object associated with this object, false otherwise.

    - #### setExtElements

          public ExtElements setExtElements(ExtElements elements)

      Description copied from interface: `IWithExtElements`
      Sets the `ExtElements` object associated with this object.
      Specified by:
        `setExtElements` in interface `IWithExtElements`
      Parameters:
        `elements` - the `ExtElements` object associated with this object. If null, a new `ExtElements` object is created.
      Returns:
        the `ExtElements` object associated with this object, never null.

    - #### isIdUsed

          public boolean isIdUsed(java.lang.String id)

      Description copied from interface: `IWithStore`
      Indicates if a given id value is already in use in the object (for a `Part` or for a `Tag`).
      Specified by:
        `isIdUsed` in interface `IWithStore`
      Parameters:
        `id` - the id value to lookup.
      Returns:
        true if the value is already used, false otherwise.

    - #### getSourceDir

          public Directionality getSourceDir()

      Specified by:
        `getSourceDir` in interface `IWithStore`

    - #### setSourceDir

          public void setSourceDir(Directionality dir)

      Specified by:
        `setSourceDir` in interface `IWithStore`

    - #### getTargetDir

          public Directionality getTargetDir()

      Specified by:
        `getTargetDir` in interface `IWithStore`

    - #### setTargetDir

          public void setTargetDir(Directionality dir)

      Specified by:
        `setTargetDir` in interface `IWithStore`

    - #### setExtAttributes

          public void setExtAttributes(ExtAttributes attributes)

      Description copied from interface: `IWithExtAttributes`
      Sets the `ExtAttributes` object associated with this object.
      Specified by:
        `setExtAttributes` in interface `IWithExtAttributes`
      Parameters:
        `attributes` - the `ExtAttributes` object associated with this object. If null, a new `ExtAttributes` object is created.

    - #### getExtAttributes

          public ExtAttributes getExtAttributes()

      Description copied from interface: `IWithExtAttributes`
      Gets the `ExtAttributes` object for the parent object. If none exists, one is created.
      Specified by:
        `getExtAttributes` in interface `IWithExtAttributes`
      Returns:
        the `ExtAttributes` object for the parent object, never null.

    - #### hasExtAttribute

          public boolean hasExtAttribute()

      Description copied from interface: `IWithExtAttributes`
      Indicates if at least one extension attribute is present.
      Specified by:
        `hasExtAttribute` in interface `IWithExtAttributes`
      Returns:
        true if at least one extension attribute is present; false otherwise.

    - #### getExtAttributeValue

          public java.lang.String getExtAttributeValue(java.lang.String namespaceURI,
                                              java.lang.String localName)

      Description copied from interface: `IWithExtAttributes`
      Gets the value for a given extension attribute.
      Specified by:
        `getExtAttributeValue` in interface `IWithExtAttributes`
      Parameters:
        `namespaceURI` - the URI of the namespace for the attribute.
        `localName` - the name of the attribute.
      Returns:
        the value of the extension attribute, or null if it does not exist.

    - #### getAnnotatorRef

          public java.lang.String getAnnotatorRef()

      Gets the ITS annotator reference for this match.
      Returns:
        the ITS annotator reference for this match (can be null).

    - #### setAnnoatorRef

          public void setAnnoatorRef(java.lang.String annotatorRef)

      Sets the the ITS annotator reference for this match.
      Parameters:
        `annotatorRef` - the new ITS annotator reference (can be null).

    - #### getMTConfidence

          public java.lang.Double getMTConfidence()

      Gets the ITS MT Confidence for this match. This value is `getMatchQuality()` divided by 100.0.
      Returns:
        the ITS MT Confidence for this match.
      See Also:
        `getMatchQuality()`

    - #### setMTConfidence

          public void setMTConfidence(java.lang.Double mtConfidence)

      Sets the ITS MT Confidence for this match. This value is the same as the `getMatchQuality()` divided by 100.0.
      Parameters:
        `mtConfidence` - the new MT Confidence value to set (can be null).
      See Also:
        `setMatchQuality(Double)`

    - #### hasMetadata

          public boolean hasMetadata()

      Description copied from interface: `IWithMetadata`
      Indicates if the object has metadata.
      Specified by:
        `hasMetadata` in interface `IWithMetadata`

    - #### getMetadata

          public Metadata getMetadata()

      Description copied from interface: `IWithMetadata`
      Gets the `Metadata` object for the parent, creates an empty of if there is none.
      Specified by:
        `getMetadata` in interface `IWithMetadata`
      Returns:
        the `Metadata` object for the parent (can be empty, but never null).

    - #### setMetadata

          public void setMetadata(Metadata metadata)

      Description copied from interface: `IWithMetadata`
      sets the `Metadata` object for the parent.
      Specified by:
        `setMetadata` in interface `IWithMetadata`
      Parameters:
        `metadata` - the new `Metadata` object for the parent.