Am 16.04.2010 10:48, schrieb Ulf Zibis:
On a 2nd thought, I think a code point in the surrogate range should be rare, as it is kinda invalid. So why check it in 1. place.
What is the purpose of the method?
- isNotValidOrSurrogateBMPCodePoint --> includes negative and values > MAX_SUPPLEMENTARY_CODE_POINT - needsSurrogateTreatment --> only includes surrogate and valid supplementary code points

legacy isSupplementary() --> excludes negatives, but includes values > MAX_SUPPLEMENTARY_CODE_POINT


I'm thinking about:
    boolean isBMPCodePoint(int cp, boolean validateSurrogate) {...}

Thinking again, I would drop  isBMPCodePoint(int cp) against:

    boolean isBMPCodePoint(int cp, boolean validateSurrogate) {
return (cp >>> 16) == 0 && !(validateSurrogate && isSurrogate((char)cp));
    }

It would serve more complete the possible use cases.
It would inline to (cp >>> 16) == 0, if validateSurrogate == false.

-Ulf


Reply via email to