net.ajaest.data.dict
Class KanjiDict

java.lang.Object
  extended by net.ajaest.data.dict.KanjiDict

public class KanjiDict
extends java.lang.Object

Class that provides methods to query and retrieve information about kanjis.

Author:
Luis Alfonso Arce González

Field Summary
private  NeodatisKanjiDatabaseManager kdm
           
private  java.util.List<KanjiTag> previousSearch
           
 
Constructor Summary
KanjiDict(java.io.File kanjiDatabase, java.io.File strokeOrder)
           
KanjiDict(java.lang.String kanjiDatabasePath, java.lang.String strokeOrderPath)
           
 
Method Summary
 void close()
           
 java.util.List<KanjiTag> executeFromPrevious(KanjiExpression ke)
          Returns a set of kanji from the previous query that matches all the conditions defined in the specified kanji expression.
 java.util.List<KanjiTag> executeQuery(KanjiExpression ke)
          Returns a set of kanji from database that matches all the conditions defined in the specified kanji expression.
 KanjiDatabaseInfo getDatabaseInfo()
           
 KanjiTag getKanjiByUnicode(java.lang.Integer unicodeValue)
          Returns the kanji specified by it's unicode value.
 NeodatisKanjiDatabaseManager getKanjiDatabaseManager()
           
private  java.util.List<KanjiTag> getKanjis(KanjiExpression ke)
           
 java.util.List<KanjiTag> getPreviousSearch()
           
 java.util.SortedSet<Radical> getRadicalInfos(java.lang.Integer rad)
           
 Radical getRadicalMainInfo(java.lang.Integer rad)
           
 KanjiSortExpression getSorterFromExpression(KanjiExpression ke)
          Creates a KanjiSortExpression that describes an ordering where the elements are arranged firstly by the first domain of the kanji expression.
 java.util.List<KanjiTag> sortKanjis(java.util.List<KanjiTag> kanjis, KanjiSortExpression kse)
          Returns a specified set of kanjis sorted by defined a KanjiSortExpression
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

kdm

private NeodatisKanjiDatabaseManager kdm

previousSearch

private java.util.List<KanjiTag> previousSearch
Constructor Detail

KanjiDict

public KanjiDict(java.io.File kanjiDatabase,
                 java.io.File strokeOrder)
          throws java.io.IOException
Parameters:
kanjiDatabase - a File class representing a database file
strokeOrder - a File class representing a stroke order file
Throws:
java.io.IOException

KanjiDict

public KanjiDict(java.lang.String kanjiDatabasePath,
                 java.lang.String strokeOrderPath)
          throws java.io.IOException
Parameters:
kanjiDatabasePath - the kanji database path string
strokeOrderPath - the stroke order file path string
Throws:
java.io.IOException
Method Detail

getKanjiDatabaseManager

public NeodatisKanjiDatabaseManager getKanjiDatabaseManager()

getKanjiByUnicode

public KanjiTag getKanjiByUnicode(java.lang.Integer unicodeValue)
Returns the kanji specified by it's unicode value.

Parameters:
unicodeValue - The unicode value of the queried kanji
Returns:
the kanji which unicode value is the specified in unicodeValue, or null if the unicode value does not represents a kanji

executeQuery

public java.util.List<KanjiTag> executeQuery(KanjiExpression ke)
Returns a set of kanji from database that matches all the conditions defined in the specified kanji expression.

Parameters:
ke - a kanji expression defining a kanji or a group of kanjis
Returns:
a set of kanjis that matches all the conditions specified in {code ke} kanji expression

executeFromPrevious

public java.util.List<KanjiTag> executeFromPrevious(KanjiExpression ke)
Returns a set of kanji from the previous query that matches all the conditions defined in the specified kanji expression. This method should be faster than executeQuery.

Parameters:
ke - a kanji expression defining a kanji or a group of kanjis
Returns:
a set of kanjis that matches all the conditions specified in {code ke} kanji expression

getKanjis

private java.util.List<KanjiTag> getKanjis(KanjiExpression ke)

getPreviousSearch

public java.util.List<KanjiTag> getPreviousSearch()
Returns:
the previous result of the last call to executeQuery or executeQueryFromPrevious methods, null if those methods has never been called in this object.

getDatabaseInfo

public KanjiDatabaseInfo getDatabaseInfo()

getRadicalInfos

public java.util.SortedSet<Radical> getRadicalInfos(java.lang.Integer rad)

getRadicalMainInfo

public Radical getRadicalMainInfo(java.lang.Integer rad)

sortKanjis

public java.util.List<KanjiTag> sortKanjis(java.util.List<KanjiTag> kanjis,
                                           KanjiSortExpression kse)
Returns a specified set of kanjis sorted by defined a KanjiSortExpression

Parameters:
kanjis - Kanji set to be sorted
kse - Expression of ordering criteria
Returns:
a sorted set of kanjis

getSorterFromExpression

public KanjiSortExpression getSorterFromExpression(KanjiExpression ke)
Creates a KanjiSortExpression that describes an ordering where the elements are arranged firstly by the first domain of the kanji expression. For example:

new KanjiQuery().unicode_Value().less_Than("2f2f").and().Skip_code ().greather_than(5)

Will return the equivalent of the following kanji ordering expression

new KanjiQuery().sort_by_unicode().from_lower_to_greather().and_if_equals ().sort_by_Skip_code().alphabetically()

Parameters:
ke - a well-formed KanjiExpression
Returns:
the default kanji sorter of the kanji expression

close

public void close()