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 theIBatchItemContextinterface.
-
-
Constructor Summary
Constructors Constructor Description BatchItemContext()Creates a new empty BatchItemContext object.BatchItemContext(URI inputURI, String defaultEncoding, String filterConfigId, URI outputURI, String outputEncoding, LocaleId sourceLocale, LocaleId targetLocale)Creates a new BatchItemContext object and initializes it based on a given input URI and additional arguments.BatchItemContext(RawDocument rawDoc, URI outputURI, String outputEncoding)Creates a new BatchItemContext object and initializes it with a givenRawDocumentand additional arguments.BatchItemContext(RawDocument rawDoc, URI outputURI, String outputEncoding, RawDocument... rawDocs)Creates a new BatchItemContext object and initializes it with a givenRawDocumentand additional arguments.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidadd(DocumentData data)Adds a document to the list of inputs for this batch item.voidadd(RawDocument rawDoc, URI outputURI, String outputEncoding)Adds a document to the list of inputs for this batch item using the provided arguments.StringgetFilterConfigurationId(int index)Gets the filter configuration identifier for a given input document of this batch item.StringgetOutputEncoding(int index)Gets the output encoding for a given input document of this batch item.URIgetOutputURI(int index)Gets the output URI for a given input document of this batch item.RawDocumentgetRawDocument(int index)Gets a RawDocument object from the given input document of this batch item.LocaleIdgetSourceLocale(int index)Gets the source locale for a given input document of this batch item.LocaleIdgetTargetLocale(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
-
-
-
-
Constructor Detail
-
BatchItemContext
public BatchItemContext()
Creates a new empty BatchItemContext object.
-
BatchItemContext
public BatchItemContext(RawDocument rawDoc, URI outputURI, String outputEncoding)
Creates a new BatchItemContext object and initializes it with a givenRawDocumentand additional arguments.- Parameters:
rawDoc- theRawDocumentto 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, URI outputURI, String outputEncoding, RawDocument... rawDocs)
Creates a new BatchItemContext object and initializes it with a givenRawDocumentand additional arguments.- Parameters:
rawDoc- theRawDocumentto 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(URI inputURI, String defaultEncoding, String filterConfigId, URI outputURI, 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 documentdefaultEncoding- 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, URI outputURI, String outputEncoding)
Adds a document to the list of inputs for this batch item using the provided arguments.- Parameters:
rawDoc- theRawDocumentto 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 String getFilterConfigurationId(int index)
Description copied from interface:IBatchItemContextGets the filter configuration identifier for a given input document of this batch item.- Specified by:
getFilterConfigurationIdin interfaceIBatchItemContext- Parameters:
index- the zero-based index of the input document.- Returns:
- the filter configuration identifier of the given the input document.
-
getOutputEncoding
public String getOutputEncoding(int index)
Description copied from interface:IBatchItemContextGets the output encoding for a given input document of this batch item.- Specified by:
getOutputEncodingin interfaceIBatchItemContext- 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 URI getOutputURI(int index)
Description copied from interface:IBatchItemContextGets the output URI for a given input document of this batch item.- Specified by:
getOutputURIin interfaceIBatchItemContext- 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:IBatchItemContextGets a RawDocument object from the given input document of this batch item.- Specified by:
getRawDocumentin interfaceIBatchItemContext- 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:IBatchItemContextGets the source locale for a given input document of this batch item.- Specified by:
getSourceLocalein interfaceIBatchItemContext- 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:IBatchItemContextGets the target locale for a given input document of this batch item.- Specified by:
getTargetLocalein interfaceIBatchItemContext- 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.
-
-