Package net.sourceforge.chaperon.model.pattern

Examples of net.sourceforge.chaperon.model.pattern.CharacterInterval


      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)
        {
View Full Code Here

TOP

Related Classes of net.sourceforge.chaperon.model.pattern.CharacterInterval

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.