|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--net.sourceforge.wohenchan.convert.AbstractConverterTable | +--net.sourceforge.wohenchan.convert.CedictConverterTable
This class implements the search functions from the ConverterTableInterface. It can search by GB2312, Pinyin, and English. The dictionary entry vector is passed in when construct this class. This class handles the cedict.GB file, and we assume that each line which contains the '[' and ']' is a dictionary entry. If there is a line which contains the '[' and ']' but it's not an entry, then it might cause problem.
Field Summary | |
private java.util.Vector |
cedictEntryVector
|
private java.io.InputStream |
cedictFileInput
|
private char |
ENG_DEFINITION_SEPARATOR
|
private static java.lang.String |
FILE_SEPARATOR
|
private long |
fileSize
|
private java.lang.String |
m_cacheResource
Name of resource in cache. |
private java.lang.String |
m_encoding
|
private java.io.File |
m_file
File of source data on local disk. |
private java.lang.String |
m_readStatusMsg
|
private java.lang.String |
m_source
|
private java.lang.String |
m_url
URL for original cedict source data. |
private java.lang.String |
m_zipentry
|
private ConverterTableInterface |
table
|
Fields inherited from class net.sourceforge.wohenchan.convert.AbstractConverterTable |
|
Constructor Summary | |
CedictConverterTable(java.lang.String cedictzipurl,
java.lang.String zipentry,
java.io.File cedictfile,
java.lang.String cacheResourceName,
java.lang.String encoding,
java.lang.String sourceName)
|
Method Summary | |
void |
init(ConverterListener listener)
Initialization method, to be overridden by subclasses. |
private void |
parseLine(ByteVector linev)
Parse a line from cedict.GB. |
private boolean |
pinyinRoughlyMatches(java.lang.String searchString,
java.lang.String possibleMatch)
|
private void |
postInitLookupByChinese(java.lang.String chinese,
ConverterListener listener)
|
void |
postInitLookupByEnglishSubstring(java.lang.String str,
ConverterListener listener)
Locates ConverterEntryInterface objects corresponding to a given case insensitive English substring. |
void |
postInitLookupByPinyin(java.lang.String pinyin,
ConverterListener listener)
Looks up a dictionary entry by pinyin. |
void |
postInitLookupBySimplifiedChinese(java.lang.String chinese,
ConverterListener listener)
Looks up a converter table entry by simplified chinese. |
void |
postInitLookupByTraditionalChinese(java.lang.String chinese,
ConverterListener listener)
Looks up a converter table entry by traditional chinese. |
void |
postInitLookupByUnicode(java.lang.String unicode,
ConverterListener listener)
Looks up a ConverterEntry by Unicode character value. |
private void |
readInFileByLine(ConverterListener listener)
Assume that each line in cedict.GB is an entry. |
java.lang.String |
toString()
|
private void |
updateProgress(ConverterListener listener,
int current,
int max)
|
Methods inherited from class net.sourceforge.wohenchan.convert.AbstractConverterTable |
bytesToUnicode, fireDone, fireEntryFound, fireProgressChanged, fireStatus, fireTaskChange, initInOtherThread, lookupByEnglishSubstring, lookupByPinyin, lookupBySimplifiedChinese, lookupByTraditionalChinese, unicodeToBytes |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
private final char ENG_DEFINITION_SEPARATOR
private static final java.lang.String FILE_SEPARATOR
private java.lang.String m_source
private java.lang.String m_readStatusMsg
private java.lang.String m_encoding
private java.lang.String m_cacheResource
private java.io.File m_file
private java.lang.String m_url
private java.lang.String m_zipentry
private java.io.InputStream cedictFileInput
private java.util.Vector cedictEntryVector
private long fileSize
private ConverterTableInterface table
Constructor Detail |
public CedictConverterTable(java.lang.String cedictzipurl, java.lang.String zipentry, java.io.File cedictfile, java.lang.String cacheResourceName, java.lang.String encoding, java.lang.String sourceName)
Method Detail |
public void init(ConverterListener listener) throws java.io.IOException
AbstractConverterTable
init
in class AbstractConverterTable
java.io.IOException
private void readInFileByLine(ConverterListener listener) throws AbortSearchException
AbortSearchException
private void parseLine(ByteVector linev) throws java.io.UnsupportedEncodingException
linev
- a ByteVector contains a line of cedict.GB
java.io.UnsupportedEncodingException
private boolean pinyinRoughlyMatches(java.lang.String searchString, java.lang.String possibleMatch)
private void updateProgress(ConverterListener listener, int current, int max) throws AbortSearchException
AbortSearchException
public void postInitLookupByPinyin(java.lang.String pinyin, ConverterListener listener)
AbstractConverterTable
postInitLookupByPinyin
in class AbstractConverterTable
pinyin
- The input string is specified in pinyin.
The string may be composed of the letters 'a'-'z' (lower case
only), the numbers '1'-'5' and space (' ').
The string is composed of at least 1 space-separated pinyin
syllables. Syllables are separated with exactly one space.
There is no leading or trailing space.
Each syllable is composed of at least two letters followed by
exactly one digit. The neutral tone is expicitly specified with
'5'.
u w/ umlaut (as in luu2 (donkey, palm tree), or luu3 (drizzle)
is specified with uu.
public void postInitLookupByEnglishSubstring(java.lang.String str, ConverterListener listener)
AbstractConverterTable
postInitLookupByEnglishSubstring
in class AbstractConverterTable
private void postInitLookupByChinese(java.lang.String chinese, ConverterListener listener)
public void postInitLookupByTraditionalChinese(java.lang.String chinese, ConverterListener listener)
AbstractConverterTable
postInitLookupByTraditionalChinese
in class AbstractConverterTable
public void postInitLookupBySimplifiedChinese(java.lang.String chinese, ConverterListener listener)
AbstractConverterTable
postInitLookupBySimplifiedChinese
in class AbstractConverterTable
public void postInitLookupByUnicode(java.lang.String unicode, ConverterListener listener)
AbstractConverterTable
postInitLookupByUnicode
in class AbstractConverterTable
public java.lang.String toString()
toString
in class java.lang.Object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |