for (int i = 0; i<element.getCharacterClassElementCount(); i++)
{
if (element.getCharacterClassElement(i) instanceof CharacterInterval)
{
CharacterInterval interval = (CharacterInterval)element.getCharacterClassElement(i);
automaton.setType(stateindex, PatternAutomaton.TYPE_MATCH);
automaton.setInterval(stateindex, interval.getMinimum(), interval.getMaximum());
automaton.addTransition(stateindex, laststate);
state = stateindex--;
automaton.addTransition(firststate, state);
}
else if (element.getCharacterClassElement(i) instanceof CharacterSet)
{
CharacterSet set = (CharacterSet)element.getCharacterClassElement(i);
String chars = set.getCharacters();
for (int j = 0; j<chars.length(); j++)
{
automaton.setType(stateindex, PatternAutomaton.TYPE_MATCH);
automaton.setInterval(stateindex, chars.charAt(j), chars.charAt(j));
automaton.addTransition(stateindex, laststate);
state = stateindex--;
automaton.addTransition(firststate, state);
}
}
}
return firststate;
}
else
{
state = stateindex--;
automaton.setType(state, PatternAutomaton.TYPE_MATCHANY);
automaton.setTransitions(state, new int[]{laststate});
for (int i = element.getCharacterClassElementCount()-1; i>=0; i--)
{
if (element.getCharacterClassElement(i) instanceof CharacterInterval)
{
CharacterInterval interval = (CharacterInterval)element.getCharacterClassElement(i);
automaton.setType(stateindex, PatternAutomaton.TYPE_MATCH);
automaton.setInterval(stateindex, interval.getMinimum(), interval.getMaximum());
automaton.setTransitions(stateindex, new int[]{state});
state = stateindex--;
}
else if (element.getCharacterClassElement(i) instanceof CharacterSet)
{