Stay organized with collections
Save and categorize content based on your preferences.
BidiClassifier
open class BidiClassifier
Overrides default Bidi class values with custom ones.
The override mechanism requires to define a subclass of BidiClassifier
which overrides the classifier
method to assign customized Bidi classes.
This may be useful for assigning Bidi classes to PUA characters, or for special application needs. For instance, an application may want to handle all spaces like L or R characters (according to the base direction) when creating the visual ordering of logical lines which are part of a report organized in columns: there should not be interaction between adjacent cells.
To start using this customized classifier with a Bidi object, it must be specified by calling the Bidi.setCustomClassifier
method; after that, the method classify
of the custom BidiClassifier
will be called by the UBA implementation any time the class of a character is to be determined.
Summary
Public methods |
open Int |
Gets customized Bidi class for the code point c .
|
open Any! |
Returns the current classifier context.
|
open Unit |
Sets classifier context, which can be used either by a caller or callee for various purposes.
|
Public constructors
BidiClassifier
BidiClassifier(context: Any!)
Parameters |
context |
Any!: Context for this classifier instance. May be null. |
Public methods
classify
open fun classify(c: Int): Int
Gets customized Bidi class for the code point c
.
Default implementation, to be overridden.
Parameters |
c |
Int: Code point to be classified. |
Return |
Int |
An integer representing directional property / Bidi class for the given code point c , 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. |
getContext
open fun getContext(): Any!
Returns the current classifier context.
setContext
open fun setContext(context: Any!): Unit
Sets classifier context, which can be used either by a caller or callee for various purposes.
Parameters |
context |
Any!: Context for this classifier instance. May be null. |
Content and code samples on this page are subject to the licenses described in the Content License. Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
Last updated 2025-02-10 UTC.
[null,null,["Last updated 2025-02-10 UTC."],[],[],null,["# BidiClassifier\n\nAdded in [API level 29](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)\n\nBidiClassifier\n==============\n\n*** ** * ** ***\n\nKotlin \\|[Java](/reference/android/icu/text/BidiClassifier \"View this page in Java\") \n\n```\nopen class BidiClassifier\n```\n\n|---|--------------------------------------|\n| [kotlin.Any](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/index.html) ||\n| ↳ | [android.icu.text.BidiClassifier](#) |\n\nOverrides default Bidi class values with custom ones.\n\nThe override mechanism requires to define a subclass of `BidiClassifier` which overrides the `classifier` method to assign customized Bidi classes.\n\nThis may be useful for assigning Bidi classes to PUA characters, or for special application needs. For instance, an application may want to handle all spaces like L or R characters (according to the base direction) when creating the visual ordering of logical lines which are part of a report organized in columns: there should not be interaction between adjacent cells.\n\nTo start using this customized classifier with a Bidi object, it must be specified by calling the `Bidi.setCustomClassifier` method; after that, the method `classify` of the custom `BidiClassifier` will be called by the UBA implementation any time the class of a character is to be determined.\n\nSummary\n-------\n\n| Public constructors ||\n|--------------------------------------------------------------------------------------------------------------------------------------------------|---|\n| [BidiClassifier](#BidiClassifier(kotlin.Any))`(`context:` `[Any](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/index.html)!`)` \u003cbr /\u003e |\n\n| Public methods ||\n|-----------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| open [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | [classify](#classify(kotlin.Int))`(`c:` `[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)`)` Gets customized Bidi class for the code point `c`. |\n| open [Any](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/index.html)! | [getContext](#getContext())`()` Returns the current classifier context. |\n| open [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html) | [setContext](#setContext(kotlin.Any))`(`context:` `[Any](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/index.html)!`)` Sets classifier context, which can be used either by a caller or callee for various purposes. |\n\nPublic constructors\n-------------------\n\n### BidiClassifier\n\nAdded in [API level 29](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nBidiClassifier(context: Any!)\n```\n\n| Parameters ||\n|-----------|---------------------------------------------------------------------------------------------------------------------------------|\n| `context` | [Any](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/index.html)!: Context for this classifier instance. May be null. |\n\nPublic methods\n--------------\n\n### classify\n\nAdded in [API level 29](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nopen fun classify(c: Int): Int\n```\n\nGets customized Bidi class for the code point `c`.\n\nDefault implementation, to be overridden.\n\n| Parameters ||\n|-----|----------------------------------------------------------------------------------------------------------|\n| `c` | [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html): Code point to be classified. |\n\n| Return ||\n|----------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | An integer representing directional property / Bidi class for the given code point `c`, 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. |\n\n### getContext\n\nAdded in [API level 29](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nopen fun getContext(): Any!\n```\n\nReturns the current classifier context. \n\n### setContext\n\nAdded in [API level 29](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nopen fun setContext(context: Any!): Unit\n```\n\nSets classifier context, which can be used either by a caller or callee for various purposes.\n\n| Parameters ||\n|-----------|---------------------------------------------------------------------------------------------------------------------------------|\n| `context` | [Any](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/index.html)!: Context for this classifier instance. May be null. |"]]