if (shouldEngineBeCalled == true) {
// set result spec for current analysis engine
node.setResultSpec(currentAnalysisResultSpec);
// return current analysis engine node
return new SimpleStepWithResultSpec(node.getCasProcessorKey(), currentAnalysisResultSpec);
} else // no engine left which can be called
{
return new FinalStep();
}
}
} else if (mFlowTable != null) {
AnalysisSequenceCapabilityNode node = null;
// check if document language is included in the flowTable
List flow = (List) mFlowTable.get(documentLanguage);
if (flow == null) // try to get flow without language extension or with x-unspecified
{
// strip language extension if available
int index = documentLanguage.indexOf(LANGUAGE_SEPARATOR);
// if country extension is available
if (index >= 0) {
// check if document language is included in the flowTable
flow = (List) mFlowTable.get(documentLanguage.substring(0, index));
// If the language was not found, use flow for unspecified lang instead.
if (flow == null) {
flow = (List) mFlowTable.get(UNSPECIFIED_LANGUAGE);
}
} else // try to get flow for language x-unspecified
{
flow = (List) mFlowTable.get(UNSPECIFIED_LANGUAGE);
}
}
// if flow is available get next node
if (flow != null) {
if (flow.size() > mIndex) {
node = (AnalysisSequenceCapabilityNode) flow.get(mIndex++);
while (node == null && flow.size() > mIndex) {
node = (AnalysisSequenceCapabilityNode) flow.get(mIndex++);
}
}
}
if (node != null) {
return new SimpleStepWithResultSpec(node.getCasProcessorKey(), node.getResultSpec());
}
}
return new FinalStep();
}