Class ASB_impl.AggregateCasIterator
- java.lang.Object
-
- org.apache.uima.analysis_engine.asb.impl.ASB_impl.AggregateCasIterator
-
- All Implemented Interfaces:
CasIterator
- Enclosing class:
- ASB_impl
class ASB_impl.AggregateCasIterator extends java.lang.Object implements CasIterator
Inner class implementing the CasIterator returned from the processAndOutputNewCASes(CAS) method. This class contains most of the execution control logic for the aggregate AE.
-
-
Field Summary
Fields Modifier and Type Field Description (package private) java.util.Set<CAS>
activeCASes
Set of CASes that are in circulation (that is, they have been passed to FlowController and the FlowController hasn't yet returned a FinalStep for them).(package private) java.util.Stack<ASB_impl.StackFrame>
casIteratorStack
Stack, which holds StackFrame objects.(package private) CAS
mInputCas
The CAS that was input to the Aggregate AE's process method.(package private) CAS
nextCas
Holds the next CAS to be returned, if it is known.(package private) UimaTimer
timer
timer for timing processing done during calls to next()
-
Constructor Summary
Constructors Constructor Description AggregateCasIterator(CAS inputCas)
Creates a new AggregateCasIterator for the given input CAS.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
hasNext()
Returns whether there are any more CASes to be returned.CAS
next()
Gets the next output CAS.private CAS
processUntilNextOutputCas()
This is the main execution control method for the aggregate AE.void
release()
Releases any CASes owned by this CasIterator.
-
-
-
Field Detail
-
mInputCas
CAS mInputCas
The CAS that was input to the Aggregate AE's process method.
-
casIteratorStack
java.util.Stack<ASB_impl.StackFrame> casIteratorStack
Stack, which holds StackFrame objects. A stack is necessary to handle CasMultipliers, because when a CasMultiplier is invoked we need to save the state of processing of the current CAS and start processing the output CASes instead. Since CasMultipliers can be nested, we need a stack.
-
activeCASes
java.util.Set<CAS> activeCASes
Set of CASes that are in circulation (that is, they have been passed to FlowController and the FlowController hasn't yet returned a FinalStep for them). Needed so we can clean up on error.
-
nextCas
CAS nextCas
Holds the next CAS to be returned, if it is known.
-
timer
UimaTimer timer
timer for timing processing done during calls to next()
-
-
Constructor Detail
-
AggregateCasIterator
public AggregateCasIterator(CAS inputCas) throws AnalysisEngineProcessException
Creates a new AggregateCasIterator for the given input CAS. The CasIterator will return all of the output CASes that this Aggregate AE generates when run on that input CAS, if any.- Parameters:
inputCas
- the CAS to be input to the Aggregate AE (this is the CAS that was passed to the Aggregate AE's processAndOutputNewCASes(CAS) method)- Throws:
AnalysisEngineProcessException
- if processing fails
-
-
Method Detail
-
hasNext
public boolean hasNext() throws AnalysisEngineProcessException
Returns whether there are any more CASes to be returned.- Specified by:
hasNext
in interfaceCasIterator
- Returns:
- true if there are more CASes to be returned, false if not
- Throws:
AnalysisEngineProcessException
- if a failure has occurred during processing. If an exception is thrown, this indicates that processing has aborted, so no further calls to the CasIterator should be made.
-
next
public CAS next() throws AnalysisEngineProcessException
Gets the next output CAS.- Specified by:
next
in interfaceCasIterator
- Returns:
- the next CAS.
- Throws:
AnalysisEngineProcessException
- if a failure has occurred during processing. If an exception is thrown, this indicates that processing has aborted, so no further calls to the CasIterator should be made.
-
release
public void release()
Description copied from interface:CasIterator
Releases any CASes owned by this CasIterator. You only need to Call this method if you stop using a CasIterator before you have iterated all the way through.- Specified by:
release
in interfaceCasIterator
-
processUntilNextOutputCas
private CAS processUntilNextOutputCas() throws AnalysisEngineProcessException
This is the main execution control method for the aggregate AE. It is called by the AggregateCasProcessorCasIterator.next() method. This runs the Aggregate, starting from its current state, until such time as the FlowController indicates a CAS should be returned to the caller. The AggregateCasIterator remembers the state, so calling this method a second time will continue processing from where it left off.- Returns:
- the next CAS to be output. Returns null if the processing of the input CAS has completed.
- Throws:
ProcessingException
- if a failure occurs during processingAnalysisEngineProcessException
-
-