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 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) Set<CAS>
    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) Stack<ASB_impl.StackFrame>
    Stack, which holds StackFrame objects.
    (package private) CAS
    The CAS that was input to the Aggregate AE's process method.
    (package private) CAS
    Holds the next CAS to be returned, if it is known.
    (package private) UimaTimer
    timer for timing processing done during calls to next()
  • Constructor Summary

    Constructors
    Constructor
    Description
    Creates a new AggregateCasIterator for the given input CAS.
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    Returns whether there are any more CASes to be returned.
    Gets the next output CAS.
    private CAS
    This is the main execution control method for the aggregate AE.
    void
    Releases any CASes owned by this CasIterator.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • mInputCas

      CAS mInputCas
      The CAS that was input to the Aggregate AE's process method.
    • casIteratorStack

      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

      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 Details

    • 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 Details

    • hasNext

      public boolean hasNext() throws AnalysisEngineProcessException
      Returns whether there are any more CASes to be returned.
      Specified by:
      hasNext in interface CasIterator
      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 interface CasIterator
      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 interface CasIterator
    • 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 processing
      AnalysisEngineProcessException