com.ibm.icu.text
Class BidiClassifier

java.lang.Object
  extended by com.ibm.icu.text.BidiClassifier

public class BidiClassifier
extends Object

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.

See Also:
Bidi.setCustomClassifier(com.ibm.icu.text.BidiClassifier)
Status:
Draft ICU 3.8.

Field 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.
 
Constructor Summary
BidiClassifier(Object context)
           
 
Method Summary
 int classify(int c)
          Gets customized Bidi class for the code point c.
 Object getContext()
          Returns the current classifier context.
 void setContext(Object context)
          Sets classifier context, which can be used either by a caller or callee for various purposes.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

context

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.

Status:
Draft ICU 3.8.
Constructor Detail

BidiClassifier

public BidiClassifier(Object context)
Parameters:
context - Context for this classifier instance. May be null.
Status:
Draft ICU 3.8.
Method Detail

setContext

public void setContext(Object context)
Sets classifier context, which can be used either by a caller or callee for various purposes.

Parameters:
context - Context for this classifier instance. May be null.
Status:
Draft ICU 3.8.

getContext

public Object getContext()
Returns the current classifier context.

Status:
Draft ICU 3.8.

classify

public int classify(int c)
Gets customized Bidi class for the code point c.

Default implementation, to be overridden.

Parameters:
c - Code point to be classified.
Returns:
An integer representing directional property / Bidi class for the given code point c, or CLASS_DEFAULT to signify that there is no need to override the standard Bidi class for the given code point.
See Also:
Bidi.CLASS_DEFAULT
Status:
Draft ICU 3.8.


Copyright (c) 2009 IBM Corporation and others.