net.ajaest.jdk.data.kanji
Class KanjiTag

java.lang.Object
  extended by net.ajaest.jdk.data.kanji.KanjiTag
All Implemented Interfaces:
java.io.Serializable, java.lang.Comparable<KanjiTag>, KanjiReference
Direct Known Subclasses:
Kanji

public class KanjiTag
extends java.lang.Object
implements java.io.Serializable, java.lang.Comparable<KanjiTag>, KanjiReference

Immutable class that stores some different informations about a kanji

Author:
Luis Alfonso Arce González
See Also:
Serialized Form

Field Summary
protected  RadicalTag classicRad
           
protected  java.util.Set<DicReferencePair> dicReferences
           
protected  java.lang.Integer frequency
           
protected  java.lang.Integer grade
           
protected  KanjiGraph graph
           
protected  JISPair jisCode
           
protected  java.lang.Integer JLPTLevel
           
protected  java.util.Set<MeaningEntry> meanings
           
protected  java.lang.Integer nelsonRadical
           
protected  KanjiQueryCodes queryCodes
           
protected  java.util.Set<ReadingEntry> readings
           
private static long serialVersionUID
           
protected  java.lang.Integer strokeCount
           
protected  java.util.Set<java.lang.Integer> strokeMiscounts
           
protected  java.lang.Integer unicode
           
protected  java.util.Set<VariantPair> variants
           
 
Constructor Summary
protected KanjiTag()
           
 
Method Summary
 int compareTo(KanjiTag o)
          Compares this kanji and another kanji by their's unicode value
 boolean equals(java.lang.Object obj)
          Indicates if this kanji's unicode value equals other character or kanji unicode value
 java.lang.String formattedDescriptionString()
          Returns a predefined formatted string with all the information about this Kanji
 java.lang.Object getByEnum(KanjiEnums.KanjiFieldEnum kfe)
          Returns a property of this kanji using a defined instance of a KanjiFieldsEnum.
 java.lang.Object getByEnum(KanjiEnums.KanjiFieldEnum kfe, java.lang.String value)
           
 RadicalTag getClassicRadical()
           
 java.util.Set<DicReferencePair> getDicReferences()
           
 java.lang.Integer getFrequency()
           
 java.lang.Integer getGrade()
           
 KanjiGraph getGraph()
           
 JISPair getJisCode()
          Returns the jis code information stored in a JISCode object where first() represents the codification (e.g "jis208") and second() represents the jis code (e.g "16-2").
 java.lang.Integer getJLPTLevel()
           
 java.util.Set<MeaningEntry> getMeanings()
           
 java.lang.Integer getNelsonRadical()
           
 KanjiQueryCodes getQueryCodes()
           
 java.util.Set<ReadingEntry> getReadings()
           
 java.lang.Integer getStrokeCount()
           
 java.util.Set<java.lang.Integer> getStrokeMiscounts()
           
 java.lang.Integer getUnicodeRef()
           
 java.util.Set<VariantPair> getVariants()
           
 int hashCode()
           
static boolean isKanji(java.lang.Integer unicodeValue)
           
static java.lang.String kanaToRomaji(java.lang.String s)
          Converts the input kana string into romaji string.
 char[] toChar()
           
 KanjiTag toRomaji()
          Returns a copy of the current kanji in which all kana kanji in readings has been translated into romaji.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

serialVersionUID

private static final long serialVersionUID
See Also:
Constant Field Values

unicode

protected java.lang.Integer unicode

jisCode

protected JISPair jisCode

classicRad

protected RadicalTag classicRad

nelsonRadical

protected java.lang.Integer nelsonRadical

grade

protected java.lang.Integer grade

strokeCount

protected java.lang.Integer strokeCount

strokeMiscounts

protected java.util.Set<java.lang.Integer> strokeMiscounts

variants

protected java.util.Set<VariantPair> variants

frequency

protected java.lang.Integer frequency

JLPTLevel

protected java.lang.Integer JLPTLevel

dicReferences

protected java.util.Set<DicReferencePair> dicReferences

readings

protected java.util.Set<ReadingEntry> readings

meanings

protected java.util.Set<MeaningEntry> meanings

queryCodes

protected KanjiQueryCodes queryCodes

graph

protected KanjiGraph graph
Constructor Detail

KanjiTag

protected KanjiTag()
Method Detail

isKanji

public static final boolean isKanji(java.lang.Integer unicodeValue)

kanaToRomaji

public static final java.lang.String kanaToRomaji(java.lang.String s)
Converts the input kana string into romaji string. Any non kana string will be surrounded like "\". Okurigana marks('.') will be removed and suffix marks('-') will be kept.

Parameters:
s - kana string
Returns:
string with kana chars converted into romaji

compareTo

public int compareTo(KanjiTag o)
Compares this kanji and another kanji by their's unicode value

Specified by:
compareTo in interface java.lang.Comparable<KanjiTag>
Parameters:
o - Kanji object to be compared with
Returns:
this.getUnicodeValue().compareTo(anotherKanji.getUnicodeValue())

equals

public boolean equals(java.lang.Object obj)
Indicates if this kanji's unicode value equals other character or kanji unicode value

Overrides:
equals in class java.lang.Object

formattedDescriptionString

public java.lang.String formattedDescriptionString()
Returns a predefined formatted string with all the information about this Kanji

Returns:
String with all info about the kanji.

getDicReferences

public java.util.Set<DicReferencePair> getDicReferences()

getFrequency

public java.lang.Integer getFrequency()

getGrade

public java.lang.Integer getGrade()

getGraph

public KanjiGraph getGraph()

getJisCode

public JISPair getJisCode()
Returns the jis code information stored in a JISCode object where first() represents the codification (e.g "jis208") and second() represents the jis code (e.g "16-2").

Returns:
JISPair representing a JIS code.

getJLPTLevel

public java.lang.Integer getJLPTLevel()

getMeanings

public java.util.Set<MeaningEntry> getMeanings()

getClassicRadical

public RadicalTag getClassicRadical()

getNelsonRadical

public java.lang.Integer getNelsonRadical()

getQueryCodes

public KanjiQueryCodes getQueryCodes()

getReadings

public java.util.Set<ReadingEntry> getReadings()

getStrokeCount

public java.lang.Integer getStrokeCount()

getStrokeMiscounts

public java.util.Set<java.lang.Integer> getStrokeMiscounts()

getUnicodeRef

public java.lang.Integer getUnicodeRef()
Specified by:
getUnicodeRef in interface KanjiReference
Returns:
the unicode value of the referenced kanji.

getVariants

public java.util.Set<VariantPair> getVariants()

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object

toChar

public char[] toChar()

toRomaji

public final KanjiTag toRomaji()
Returns a copy of the current kanji in which all kana kanji in readings has been translated into romaji.

Returns:
a copy of the current kanji with romanized text

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

getByEnum

public java.lang.Object getByEnum(KanjiEnums.KanjiFieldEnum kfe)
Returns a property of this kanji using a defined instance of a KanjiFieldsEnum. The type and the content of the returned instance depends on the specified type by kfe.

Parameters:
kfe - A defined instance of KanjiFieldsEnum representing a kanji field
Returns:
Depending on the specified field denoted by kfe, it returns and upcasted Object from:

    kfe == KANJI_CLASSIC_NELSON : An Integer representing the Nelson radical
    kfe == KANJI_CLASSIC_RADICAL : An Integer representing the classic radical number
    kfe == KANJI_DE_ROO : A String representing the De Roo query code
    kfe == KANJI_DIC_NAME : A Set<String> representing the dictionary names in which this kanji is referenced
    kfe == KANJI_DIC_INDEX : A Set<DicReferencePair> representing all the references of this kanji in dictionaries
    kfe == KANJI_FOUR_CORNER : A String representing the four corner query code of this kanji
    kfe == KANJI_FREQUENCY : An Integer representing the frequency of this kanji
    kfe == KANJI_GRADE : An Integer representing the grade of this kanji
    kfe == KANJI_GRAPH : A KanjiGraph representing the graph info of this kanji
    kfe == KANJI_JIS_CHARSET : A String representing the charset of this kanji JIS code
    kfe == KANJI_JIS_CODE : A JISPair representing the JIS code of this kanji
    kfe == KANJI_JLPT_LEVEL : An Integer representing the JLPT level of this kanji
    kfe == KANJI_LITERAL : The String representation of this kanji unicode value
    kfe == KANJI_MEANING : A Set<MeaningEntry> representing all the meanings of this kanji in different languages
    kfe == KANJI_MEANING_LANGUAGE : A Set<String> representing all the languages for this kanji has registered meanings
    kfe == KANJI_READING_TYPE : A Set<String> representing all the readings types existing in this kanji
    kfe == KANJI_READING : A Set<ReadingEntry> representing all the readings of this kanji
    kfe == KANJI_SKIP : A String representing the SKIP query code of this kanji
    kfe == KANJI_SPAHN_HADAMITZKY : A String representing the Spahn-Hadamitzky code of this kanji
    kfe == KANJI_STROKE_COUNT : An Integer representing the stroke count of this kanji
    kfe == KANJI_STROKE_MISCOUNT : A Set<Integer> representing the common stroke miscounts of this kanji
    kfe == KANJI_UNICODE_VALUE : An Integer representing
    kfe == KANJI_VARIANT_INDEX : A Set<VariantPair> representing all the variant references of this kanji
    kfe == KANJI_VARIANT_TYPE : A Set<String> representing all the variants types of this kanji

getByEnum

public java.lang.Object getByEnum(KanjiEnums.KanjiFieldEnum kfe,
                                  java.lang.String value)