org.extex.core
Class UnicodeChar

java.lang.Object
  extended by org.extex.core.UnicodeChar
All Implemented Interfaces:
java.io.Serializable
Direct Known Subclasses:
ComposedUnicodeChar

public class UnicodeChar
extends java.lang.Object
implements java.io.Serializable

This class represents a 32-bit Unicode character. Java 1.4 defines 16-bit characters only. Thus we are forced to roll our own version. As soon as Java supports 32-bit Unicode characters this class is obsolete and might be eliminated.

Version:
$Revision:5417 $
Author:
Gerd Neugebauer, Michael Niedermair
See Also:
Serialized Form

Field Summary
static UnicodeChar BREAK_PERMITTED_HERE
          The field BREAK_PERMITTED_HERE contains the optional break.
static int MAX_VALUE
          The constant MAX_VALUE contains the maximal admissible code point.
static int MIN_VALUE
          The constant MIN_VALUE contains the minimal admissible code point.
static UnicodeChar NEXT_LINE
          The field NEXT_LINE contains the next line control character.
static UnicodeChar NO_BREAK_HERE
          The field NO_BREAK_HERE contains the break inhibitor.
static UnicodeChar NO_BREAK_SPACE
          The field NO_BREAK_SPACE contains the non-breakable space.
protected static long serialVersionUID
          The constant serialVersionUID contains the id for serialization.
static UnicodeChar SHY
          The constant SHY contains the soft hyphenation character.
static UnicodeChar SPACE
          The field SPACE contains the space control character.
 
Constructor Summary
protected UnicodeChar(int codePoint)
          Creates a new object from an integer code point.
 
Method Summary
 boolean equals(java.lang.Object unicodeChar)
          Compares a UnicodeChar character with the value of this object.
static UnicodeChar get(int code)
          Creates a new object from a integer code point.
static UnicodeChar get(java.lang.String unicodeName)
          Creates a new object from a Unicode name.
 int getCodePoint()
          Return the Unicode code point.
 int getDirection()
          Returns the bi-direction property of the character.
 java.lang.String getUnicodeName()
          Returns the Unicode name of the code.
 int hashCode()
          Computes the hash code for the character.
 boolean isDigit()
          Test, if the code is a digit.
 boolean isLetter()
          Test, if the character is a letter.
 boolean isPrintable()
          Test, if the code is printable.
 UnicodeChar lower()
          Returns the lowercase character of this object.
 java.lang.String toString()
          Returns a String of this object.
 UnicodeChar upper()
          Returns the uppercase character of this object.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

MAX_VALUE

public static final int MAX_VALUE
The constant MAX_VALUE contains the maximal admissible code point.

See Also:
Constant Field Values

MIN_VALUE

public static final int MIN_VALUE
The constant MIN_VALUE contains the minimal admissible code point.

See Also:
Constant Field Values

serialVersionUID

protected static final long serialVersionUID
The constant serialVersionUID contains the id for serialization.

See Also:
Constant Field Values

BREAK_PERMITTED_HERE

public static final UnicodeChar BREAK_PERMITTED_HERE
The field BREAK_PERMITTED_HERE contains the optional break.


NEXT_LINE

public static final UnicodeChar NEXT_LINE
The field NEXT_LINE contains the next line control character.


NO_BREAK_HERE

public static final UnicodeChar NO_BREAK_HERE
The field NO_BREAK_HERE contains the break inhibitor.


NO_BREAK_SPACE

public static final UnicodeChar NO_BREAK_SPACE
The field NO_BREAK_SPACE contains the non-breakable space.


SHY

public static final UnicodeChar SHY
The constant SHY contains the soft hyphenation character.


SPACE

public static final UnicodeChar SPACE
The field SPACE contains the space control character.

Constructor Detail

UnicodeChar

protected UnicodeChar(int codePoint)
               throws java.lang.IllegalArgumentException
Creates a new object from an integer code point.

Parameters:
codePoint - the 32-bit code point
Throws:
java.lang.IllegalArgumentException - in case that the code point is not in the acceptable rage from MIN_VALUE to MAX_VALUE
Method Detail

get

public static UnicodeChar get(int code)
Creates a new object from a integer code point. This is a factory method for Unicode characters. If the code point is out of range then null is returned.

Parameters:
code - the code point
Returns:
the Unicode character

get

public static UnicodeChar get(java.lang.String unicodeName)
Creates a new object from a Unicode name. Factory method for Unicode characters.

Parameters:
unicodeName - the long name of the character
Returns:
the Unicode character

equals

public boolean equals(java.lang.Object unicodeChar)
Compares a UnicodeChar character with the value of this object. They are considered equal if the are both UnicodeChars and have the same code.

The general signature for comparison to an arbitrary object is required for the implementation of HashMap and friends.

Overrides:
equals in class java.lang.Object
Parameters:
unicodeChar - the character to compare
Returns:
true if the characters are equal, otherwise false

getCodePoint

public int getCodePoint()
Return the Unicode code point.

Returns:
the Unicode code point

getDirection

public int getDirection()
Returns the bi-direction property of the character.

Returns:
the bi-direction property

getUnicodeName

public java.lang.String getUnicodeName()
Returns the Unicode name of the code.

Returns:
Unicode name of the code

hashCode

public int hashCode()
Computes the hash code for the character. The hash code of equal objects must be equal, but the hash code of different object need not to be different. This is needed for the implementations of HashMap and friends.

Overrides:
hashCode in class java.lang.Object
Returns:
the hash code

isDigit

public boolean isDigit()
Test, if the code is a digit.

Returns:
true, if the code is a digit, otherwise false

isLetter

public boolean isLetter()
Test, if the character is a letter.

Returns:
true, if the code is a letter, otherwise false

isPrintable

public boolean isPrintable()
Test, if the code is printable.

Returns:
true, if the code is printable, otherwise false

lower

public UnicodeChar lower()
Returns the lowercase character of this object.

(this method does not use the TeX lccode!)

Returns:
character in lowercase

toString

public java.lang.String toString()
Returns a String of this object.

Overrides:
toString in class java.lang.Object
Returns:
String representation of the stored value.

upper

public UnicodeChar upper()
Returns the uppercase character of this object.

(this method does not use the TeX uccode!)

Returns:
character in uppercase