Class CasMultiplier_ImplBase
- java.lang.Object
-
- org.apache.uima.analysis_component.AnalysisComponent_ImplBase
-
- org.apache.uima.analysis_component.CasMultiplier_ImplBase
-
- All Implemented Interfaces:
AnalysisComponent
public abstract class CasMultiplier_ImplBase extends AnalysisComponent_ImplBase
Base class to be extended by CAS Multipliers that use theCASinterface. A CAS Multiplier can produce multiple output CASes while processing an input CAS. SeeAnalysisComponentfor a description of how the framework calls the methods on this interface.
-
-
Field Summary
Fields Modifier and Type Field Description private TypeSystemmLastTypeSystemStores the last type system that this component operated on, so we can tell when typeSystemInit needs to be called.
-
Constructor Summary
Constructors Constructor Description CasMultiplier_ImplBase()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description private voidcheckTypeSystemChange(CAS aCAS)Checks it the type system of the given CAS is different from the last type system this component was operating on.intgetCasInstancesRequired()Returns the maximum number of CAS instances that this CAS Multiplier expects to use at the same time.protected CASgetEmptyCAS()Gets an empty CAS that this CAS Multiplier can then populate.java.lang.Class<CAS>getRequiredCasInterface()Returns the specific CAS interface that this AnalysisComponent requires the framework to pass to itsAnalysisComponent.process(AbstractCas)method.voidprocess(AbstractCas aCAS)Inputs a CAS to the AnalysisComponent.abstract voidprocess(CAS aCAS)This method should be overriden by subclasses.voidtypeSystemInit(TypeSystem aTypeSystem)Informs this annotator that the CAS TypeSystem has changed.-
Methods inherited from class org.apache.uima.analysis_component.AnalysisComponent_ImplBase
batchProcessComplete, collectionProcessComplete, destroy, getContext, getLogger, getResultSpecification, initialize, reconfigure, setResultSpecification
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.apache.uima.analysis_component.AnalysisComponent
hasNext, next
-
-
-
-
Field Detail
-
mLastTypeSystem
private TypeSystem mLastTypeSystem
Stores the last type system that this component operated on, so we can tell when typeSystemInit needs to be called.
-
-
Method Detail
-
getRequiredCasInterface
public final java.lang.Class<CAS> getRequiredCasInterface()
Description copied from interface:AnalysisComponentReturns the specific CAS interface that this AnalysisComponent requires the framework to pass to itsAnalysisComponent.process(AbstractCas)method.- Returns:
- the required CAS interface. This must specify a subtype of
AbstractCas.
-
getCasInstancesRequired
public int getCasInstancesRequired()
Returns the maximum number of CAS instances that this CAS Multiplier expects to use at the same time. Returns a default value of 1, which will be sufficient for most CAS Multipliers. Only if there is a clear need should this be overridden to return something greater than 1.- Returns:
- the number of CAS instances required by this AnalysisComponent.
-
process
public final void process(AbstractCas aCAS) throws AnalysisEngineProcessException
Description copied from interface:AnalysisComponentInputs a CAS to the AnalysisComponent. The AnalysisComponent "owns" this CAS until such time asAnalysisComponent.hasNext()is called and returns false or untilprocessis called again (see class description).- Parameters:
aCAS- A CAS that this AnalysisComponent should process. The framework will ensure that aCAS implements the specific CAS interface specified by theAnalysisComponent.getRequiredCasInterface()method.- Throws:
AnalysisEngineProcessException- if a problem occurs during processing
-
process
public abstract void process(CAS aCAS) throws AnalysisEngineProcessException
This method should be overriden by subclasses. Inputs a CAS to the AnalysisComponent. The AnalysisComponent "owns" this CAS until such time asAnalysisComponent.hasNext()is called and returns false, or until theprocessmethod is called again (seeAnalysisComponentfor details).- Parameters:
aCAS- A CAS that this AnalysisComponent should process.- Throws:
AnalysisEngineProcessException- if a problem occurs during processing
-
typeSystemInit
public void typeSystemInit(TypeSystem aTypeSystem) throws AnalysisEngineProcessException
Informs this annotator that the CAS TypeSystem has changed. The Analysis Engine calls this from PrimitiveAnalysisEngine_impl which-calls CasMultiplier_ImplBase.process which-calls checkTypeSystemChange and will call it again whenever the CAS TypeSystem changes.In this method, the Annotator should use the
TypeSystemto resolve the names of Type and Features to the actualTypeandFeatureobjects, which can then be used during processing.- Parameters:
aTypeSystem- the new type system to use as input to your initialization- Throws:
AnalysisEngineProcessException- if the provided type system is missing types or features required by this annotator
-
getEmptyCAS
protected final CAS getEmptyCAS()
Gets an empty CAS that this CAS Multiplier can then populate.- Returns:
- an empty CAS
-
checkTypeSystemChange
private void checkTypeSystemChange(CAS aCAS) throws AnalysisEngineProcessException
Checks it the type system of the given CAS is different from the last type system this component was operating on. If it is different, calls the typeSystemInit method on the component.- Throws:
AnalysisEngineProcessException
-
-