I recently found myself addressing a problem I have by writing the
beginnings of what increasingly resembled ECS. So close was the parallel
that much of the code I wrote was identical (except for the naming) in
structure. I've now switched over to ECS and had some observations.

1) The use of HtmlColors with strings is outside what I would have expected
in a Java interface. I think facilitating the use of Java Color objects is
desirable and my approach would have been to declare the constants as Color
instances with standard use of Color arguments in the accessors. Here's some
code to translate between Color and HtmlColor representations:

  public static String toHtmlString(Color color)
  {
    int r = color.getRed();
    int g = color.getGreen();
    int b = color.getBlue();
    int rHi = r / 16;
    int rLo = r % 16;
    int gHi = g / 16;
    int gLo = g % 16;
    int bHi = b / 16;
    int bLo = b % 16;
    return "#" +
      ((rHi < 10) ? (char)('0' + rHi) : (char)('A' + rHi % 10)) +
      ((rLo < 10) ? (char)('0' + rLo) : (char)('A' + rLo % 10)) +
      ((gHi < 10) ? (char)('0' + gHi) : (char)('A' + gHi % 10)) +
      ((gLo < 10) ? (char)('0' + gLo) : (char)('A' + gLo % 10)) +
      ((bHi < 10) ? (char)('0' + bHi) : (char)('A' + bHi % 10)) +
      ((bLo < 10) ? (char)('0' + bLo) : (char)('A' + bLo % 10));
  }

I know this is trivial but you are welcome to use the code in your
infrastructure. I'd be willing to write a convered HtmlColor file for you
(call it ColorConstants for backward compatibility reasons) if you like, but
someone else would have to tackle the accessor conversion and this is not a
decision I can make.

2) I saw notes asking whether anyone was willing to contribute a regular
expression filter class. I recently published (in JavaPro Magazine) a Match
interface with support for regular expressions, standard wildcards, the
'like' algorithm and soundex. I'd be willing to contribute this code to the
project if you are interested.

Let me know what you think. I don't know who's lead or support in the group,
so if you can clarify that in your message, I'd be grateful. Thanks.



--
------------------------------------------------------------
To subscribe:        [EMAIL PROTECTED]
To unsubscribe:      [EMAIL PROTECTED]
Archives and Other:  <http://java.apache.org/main/mail.html>
Problems?:           [EMAIL PROTECTED]

Reply via email to