java.text
Class Bidi
static int | DIRECTION_DEFAULT_LEFT_TO_RIGHT - This indicates that a strongly directional character in the text should
set the initial direction, but if no such character is found, then the
initial direction will be left-to-right.
|
static int | DIRECTION_DEFAULT_RIGHT_TO_LEFT - This indicates that a strongly directional character in the text should
set the initial direction, but if no such character is found, then the
initial direction will be right-to-left.
|
static int | DIRECTION_LEFT_TO_RIGHT - This indicates that the initial direction should be left-to-right.
|
static int | DIRECTION_RIGHT_TO_LEFT - This indicates that the initial direction should be right-to-left.
|
Bidi(char[] text, int offset, byte[] embeddings, int embedOffset, int length, int flags) - Create a new Bidi object with the indicated text and, possibly, explicit
embedding settings.
|
Bidi(String text, int flags) - Create a new Bidi object using the contents of the given String
as the text.
|
Bidi(AttributedCharacterIterator iter) - Create a new Bidi object given an attributed character iterator.
|
boolean | baseIsLeftToRight() - Return true if the paragraph base embedding is left-to-right,
false otherwise.
|
Bidi | createLineBidi(int start, int end) - Create a new Bidi object for a single line of text, taken
from the text used when creating the current Bidi object.
|
int | getBaseLevel() - Return the base embedding level of the paragraph.
|
int | getLength() - Return the length of the paragraph, in characters.
|
int | getLevelAt(int offset) - Return the level at the indicated character.
|
int | getRunCount() - Return the number of runs in the result.
|
int | getRunLevel(int which) - Return the level of the indicated run.
|
int | getRunLimit(int which) - Return the index of the character just following the end
of the indicated run.
|
int | getRunStart(int which) - Return the index of the first character in the indicated run.
|
boolean | isLeftToRight() - Return true if the text is entirely left-to-right, and the
base embedding is also left-to-right.
|
boolean | isMixed() - Return true if the text consists of mixed left-to-right and
right-to-left runs, or if the text consists of one kind of run
which differs from the base embedding direction.
|
boolean | isRightToLeft() - Return true if the text is entirely right-to-left, and the
base embedding is also right-to-left.
|
static void | reorderVisually(byte[] levels, int levelOffset, Object[] objs, int objOffset, int count) - Reorder objects according to the levels passed in.
|
static boolean | requiresBidi(char[] text, int start, int end) - Returns false if all characters in the text between start and end
are all left-to-right text.
|
String | toString() - Return a String describing the internal state of this object.
|
clone , equals , extends Object> getClass , finalize , hashCode , notify , notifyAll , toString , wait , wait , wait |
DIRECTION_DEFAULT_LEFT_TO_RIGHT
public static final int DIRECTION_DEFAULT_LEFT_TO_RIGHT
This indicates that a strongly directional character in the text should
set the initial direction, but if no such character is found, then the
initial direction will be left-to-right.
DIRECTION_DEFAULT_RIGHT_TO_LEFT
public static final int DIRECTION_DEFAULT_RIGHT_TO_LEFT
This indicates that a strongly directional character in the text should
set the initial direction, but if no such character is found, then the
initial direction will be right-to-left.
DIRECTION_LEFT_TO_RIGHT
public static final int DIRECTION_LEFT_TO_RIGHT
This indicates that the initial direction should be left-to-right.
DIRECTION_RIGHT_TO_LEFT
public static final int DIRECTION_RIGHT_TO_LEFT
This indicates that the initial direction should be right-to-left.
Bidi
public Bidi(char[] text,
int offset,
byte[] embeddings,
int embedOffset,
int length,
int flags)
Create a new Bidi object with the indicated text and, possibly, explicit
embedding settings.
If the embeddings array is null, it is ignored. Otherwise it is taken to
be explicit embedding settings corresponding to the text. Positive values
from 1 to 61 are embedding levels, and negative values from -1 to -61 are
embedding overrides. (FIXME: not at all clear what this really means.)
text
- the text to useoffset
- the offset of the first character of the textembeddings
- the explicit embeddings, or null if there are noneembedOffset
- the offset of the first embedding value to uselength
- the length of both the text and the embeddingsflags
- a flag indicating the base embedding direction
Bidi
public Bidi(String text,
int flags)
Create a new Bidi object using the contents of the given String
as the text.
text
- the text to useflags
- a flag indicating the base embedding direction
Bidi
public Bidi(AttributedCharacterIterator iter)
Create a new Bidi object given an attributed character iterator.
This constructor will examine various attributes of the text:
iter
- the attributed character iterator to use
baseIsLeftToRight
public boolean baseIsLeftToRight()
Return true if the paragraph base embedding is left-to-right,
false otherwise.
createLineBidi
public Bidi createLineBidi(int start,
int end)
Create a new Bidi object for a single line of text, taken
from the text used when creating the current Bidi object.
start
- the index of the first character of the lineend
- the index of the final character of the line
- a new Bidi object for the indicated line of text
getBaseLevel
public int getBaseLevel()
Return the base embedding level of the paragraph.
getLength
public int getLength()
Return the length of the paragraph, in characters.
getLevelAt
public int getLevelAt(int offset)
Return the level at the indicated character. If the
supplied index is less than zero or greater than the length
of the text, then the paragraph's base embedding level will
be returned.
offset
- the character to examine
- the level of that character
getRunCount
public int getRunCount()
Return the number of runs in the result. A run is
a sequence of characters at the same embedding level.
getRunLevel
public int getRunLevel(int which)
Return the level of the indicated run.
which
- the run to examine
getRunLimit
public int getRunLimit(int which)
Return the index of the character just following the end
of the indicated run.
which
- the run to examine
- the index of the character after the final character
of the run
getRunStart
public int getRunStart(int which)
Return the index of the first character in the indicated run.
which
- the run to examine
- the index of the first character of the run
isLeftToRight
public boolean isLeftToRight()
Return true if the text is entirely left-to-right, and the
base embedding is also left-to-right.
isMixed
public boolean isMixed()
Return true if the text consists of mixed left-to-right and
right-to-left runs, or if the text consists of one kind of run
which differs from the base embedding direction.
isRightToLeft
public boolean isRightToLeft()
Return true if the text is entirely right-to-left, and the
base embedding is also right-to-left.
reorderVisually
public static void reorderVisually(byte[] levels,
int levelOffset,
Object[] objs,
int objOffset,
int count)
Reorder objects according to the levels passed in. This implements
reordering as defined by the Unicode bidirectional layout specification.
The levels are integers from 0 to 62; even numbers represent left-to-right
runs, and odd numbers represent right-to-left runs.
levels
- the levels associated with each objectlevelOffset
- the index of the first level to useobjs
- the objects to reorder according to the levelsobjOffset
- the index of the first object to usecount
- the number of objects (and levels) to manipulate
requiresBidi
public static boolean requiresBidi(char[] text,
int start,
int end)
Returns false if all characters in the text between start and end
are all left-to-right text. This implementation is just calls
Character.getDirectionality(char)
on all characters
and makes sure all characters are either explicitly left-to-right
or neutral in directionality (character types L, EN, ES, ET, AN,
CS, S and WS).
toString
public String toString()
Return a String describing the internal state of this object.
This is only useful for debugging.
- toString in interface Object
Bidi.java -- Bidirectional Algorithm implementation
Copyright (C) 2005, 2006 Free Software Foundation, Inc.
This file is part of GNU Classpath.
GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with GNU Classpath; see the file COPYING. If not, write to the
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 USA.
Linking this library statically or dynamically with other modules is
making a combined work based on this library. Thus, the terms and
conditions of the GNU General Public License cover the whole
combination.
As a special exception, the copyright holders of this library give you
permission to link this library with independent modules to produce an
executable, regardless of the license terms of these independent
modules, and to copy and distribute the resulting executable under
terms of your choice, provided that you also meet, for each linked
independent module, the terms and conditions of the license of that
module. An independent module is a module which is not derived from
or based on this library. If you modify this library, you may extend
this exception to your version of the library, but you are not
obligated to do so. If you do not wish to do so, delete this
exception statement from your version.