Skip to content

Commit

Permalink
ICU-20125 numeric values of level constants will not change; fix/upda…
Browse files Browse the repository at this point in the history
…te some docs (#159)
  • Loading branch information
markusicu authored Sep 21, 2018
1 parent 95c9c90 commit 881c504
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 15 deletions.
10 changes: 8 additions & 2 deletions icu4c/source/common/unicode/ubidi.h
Original file line number Diff line number Diff line change
Expand Up @@ -323,6 +323,10 @@
* these special values are designed that way. Also, the implementation
* assumes that UBIDI_MAX_EXPLICIT_LEVEL is odd.
*
* Note: The numeric values of the related constants will not change:
* They are tied to the use of 7-bit byte values (plus the override bit)
* and of the UBiDiLevel=uint8_t data type in this API.
*
* @see UBIDI_DEFAULT_LTR
* @see UBIDI_DEFAULT_RTL
* @see UBIDI_LEVEL_OVERRIDE
Expand Down Expand Up @@ -386,6 +390,8 @@ typedef uint8_t UBiDiLevel;

/**
* Maximum explicit embedding level.
* Same as the max_depth value in the
* <a href="http://www.unicode.org/reports/tr9/#BD2">Unicode Bidirectional Algorithm</a>.
* (The maximum resolved level can be up to <code>UBIDI_MAX_EXPLICIT_LEVEL+1</code>).
* @stable ICU 2.0
*/
Expand Down Expand Up @@ -1996,7 +2002,7 @@ U_CDECL_BEGIN
*
* @return The directional property / Bidi class for the given code point
* <code>c</code> if the default class has been overridden, or
* <code>#U_BIDI_CLASS_DEFAULT=u_getIntPropertyMaxValue(UCHAR_BIDI_CLASS)+1</code>
* <code>u_getIntPropertyMaxValue(UCHAR_BIDI_CLASS)+1</code>
* if the standard Bidi class value for <code>c</code> is to be used.
* @see ubidi_setClassCallback
* @see ubidi_getClassCallback
Expand All @@ -2010,7 +2016,7 @@ U_CDECL_END
/**
* Retrieve the Bidi class for a given code point.
* <p>If a <code>#UBiDiClassCallback</code> callback is defined and returns a
* value other than <code>#U_BIDI_CLASS_DEFAULT=u_getIntPropertyMaxValue(UCHAR_BIDI_CLASS)+1</code>,
* value other than <code>u_getIntPropertyMaxValue(UCHAR_BIDI_CLASS)+1</code>,
* that value is used; otherwise the default class determination mechanism is invoked.</p>
*
* @param pBiDi is the paragraph <code>UBiDi</code> object.
Expand Down
29 changes: 18 additions & 11 deletions icu4j/main/classes/core/src/com/ibm/icu/text/Bidi.java
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,11 @@
* these special values are designed that way. Also, the implementation
* assumes that MAX_EXPLICIT_LEVEL is odd.
*
* <b>See Also:</b>
* <p>Note: The numeric values of the related constants will not change:
* They are tied to the use of 7-bit byte values (plus the override bit)
* and of the byte data type in this API.
*
* <p><b>See Also:</b>
* <ul>
* <li>{@link #LEVEL_DEFAULT_LTR}
* <li>{@link #LEVEL_DEFAULT_RTL}
Expand Down Expand Up @@ -612,6 +616,8 @@ static class Isolate {

/**
* Maximum explicit embedding level.
* Same as the max_depth value in the
* <a href="http://www.unicode.org/reports/tr9/#BD2">Unicode Bidirectional Algorithm</a>.
* (The maximum resolved level can be up to <code>MAX_EXPLICIT_LEVEL+1</code>).
* @stable ICU 3.8
*/
Expand Down Expand Up @@ -4274,9 +4280,10 @@ public void setPara(char[] chars, byte paraLevel, byte[] embeddingLevels)
* in the paragraph.<p>
*
* The BIDI_EMBEDDING attribute in the text, if present, represents
* embedding level information. Negative values from -1 to -62 indicate
* overrides at the absolute value of the level. Positive values from 1 to
* 62 indicate embeddings. Where values are zero or not defined, the base
* embedding level information.
* Negative values indicate overrides at the absolute value of the level.
* Positive values indicate embeddings. (See {@link #MAX_EXPLICIT_LEVEL}.)
* Where values are zero or not defined, the base
* embedding level as determined by the base direction is assumed.<p>
*
* The NUMERIC_SHAPING attribute in the text, if present, converts European
Expand Down Expand Up @@ -4702,7 +4709,7 @@ public BidiClassifier getCustomClassifier() {
/**
* Retrieves the Bidi class for a given code point.
* <p>If a <code>BidiClassifier</code> is defined and returns a value
* other than <code>CLASS_DEFAULT=UCharacter.getIntPropertyMaxValue(UProperty.BIDI_CLASS)+1</code>,
* other than <code>UCharacter.getIntPropertyMaxValue(UProperty.BIDI_CLASS)+1</code>,
* that value is used; otherwise the default class determination mechanism is invoked.
*
* @param c The code point to get a Bidi class for.
Expand Down Expand Up @@ -5293,9 +5300,10 @@ public Bidi(String paragraph, int flags)
* in the paragraph.<p>
*
* The BIDI_EMBEDDING attribute in the text, if present, represents
* embedding level information. Negative values from -1 to -62 indicate
* overrides at the absolute value of the level. Positive values from 1 to
* 62 indicate embeddings. Where values are zero or not defined, the base
* embedding level information.
* Negative values indicate overrides at the absolute value of the level.
* Positive values indicate embeddings. (See {@link #MAX_EXPLICIT_LEVEL}.)
* Where values are zero or not defined, the base
* embedding level as determined by the base direction is assumed.<p>
*
* The NUMERIC_SHAPING attribute in the text, if present, converts European
Expand All @@ -5319,9 +5327,8 @@ public Bidi(AttributedCharacterIterator paragraph)
*
* <p>The embeddings array may be null. If present, the values represent
* embedding level information.
* Negative values from -1 to -{@link #MAX_EXPLICIT_LEVEL}
* indicate overrides at the absolute value of the level.
* Positive values from 1 to {@link #MAX_EXPLICIT_LEVEL} indicate embeddings.
* Negative values indicate overrides at the absolute value of the level.
* Positive values indicate embeddings. (See {@link #MAX_EXPLICIT_LEVEL}.)
* Where values are zero, the base embedding level
* as determined by the base direction is assumed,
* except for paragraph separators which remain at 0 to prevent reordering of paragraphs.</p>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,10 +86,9 @@ public Object getContext() {
*
* @param c Code point to be classified.
* @return An integer representing directional property / Bidi class for the
* given code point <code>c</code>, or Bidi.CLASS_DEFAULT=UCharacter.getIntPropertyMaxValue(UProperty.BIDI_CLASS)+1
* given code point <code>c</code>, or UCharacter.getIntPropertyMaxValue(UProperty.BIDI_CLASS)+1
* to signify that there is no need to override the standard Bidi class for
* the given code point.
* @see Bidi#CLASS_DEFAULT
* @stable ICU 3.8
*/
public int classify(int c) {
Expand Down

0 comments on commit 881c504

Please sign in to comment.