public boolean hasNext() throws AnalysisEngineProcessException { enterProcess(); try { return mAnalysisComponent.hasNext(); } finally { exitProcess(); } }
public CAS next() throws AnalysisEngineProcessException { enterProcess(); try { // Make sure that the AnalysisComponent has a next output CAS to // return boolean analysisComponentHasNext = mAnalysisComponent.hasNext(); if (!analysisComponentHasNext) { throw new UIMA_IllegalStateException(UIMA_IllegalStateException.NO_NEXT_CAS, new Object[0]); } // call AnalyaisComponent.next method to populate CAS try { CAS cas = callAnalysisComponentNext(); // cas.setParentID(mOriginalCas.getID()); return cas; } catch (Exception e) { if (e instanceof AnalysisEngineProcessException) { throw (AnalysisEngineProcessException) e; } throw new AnalysisEngineProcessException(e); } } finally { exitProcess(); } }
public boolean hasNext() throws AnalysisEngineProcessException { enterProcess(); if (casAvailable) { return true; } UimaContext prevContext = UimaContextHolder.setContext(getUimaContext()); // for use by POJOs try { casAvailable = mMyAnalysisComponent.hasNext(); if (!casAvailable) { //when hasNext returns false, by contract the AnalysisComponent is done processing its //input CAS. Now is the time to clear the currentComponentInfo to indicate that the //CAS is no longer being processed. mInputCas.setCurrentComponentInfo(null); ((CASImpl)mInputCas).restoreClassLoaderUnlockCas(); } return casAvailable; } catch (Exception e) { ((CASImpl)mInputCas).restoreClassLoaderUnlockCas(); if (e instanceof AnalysisEngineProcessException) { throw (AnalysisEngineProcessException) e; } throw new AnalysisEngineProcessException(e); } finally { UimaContextHolder.setContext(prevContext); exitProcess(); } }