BaseToken token = (BaseToken) tokens.get(i);
Iterator machineItr = iv_machineSet.iterator();
while (machineItr.hasNext())
{
Machine fsm = (Machine) machineItr.next();
fsm.input(token);
State currentState = fsm.getCurrentState();
if (currentState.getStartStateFlag())
{
tokenStartMap.put(fsm, new Integer(i));
}
if (currentState.getEndStateFlag())
{
Object o = tokenStartMap.get(fsm);
int tokenStartIndex;
if (o == null)
{
// By default, all machines start with
// token zero.
tokenStartIndex = 0;
}
else
{
tokenStartIndex = ((Integer) o).intValue();
// skip ahead over single token we don't want
tokenStartIndex++;
}
BaseToken endToken = null;
if (currentState instanceof NonTerminalEndState)
{
endToken = (BaseToken) tokens.get(i - 1);
}
else
{
endToken = token;
}
BaseToken startToken = (BaseToken) tokens
.get(tokenStartIndex);
NegationIndicator neg = null;
if (fsm.equals(iv_negInitialDetermineMachine))
{
neg = new NegationIndicator(
startToken.getStartOffset(),
endToken.getEndOffset());
}
else neg = new NegationIndicator(
startToken.getStartOffset(),
endToken.getEndOffset());
outSet.add(neg);
fsm.reset();
}
}
}
// cleanup
tokenStartMap.clear();
// reset machines
Iterator itr = iv_machineSet.iterator();
while (itr.hasNext())
{
Machine fsm = (Machine) itr.next();
fsm.reset();
}
return outSet;
}