java.awt.font
public final class NumericShaper extends Object implements Serializable
Modifier and Type | Field and Description |
---|---|
static int |
ALL_RANGES
Convenience constant representing all the valid Unicode ranges.
|
static int |
ARABIC
Constant representing the Unicode ARABIC range.
|
static int |
BENGALI
Constant representing the Unicode BENGALI range.
|
static int |
DEVANAGARI
Constant representing the Unicode DEVANAGARI range.
|
static int |
EASTERN_ARABIC
Constant representing the Unicode extended arabic range.
|
static int |
ETHIOPIC
Constant representing the Unicode ETHIOPIC range.
|
static int |
EUROPEAN
Constant representing the Unicode EUROPEAN range.
|
static int |
GUJARATI
Constant representing the Unicode GUJARATI range.
|
static int |
GURMUKHI
Constant representing the Unicode GURMUKHI range.
|
static int |
KANNADA
Constant representing the Unicode KANNADA range.
|
static int |
KHMER
Constant representing the Unicode KHMER range.
|
static int |
LAO
Constant representing the Unicode LAO range.
|
static int |
MALAYALAM
Constant representing the Unicode MALAYALAM range.
|
static int |
MONGOLIAN
Constant representing the Unicode MONGOLIAN range.
|
static int |
MYANMAR
Constant representing the Unicode MYANMAR range.
|
static int |
ORIYA
Constant representing the Unicode ORIYA range.
|
static int |
TAMIL
Constant representing the Unicode TAMIL range.
|
static int |
TELUGU
Constant representing the Unicode TELUGU range.
|
static int |
THAI
Constant representing the Unicode THAI range.
|
static int |
TIBETAN
Constant representing the Unicode TIBETAN range.
|
Modifier and Type | Method and Description |
---|---|
boolean |
equals(Object obj)
Determine whether this Object is semantically equal
to another Object.
|
static NumericShaper |
getContextualShaper(int ranges)
Return a contextual shaper which can shape to any of the indicated
languages.
|
static NumericShaper |
getContextualShaper(int ranges,
int defaultContext)
Return a contextual shaper which can shape to any of the indicated
languages.
|
int |
getRanges()
Return an integer representing all the languages for which this
shaper will shape.
|
static NumericShaper |
getShaper(int singleRange)
Return a non-contextual shaper which can shape to a single range.
|
int |
hashCode()
Get a value that represents this Object, as uniquely as
possible within the confines of an int.
|
boolean |
isContextual()
Return true if this shaper is contextual, false if it is not.
|
void |
shape(char[] text,
int start,
int count)
Shape the text in the given array.
|
void |
shape(char[] text,
int start,
int count,
int context)
Shape the given text, using the indicated initial context.
|
String |
toString()
Convert this Object to a human-readable String.
|
public static final int ALL_RANGES
public static final int ARABIC
public static final int BENGALI
public static final int DEVANAGARI
public static final int EASTERN_ARABIC
public static final int ETHIOPIC
public static final int EUROPEAN
public static final int GUJARATI
public static final int GURMUKHI
public static final int KANNADA
public static final int KHMER
public static final int LAO
public static final int MALAYALAM
public static final int MONGOLIAN
public static final int MYANMAR
public static final int ORIYA
public static final int TAMIL
public static final int TELUGU
public static final int THAI
public static final int TIBETAN
public int getRanges()
public boolean isContextual()
public void shape(char[] text, int start, int count)
text
- the text to shapestart
- the index of the starting character of the arraycount
- the number of characters in the arraypublic void shape(char[] text, int start, int count, int context)
text
- the text to shapestart
- the index of the first character of the text to shapecount
- the number of characters to shape in the textcontext
- the initial contextIllegalArgumentException
- if the initial context is invalidpublic boolean equals(Object obj)
Object
There are some fairly strict requirements on this
method which subclasses must follow:
a.equals(b)
and
b.equals(c)
, then a.equals(c)
must be true as well.a.equals(b)
and
b.equals(a)
must have the same value.a.equals(a)
must
always be true.a.equals(null)
must be false.a.equals(b)
must imply
a.hashCode() == b.hashCode()
.
The reverse is not true; two objects that are not
equal may have the same hashcode, but that has
the potential to harm hashing performance.This is typically overridden to throw a ClassCastException
if the argument is not comparable to the class performing
the comparison, but that is not a requirement. It is legal
for a.equals(b)
to be true even though
a.getClass() != b.getClass()
. Also, it
is typical to never cause a NullPointerException
.
In general, the Collections API (java.util
) use the
equals
method rather than the ==
operator to compare objects. However, IdentityHashMap
is an exception to this rule, for its own good reasons.
The default implementation returns this == o
.
equals
in class Object
obj
- the Object to compare toObject.hashCode()
public int hashCode()
Object
There are some requirements on this method which
subclasses must follow:
a.equals(b)
is true, then
a.hashCode() == b.hashCode()
must be as well.
However, the reverse is not necessarily true, and two
objects may have the same hashcode without being equal.Notice that since hashCode
is used in
Hashtable
and other hashing classes,
a poor implementation will degrade the performance of hashing
(so don't blindly implement it as returning a constant!). Also,
if calculating the hash is time-consuming, a class may consider
caching the results.
The default implementation returns
System.identityHashCode(this)
hashCode
in class Object
Object.equals(Object)
,
System.identityHashCode(Object)
public String toString()
Object
System.out.println()
and such.
It is typical, but not required, to ensure that this method
never completes abruptly with a RuntimeException
.
This method will be called when performing string
concatenation with this object. If the result is
null
, string concatenation will instead
use "null"
.
The default implementation returns
getClass().getName() + "@" +
Integer.toHexString(hashCode())
.
toString
in class Object
Object.getClass()
,
Object.hashCode()
,
Class.getName()
,
Integer.toHexString(int)
public static NumericShaper getShaper(int singleRange)
singleRange
- the target languageIllegalArgumentException
- if the argument does not name a
single language, as specified by the constants declared in this classpublic static NumericShaper getContextualShaper(int ranges)
ranges
- the ranges to shape toIllegalArgumentException
- if the argument specifies an
unrecognized rangepublic static NumericShaper getContextualShaper(int ranges, int defaultContext)
ranges
- the ranges to shape todefaultContext
- the default initial contextIllegalArgumentException
- if the ranges argument specifies an
unrecognized range, or if the defaultContext argument does not specify
a single valid range