org.thdl.tib.text
Class DuffCode

java.lang.Object
  |
  +--org.thdl.tib.text.DuffCode

public class DuffCode
extends Object

A wrapper for the primitive data types that combine to represent a Tibetan glyph in the TibetanMachineWeb family of fonts. A DuffCode consists of a font number, a character, and a character number. A font identification and a character (or character number) are sufficient to uniquely identify any TibetanMachineWeb glyph.

Author:
Edward Garrett, Tibetan and Himalayan Digital Library

Field Summary
 char character
          the character value of this glyph
 int charNum
          the character value of this glyph, as an integer
 int fontNum
          the font number in which this glyph can be found, from 1 (TibetanMachineWeb) to 10 (TibetanMachineWeb9).
 
Constructor Summary
DuffCode(int font, char ch)
          Called to create DuffCodes on the fly from an identifying font number and an ASCII character.
DuffCode(String s, boolean leftToRight)
          Called by TibetanMachineWeb to generate DuffCodes from the 'tibwn.ini' initialization file.
 
Method Summary
 boolean equals(Object o)
          Evaluates two DuffCodes as equal iff their font numbers and characters are identical.
 char getCharacter()
          Gets the character for this glyph.
 int getCharNum()
          Gets the character for this glyph, as an integer.
 int getFontNum()
          Gets the font number of this glyph.
 int hashCode()
          Assigns a hashcode based on the font number and character for this glyph.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

fontNum

public int fontNum
the font number in which this glyph can be found, from 1 (TibetanMachineWeb) to 10 (TibetanMachineWeb9).


character

public char character
the character value of this glyph


charNum

public int charNum
the character value of this glyph, as an integer

Constructor Detail

DuffCode

public DuffCode(String s,
                boolean leftToRight)
Called by TibetanMachineWeb to generate DuffCodes from the 'tibwn.ini' initialization file. This constructor expects to receive a string such as "1,33" or "33,1", i.e. a sequence of two numbers separated by a comma. These numbers represent a character: one number is its identifying font number, and the other is the ASCII code of the character.

Parameters:
s - the string to parse
leftToRight - should be true if the first number is the font number, false if the second number is the font number

DuffCode

public DuffCode(int font,
                char ch)
Called to create DuffCodes on the fly from an identifying font number and an ASCII character.

Parameters:
font - the identifying number of the font
ch - a character
Method Detail

getFontNum

public int getFontNum()
Gets the font number of this glyph.

Returns:
the identifying font number for this DuffCode

getCharNum

public int getCharNum()
Gets the character for this glyph, as an integer.

Returns:
the identifying character, converted to an integer, for this DuffCode

getCharacter

public char getCharacter()
Gets the character for this glyph.

Returns:
the identifying character for this DuffCode

hashCode

public int hashCode()
Assigns a hashcode based on the font number and character for this glyph. The hashcode for a DuffCode with font=1 and character='c' is defined as the hash code of the string '1-c'.

Overrides:
hashCode in class Object
Returns:
the hash code for this object

equals

public boolean equals(Object o)
Evaluates two DuffCodes as equal iff their font numbers and characters are identical.

Overrides:
equals in class Object
Parameters:
o - the object (DuffCode) you want to compare
Returns:
true if this object is equal to o, false if not

toString

public String toString()
Overrides:
toString in class Object
Returns:
a string representation of this object


These API docs were created 02/02/2003 08:19 PM.
Copyright © 2001-2002 Tibetan and Himalayan Digital Library. All Rights Reserved.
Hosted by SourceForge_Logo