ice.util.alg
Class Bidi

java.lang.Object
  extended byice.util.alg.Bidi

public class Bidi
extends Object

An incomplete implementation of the Bidirectional algorithm. This is the way it should be used: First, find out which character set is used. Constants for this are int the CharIO class. Create a Bidi using the createBidi() method. Call getChars() or getString() to get the rearranged text. Note that the resulting characters should be drawn one by one, DO NOT leave it to the subsystem to find out if it should rearrange the letters. Known bugs relating to the HTML 4 pilot: - If more than one text element are on the same line, they will be drawn LTR. - In combo boxes, the drawing of the characters is left to the subsystem, so it depends on the platform whether the rendering is correct.


Field Summary
protected  char[] buf
           
protected  int endPos
           
protected  int id
           
protected  int startPos
           
 
Constructor Summary
protected Bidi(int id, char[] buf, int pos1, int pos2)
           
 
Method Summary
static Bidi createBidi(int id, char[] buf, int pos1, int pos2)
          Creates an instance of the Bidi class.
 char[] getChars()
          Returns the rearranged character buffer.
 String getString()
          Returns a String representing the rearranged character buffer.
protected  StringBuffer getStringBuffer()
           
protected  char mirror(char c)
           
protected  void reset()
           
 void setChars(char[] buf, int pos1, int pos2)
          Updates the character buffer of the Bidi instance.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

buf

protected char[] buf

startPos

protected int startPos

endPos

protected int endPos

id

protected int id
Constructor Detail

Bidi

protected Bidi(int id,
               char[] buf,
               int pos1,
               int pos2)
Method Detail

createBidi

public static Bidi createBidi(int id,
                              char[] buf,
                              int pos1,
                              int pos2)
Creates an instance of the Bidi class.

Parameters:
id - An integer specifying the preferred character set of the Bidi.
buf - The character buffer to rearrange.
pos1 - The first position in the buffer.
pos2 - The position after the last position in the buffer.
Returns:
An instance of Bidi.

setChars

public void setChars(char[] buf,
                     int pos1,
                     int pos2)
Updates the character buffer of the Bidi instance.

Parameters:
buf - The new character buffer to rearrange.
pos1 - The first position in the buffer.
pos2 - The position after the last position in the buffer.

getChars

public char[] getChars()
Returns the rearranged character buffer.

Returns:
The rearranged array of characters.

getString

public String getString()
Returns a String representing the rearranged character buffer.

Returns:
The rearranged String.

reset

protected void reset()

getStringBuffer

protected StringBuffer getStringBuffer()

mirror

protected char mirror(char c)