Top Description Fields Constructors Methods
com.ibm.icu.text

public Class BidiClassifier

extends Object
Class Inheritance

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.

ICU Status
Stable since ICU 3.8.
See Also
Bidi#setCustomClassifier

Field Summary

Modifier and TypeField and Description
protected Object
context

This object can be used for any purpose by the caller to pass information to the BidiClassifier methods, and by the BidiClassifier methods themselves.

Constructor Summary

AccessConstructor and Description
public
BidiClassifier(Object
Context for this classifier instance. May be null.
context
)

Method Summary

Modifier and TypeMethod and Description
public int

Returns:

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.
classify
(int
Code point to be classified.
c
)

Gets customized Bidi class for the code point c.

public Object
getContext()

Returns the current classifier context.

public void
setContext(Object
Context for this classifier instance. May be null.
context
)

Sets classifier context, which can be used either by a caller or callee for various purposes.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

contextback to summary
protected Object context

This object can be used for any purpose by the caller to pass information to the BidiClassifier methods, and by the BidiClassifier methods themselves.
For instance, this object can be used to save a reference to a previous custom BidiClassifier while setting a new one, so as to allow chaining between them.

ICU Status
Stable since ICU 3.8.

Constructor Detail

BidiClassifierback to summary
public BidiClassifier(Object context)
Parameters
context:Object

Context for this classifier instance. May be null.

ICU Status
Stable since ICU 3.8.

Method Detail

classifyback to summary
public int classify(int c)

Gets customized Bidi class for the code point c.

Default implementation, to be overridden.

Parameters
c:int

Code point to be classified.

Returns: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.

ICU Status
Stable since ICU 3.8.
getContextback to summary
public Object getContext()

Returns the current classifier context.

ICU Status
Stable since ICU 3.8.
setContextback to summary
public void setContext(Object context)

Sets classifier context, which can be used either by a caller or callee for various purposes.

Parameters
context:Object

Context for this classifier instance. May be null.

ICU Status
Stable since ICU 3.8.