trinidad-api/src/main/java/org/apache/myfaces/trinidad/convert/RGBColorFormat.java [267:329]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  public StringBuffer format(
    Color color,
    StringBuffer toAppendTo,
    FieldPosition pos)
  {
    // initialize
    pos.setBeginIndex(0);
    pos.setEndIndex(0);

    // do not attempt to format null color
    if (color == null)
      return toAppendTo;

    boolean inQuote = false; // true when between single quotes
    char prevCh = 0; // previous pattern character
    int count = 0;  // number of time prevCh repeated
    for (int i=0; i < _pattern.length(); ++i)
    {
      char ch = _pattern.charAt(i);
      // Use subFormat() to format a repeated pattern character
      // when a different pattern or non-pattern character is seen
      if (ch != prevCh && count > 0)
      {
        toAppendTo = _subFormat(color, prevCh, count, toAppendTo);
        count = 0;
      }
      if (ch == '\'')
      {
        // Consecutive single quotes are a single quote literal,
        // either outside of quotes or between quotes
        if ((i+1) < _pattern.length() &&
            _pattern.charAt(i+1) == '\'')
        {
          toAppendTo.append('\'');
          ++i;
        }
        else
        {
          inQuote = !inQuote;
        }
      }
      else if (!inQuote &&
               (ch >= 'a' && ch <= 'z' || ch >= 'A' && ch <= 'Z'))
      {
        // ch is a date-time pattern character to be interpreted
        // by subFormat(); count the number of times it is repeated
        prevCh = ch;
        ++count;
      }
      else
      {
        // Append quoted characters and unquoted non-pattern characters
        toAppendTo.append(ch);
      }
    }
    // Format the last item in the pattern, if any
    if (count > 0)
    {
      toAppendTo = _subFormat(color, prevCh, count, toAppendTo);
    }

    return toAppendTo;
  }
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/share/text/RGBColorFormat.java [263:325]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  public StringBuffer format(
    Color color,
    StringBuffer toAppendTo,
    FieldPosition pos)
  {
    // initialize
    pos.setBeginIndex(0);
    pos.setEndIndex(0);

    // do not attempt to format null color
    if (color == null)
      return toAppendTo;

    boolean inQuote = false; // true when between single quotes
    char prevCh = 0; // previous pattern character
    int count = 0;  // number of time prevCh repeated
    for (int i=0; i < _pattern.length(); ++i) 
    {
      char ch = _pattern.charAt(i);
      // Use subFormat() to format a repeated pattern character
      // when a different pattern or non-pattern character is seen
      if (ch != prevCh && count > 0) 
      {
        toAppendTo = _subFormat(color, prevCh, count, toAppendTo);
        count = 0;
      }
      if (ch == '\'') 
      {
        // Consecutive single quotes are a single quote literal,
        // either outside of quotes or between quotes
        if ((i+1) < _pattern.length() && 
            _pattern.charAt(i+1) == '\'') 
        {
          toAppendTo.append('\'');
          ++i;
        } 
        else 
        {
          inQuote = !inQuote;
        }
      } 
      else if (!inQuote && 
               (ch >= 'a' && ch <= 'z' || ch >= 'A' && ch <= 'Z')) 
      {
        // ch is a date-time pattern character to be interpreted
        // by subFormat(); count the number of times it is repeated
        prevCh = ch;
        ++count;
      }
      else 
      {
        // Append quoted characters and unquoted non-pattern characters
        toAppendTo.append(ch);
      }
    }
    // Format the last item in the pattern, if any
    if (count > 0) 
    {
      toAppendTo = _subFormat(color, prevCh, count, toAppendTo);
    }
    
    return toAppendTo;
  }
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



