net.sf.okapi.common.pipelinedriver

## Class BatchItemContext

- java.lang.Object
- - net.sf.okapi.common.BaseContext
  - - net.sf.okapi.common.pipelinedriver.BatchItemContext

- All Implemented Interfaces:
    IContext, IBatchItemContext

      public class BatchItemContext
      extends BaseContext
      implements IBatchItemContext

  Default implementation of the `IBatchItemContext` interface.

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `BatchItemContext()` Creates a new empty BatchItemContext object.
    `BatchItemContext(RawDocument rawDoc, java.net.URI outputURI, java.lang.String outputEncoding)` Creates a new BatchItemContext object and initializes it with a given `RawDocument` and additional arguments.
    `BatchItemContext(RawDocument rawDoc, java.net.URI outputURI, java.lang.String outputEncoding, RawDocument... rawDocs)` Creates a new BatchItemContext object and initializes it with a given `RawDocument` and additional arguments.
    `BatchItemContext(java.net.URI inputURI, java.lang.String defaultEncoding, java.lang.String filterConfigId, java.net.URI outputURI, java.lang.String outputEncoding, LocaleId sourceLocale, LocaleId targetLocale)` Creates a new BatchItemContext object and initializes it based on a given input URI and additional arguments.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `add(DocumentData data)` Adds a document to the list of inputs for this batch item.
    `void` | `add(RawDocument rawDoc, java.net.URI outputURI, java.lang.String outputEncoding)` Adds a document to the list of inputs for this batch item using the provided arguments.
    `java.lang.String` | `getFilterConfigurationId(int index)` Gets the filter configuration identifier for a given input document of this batch item.
    `java.lang.String` | `getOutputEncoding(int index)` Gets the output encoding for a given input document of this batch item.
    `java.net.URI` | `getOutputURI(int index)` Gets the output URI for a given input document of this batch item.
    `RawDocument` | `getRawDocument(int index)` Gets a RawDocument object from the given input document of this batch item.
    `LocaleId` | `getSourceLocale(int index)` Gets the source locale for a given input document of this batch item.
    `LocaleId` | `getTargetLocale(int index)` Gets the target locale for a given input document of this batch item.

    - ### Methods inherited from class net.sf.okapi.common.BaseContext

      `clearAnnotations, clearProperties, getAnnotation, getBoolean, getInteger, getObject, getProperties, getString, removeProperty, setAnnotation, setBoolean, setInteger, setObject, setString`

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

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

- - ### Constructor Detail

    - #### BatchItemContext

          public BatchItemContext()

      Creates a new empty BatchItemContext object.

    - #### BatchItemContext

          public BatchItemContext(RawDocument rawDoc,
                                  java.net.URI outputURI,
                                  java.lang.String outputEncoding)

      Creates a new BatchItemContext object and initializes it with a given `RawDocument` and additional arguments.
      Parameters:
        `rawDoc` - the `RawDocument` to use as the main input document.
        `outputURI` - the output URI of the input document (can be null if not used).
        `outputEncoding` - the output encoding (can be null if not used).

    - #### BatchItemContext

          public BatchItemContext(RawDocument rawDoc,
                                  java.net.URI outputURI,
                                  java.lang.String outputEncoding,
                                  RawDocument... rawDocs)

      Creates a new BatchItemContext object and initializes it with a given `RawDocument` and additional arguments.
      Parameters:
        `rawDoc` - the `RawDocument` to use as the main input document.
        `outputURI` - the output URI of the input document (can be null if not used).
        `outputEncoding` - the output encoding (can be null if not used).
        `rawDocs` - one or more RawDocuments to include in this item.

    - #### BatchItemContext

          public BatchItemContext(java.net.URI inputURI,
                                  java.lang.String defaultEncoding,
                                  java.lang.String filterConfigId,
                                  java.net.URI outputURI,
                                  java.lang.String outputEncoding,
                                  LocaleId sourceLocale,
                                  LocaleId targetLocale)

      Creates a new BatchItemContext object and initializes it based on a given input URI and additional arguments.
      Parameters:
        `inputURI` - the URI of the main input document
        `defaultEncoding` - the default encoding of the input document.
        `filterConfigId` - the filter configuration ID (can be null if not used)
        `outputURI` - the output URI (can be null if not used).
        `outputEncoding` - the output encoding (can be null if not used)
        `sourceLocale` - the source locale.
        `targetLocale` - the target locale.

  - ### Method Detail

    - #### add

          public void add(DocumentData data)

      Adds a document to the list of inputs for this batch item.
      Parameters:
        `data` - the data of the document.

    - #### add

          public void add(RawDocument rawDoc,
                          java.net.URI outputURI,
                          java.lang.String outputEncoding)

      Adds a document to the list of inputs for this batch item using the provided arguments.
      Parameters:
        `rawDoc` - the `RawDocument` to use as the main input document.
        `outputURI` - the output URI of the input document (can be null if not used).
        `outputEncoding` - the output encoding (can be null if not used).

    - #### getFilterConfigurationId

          public java.lang.String getFilterConfigurationId(int index)

      Description copied from interface: `IBatchItemContext`
      Gets the filter configuration identifier for a given input document of this batch item.
      Specified by:
        `getFilterConfigurationId` in interface `IBatchItemContext`
      Parameters:
        `index` - the zero-based index of the input document.
      Returns:
        the filter configuration identifier of the given the input document.

    - #### getOutputEncoding

          public java.lang.String getOutputEncoding(int index)

      Description copied from interface: `IBatchItemContext`
      Gets the output encoding for a given input document of this batch item.
      Specified by:
        `getOutputEncoding` in interface `IBatchItemContext`
      Parameters:
        `index` - the zero-based index of the input document.
      Returns:
        the output encoding of the given the input document, or null if there is no output encoding for the given input.

    - #### getOutputURI

          public java.net.URI getOutputURI(int index)

      Description copied from interface: `IBatchItemContext`
      Gets the output URI for a given input document of this batch item.
      Specified by:
        `getOutputURI` in interface `IBatchItemContext`
      Parameters:
        `index` - the zero-based index of the input document.
      Returns:
        the output URI of the given the input document, or null if there is no output URI for the given input.

    - #### getRawDocument

          public RawDocument getRawDocument(int index)

      Description copied from interface: `IBatchItemContext`
      Gets a RawDocument object from the given input document of this batch item.
      Specified by:
        `getRawDocument` in interface `IBatchItemContext`
      Parameters:
        `index` - the zero-based index of the input document.
      Returns:
        the RawDocument object from the given input document, or null if there is no RawDocument for the given input.

    - #### getSourceLocale

          public LocaleId getSourceLocale(int index)

      Description copied from interface: `IBatchItemContext`
      Gets the source locale for a given input document of this batch item.
      Specified by:
        `getSourceLocale` in interface `IBatchItemContext`
      Parameters:
        `index` - the zero-based index of the input document.
      Returns:
        the source locale of the given the input document, or null if there is no source locale for the given input.

    - #### getTargetLocale

          public LocaleId getTargetLocale(int index)

      Description copied from interface: `IBatchItemContext`
      Gets the target locale for a given input document of this batch item.
      Specified by:
        `getTargetLocale` in interface `IBatchItemContext`
      Parameters:
        `index` - the zero-based index of the input document.
      Returns:
        the target locale of the given the input document, or null if there is no target locale for the given input.