scolebourne    2004/08/28 04:46:19

  Modified:    lang/src/java/org/apache/commons/lang Tokenizer.java
  Log:
  Rename end to pos, fix spelling, avoid new String()
  
  Revision  Changes    Path
  1.9       +23 -23    
jakarta-commons/lang/src/java/org/apache/commons/lang/Tokenizer.java
  
  Index: Tokenizer.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-commons/lang/src/java/org/apache/commons/lang/Tokenizer.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- Tokenizer.java    28 Aug 2004 09:21:05 -0000      1.8
  +++ Tokenizer.java    28 Aug 2004 11:46:19 -0000      1.9
  @@ -548,7 +548,7 @@
               if (start == len && delim.isMatch(chars[start - 1])) {
                   // Add the token, following the rules
                   // in this object
  -                addToken(tokens, new String());
  +                addToken(tokens, StringUtils.EMPTY);
               }
           }
   
  @@ -629,12 +629,12 @@
           // Loop until we've found the end of the quoted
           // string or the end of the input
           int cbufcnt = 0;
  -        int end = start + 1;
  +        int pos = start + 1;
           boolean done = false;
           boolean quoting = true;
           int len = chars.length;
   
  -        while (end < len && !done) {
  +        while (pos < len && !done) {
               // Quoting mode can occur several times throughout
               // a given string, so must switch between quoting
               // and non-quoting until we encounter a non-quoted
  @@ -645,21 +645,21 @@
                   // followed by a second quote.  If so, then we need
                   // to actually put the quote character into the token
                   // rather than end the token.
  -                if (quote.isMatch(chars[end]) &&
  -                        end + 1 < len &&
  -                        chars[end + 1] == chars[end]) {
  -                    cbuf[cbufcnt++] = chars[end];
  -                    end++;
  +                if (quote.isMatch(chars[pos]) &&
  +                        pos + 1 < len &&
  +                        chars[pos + 1] == chars[pos]) {
  +                    cbuf[cbufcnt++] = chars[pos];
  +                    pos++;
                   }
                   // End the quoting if we get to this condition
  -                else if (quote.isMatch(chars[end])) {
  +                else if (quote.isMatch(chars[pos])) {
                       quoting = false;
                   }
                   // Otherwise, just put the character into the token
                   else {
  -                    cbuf[cbufcnt++] = chars[end];
  +                    cbuf[cbufcnt++] = chars[pos];
                   }
  -                end++;
  +                pos++;
               }
               // If we're not in quoting mode, if we encounter
               // a delimiter, the token is ended.  If we encounter
  @@ -667,22 +667,22 @@
               // the character
               else {
                   // If we're
  -                if (delim.isMatch(chars[end])) {
  +                if (delim.isMatch(chars[pos])) {
                       done = true;
                   } else {
  -                    if (quote.isMatch(chars[end])) {
  +                    if (quote.isMatch(chars[pos])) {
                           quoting = true;
                       } else {
  -                        cbuf[cbufcnt++] = chars[end];
  +                        cbuf[cbufcnt++] = chars[pos];
                       }
  -                    end++;
  +                    pos++;
                   }
               }
           }
   
           token.append(cbuf, 0, cbufcnt);
   
  -        return end + 1;
  +        return pos + 1;
       }
   
       /**
  @@ -698,14 +698,14 @@
           int len = chars.length;
           // Skip ahead until we get to a delimiter character, or
           // the end of the input
  -        int end = start + 1;
  -        while (end < len && !delim.isMatch(chars[end])) {
  -            end++;
  +        int pos = start + 1;
  +        while (pos < len && !delim.isMatch(chars[pos])) {
  +            pos++;
           }
   
  -        token.append(chars, start, Math.min(end, len) - start);
  +        token.append(chars, start, Math.min(pos, len) - start);
   
  -        return end + 1;
  +        return pos + 1;
       }
   
       /**
  @@ -1001,7 +1001,7 @@
           }
   
           /**
  -         * Returns whether or not the given charatcer matches.
  +         * Returns whether or not the given character matches.
            * 
            * @param ch the character to match.
            * @return whether or not the given charatcer matches.
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to