Prev Class | Next Class | Frames | No Frames |
Summary: Nested | Field | Method | Constr | Detail: Nested | Field | Method | Constr |
java.lang.Object
java.awt.font.NumericShaper
Field Summary | |
static int |
|
static int |
|
static int |
|
static int |
|
static int |
|
static int |
|
static int |
|
static int |
|
static int |
|
static int |
|
static int |
|
static int |
|
static int |
|
static int |
|
static int |
|
static int |
|
static int |
|
static int |
|
static int |
|
static int |
|
Method Summary | |
boolean | |
static NumericShaper |
|
static NumericShaper |
|
int |
|
static NumericShaper |
|
int |
|
boolean |
|
void |
|
void |
|
String |
|
Methods inherited from class java.lang.Object | |
clone , equals , extends Object> getClass , finalize , hashCode , notify , notifyAll , toString , wait , wait , wait |
public static final int ALL_RANGES
Convenience constant representing all the valid Unicode ranges.
- Field Value:
- 524287
public static final int ARABIC
Constant representing the Unicode ARABIC range. Shaping done using this range will translate to the arabic decimal characters. Use EASTERN_ARABIC if you want to shape to the eastern arabic (also known as the extended arabic) decimal characters.
- Field Value:
- 2
public static final int BENGALI
Constant representing the Unicode BENGALI range.
- Field Value:
- 16
public static final int DEVANAGARI
Constant representing the Unicode DEVANAGARI range.
- Field Value:
- 8
public static final int EASTERN_ARABIC
Constant representing the Unicode extended arabic range. In Unicode there are two different sets of arabic digits; this selects the extended or eastern set.
- Field Value:
- 4
public static final int ETHIOPIC
Constant representing the Unicode ETHIOPIC range. Note that there is no digit zero in this range; an ASCII digit zero is left unchanged when shaping to this range.
- Field Value:
- 65536
public static final int EUROPEAN
Constant representing the Unicode EUROPEAN range. For contextual shaping purposes, characters in the various extended Latin character blocks are recognized as EUROPEAN.
- Field Value:
- 1
public static final int GUJARATI
Constant representing the Unicode GUJARATI range.
- Field Value:
- 64
public static final int GURMUKHI
Constant representing the Unicode GURMUKHI range.
- Field Value:
- 32
public static final int KANNADA
Constant representing the Unicode KANNADA range.
- Field Value:
- 1024
public static final int MALAYALAM
Constant representing the Unicode MALAYALAM range.
- Field Value:
- 2048
public static final int MONGOLIAN
Constant representing the Unicode MONGOLIAN range.
- Field Value:
- 262144
public static final int MYANMAR
Constant representing the Unicode MYANMAR range.
- Field Value:
- 32768
public static final int TAMIL
Constant representing the Unicode TAMIL range. Note that there is no digit zero in this range; an ASCII digit zero is left unchanged when shaping to this range.
- Field Value:
- 256
public static final int TIBETAN
Constant representing the Unicode TIBETAN range.
- Field Value:
- 16384
public boolean equals(Object obj)
Determine whether this Object is semantically equal to another Object.There are some fairly strict requirements on this method which subclasses must follow:
- It must be transitive. If
a.equals(b)
andb.equals(c)
, thena.equals(c)
must be true as well.- It must be symmetric.
a.equals(b)
andb.equals(a)
must have the same value.- It must be reflexive.
a.equals(a)
must always be true.- It must be consistent. Whichever value a.equals(b) returns on the first invocation must be the value returned on all later invocations.
a.equals(null)
must be false.- It must be consistent with hashCode(). That is,
a.equals(b)
must implya.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 fora.equals(b)
to be true even thougha.getClass() != b.getClass()
. Also, it is typical to never cause aNullPointerException
.In general, the Collections API (
java.util
) use theequals
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
.
- Parameters:
obj
- the Object to compare to
- Returns:
- whether this Object is semantically equal to another
- See Also:
Object.hashCode()
public static NumericShaper getContextualShaper(int ranges)
Return a contextual shaper which can shape to any of the indicated languages. The default initial context for this shaper is EUROPEAN.
- Parameters:
ranges
- the ranges to shape to
- Returns:
- a contextual shaper which will target any of these ranges
- Throws:
IllegalArgumentException
- if the argument specifies an unrecognized range
public static NumericShaper getContextualShaper(int ranges, int defaultContext)
Return a contextual shaper which can shape to any of the indicated languages. The default initial context for this shaper is given as an argument.
- Parameters:
ranges
- the ranges to shape todefaultContext
- the default initial context
- Returns:
- a contextual shaper which will target any of these ranges
- Throws:
IllegalArgumentException
- if the ranges argument specifies an unrecognized range, or if the defaultContext argument does not specify a single valid range
public int getRanges()
Return an integer representing all the languages for which this shaper will shape. The result is taken by "or"ing together the constants representing the various languages.
public static NumericShaper getShaper(int singleRange)
Return a non-contextual shaper which can shape to a single range. All ASCII digits in the input text are translated to this language.
- Parameters:
singleRange
- the target language
- Returns:
- a non-contextual shaper for this language
- Throws:
IllegalArgumentException
- if the argument does not name a single language, as specified by the constants declared in this class
public int hashCode()
Get a value that represents this Object, as uniquely as possible within the confines of an int.There are some requirements on this method which subclasses must follow:
- Semantic equality implies identical hashcodes. In other words, if
a.equals(b)
is true, thena.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.- It must be consistent. Whichever value o.hashCode() returns on the first invocation must be the value returned on all later invocations as long as the object exists. Notice, however, that the result of hashCode may change between separate executions of a Virtual Machine, because it is not invoked on the same object.
Notice that since
hashCode
is used inHashtable
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)
- Returns:
- the hash code for this Object
public boolean isContextual()
Return true if this shaper is contextual, false if it is not.
public void shape(char[] text, int start, int count)
Shape the text in the given array. The starting context will be the context passed to the shaper at creation time.
- Parameters:
text
- the text to shapestart
- the index of the starting character of the arraycount
- the number of characters in the array
public void shape(char[] text, int start, int count, int context)
Shape the given text, using the indicated initial context. If this shaper is not a contextual shaper, then the given context will be ignored.
- Parameters:
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 context
- Throws:
IllegalArgumentException
- if the initial context is invalid
public String toString()
Convert this Object to a human-readable String. There are no limits placed on how long this String should be or what it should contain. We suggest you make it as intuitive as possible to be able to place it intoSystem.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())
.
- Returns:
- the String representing this Object, which may be null
- See Also:
getClass()
,Object.hashCode()
,Class.getName()
,Integer.toHexString(int)