Пример #1
0
 /**
  * Adds a transition to this tree. If the lower-case flag is
  * set, the character will be converted to lower-case before
  * being added.
  *
  * @param c              the character to transition for
  * @param lowerCase      the lower-case conversion flag
  * @param state          the state to transition to
  */
 public void Add(char c, bool lowerCase, DFAState state)
 {
     if (lowerCase)
     {
         c = Char.ToLower(c);
     }
     if (value == '\0')
     {
         this.value = c;
         this.state = state;
         this.left  = new TransitionTree();
         this.right = new TransitionTree();
     }
     else if (value > c)
     {
         left.Add(c, false, state);
     }
     else
     {
         right.Add(c, false, state);
     }
 }
Пример #2
0
 /**
  * Adds a transition to this tree. If the lower-case flag is
  * set, the character will be converted to lower-case before
  * being added.
  *
  * @param c              the character to transition for
  * @param lowerCase      the lower-case conversion flag
  * @param state          the state to transition to
  */
 public void Add(char c, bool lowerCase, DFAState state) {
     if (lowerCase) {
         c = Char.ToLower(c);
     }
     if (value == '\0') {
         this.value = c;
         this.state = state;
         this.left = new TransitionTree();
         this.right = new TransitionTree();
     } else if (value > c) {
         left.Add(c, false, state);
     } else {
         right.Add(c, false, state);
     }
 }