|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--elge.lexikon.Word
The Word class represents one word in the elxikon. It holds also the word use and succes use.
To change some behavior of the lexikon, you can yust change the word.
Field Summary | |
static Word |
emptyWord
An ampty word instance used as comparator object. |
protected int |
sucessUse
the success use of the word |
protected int |
use
the use of the word. |
protected String |
word
The word. |
Constructor Summary | |
Word()
Creates empty word. |
|
Word(String word)
Creates a new instance of word |
|
Word(String word,
int use,
int suc)
Creates a new instance of word |
Method Summary | |
int |
compare(Object o1,
Object o2)
compares two words agains they usage. |
int |
compareTo(Object o)
See compare(java.lang.Object, java.lang.Object)
Compares this object with the specified object for order. |
void |
decSucessUse()
decreases the successfull usage of the word |
void |
decUse()
decreases the useage of the word |
boolean |
equals(Object o)
See compare(java.lang.Object, java.lang.Object) |
String |
getAsText()
Returns a format of the whole word with name, use and success: [name;use;success] |
static Comparator |
getComparator()
Return a comparator of use and success. |
double |
getRatio()
Returns the ratio -> successUse/Use |
int |
getSucessUse()
the succesfull use of the word |
int |
getUse()
the use of the word |
String |
getWord()
See toString() |
static Comparator |
getWordComparator()
Returns an comparator of the word itself. |
void |
incSucessUse()
increases the successfull usage of the word |
void |
incUse()
increases the useage of the word |
void |
setAsText(String wordRep)
parse [word;use;sucuse] --> sets the word from the string |
void |
setWord(String w)
|
String |
toString()
Returns the word. |
Methods inherited from class java.lang.Object |
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
public static final Word emptyWord
protected int use
protected int sucessUse
protected String word
Constructor Detail |
public Word(String word)
word
- Name of the wordpublic Word(String word, int use, int suc)
word
- name of the worduse
- initial usesuc
- initial successpublic Word()
Method Detail |
public static Comparator getComparator()
public static Comparator getWordComparator()
public int getUse()
public void incUse()
public void decUse()
public void incSucessUse()
public void decSucessUse()
public int getSucessUse()
public double getRatio()
public String toString()
toString
in class Object
public String getWord()
toString()
public void setWord(String w)
public int compare(Object o1, Object o2)
compare
in interface Comparator
o1
- first wordo2
- second word
public boolean equals(Object o)
compare(java.lang.Object, java.lang.Object)
equals
in interface Comparator
equals
in class Object
o
- compare with
public String getAsText()
public void setAsText(String wordRep)
wordRep
- The parsable format of the wordpublic int compareTo(Object o)
compare(java.lang.Object, java.lang.Object)
Compares this object with the specified object for order. Returns a
negative integer, zero, or a positive integer as this object is less
than, equal to, or greater than the specified object.In the foregoing description, the notation sgn(expression) designates the mathematical signum function, which is defined to return one of -1, 0, or 1 according to whether the value of expression is negative, zero or positive. The implementor must ensure sgn(x.compareTo(y)) == -sgn(y.compareTo(x)) for all x and y. (This implies that x.compareTo(y) must throw an exception iff y.compareTo(x) throws an exception.)
The implementor must also ensure that the relation is transitive: (x.compareTo(y)>0 && y.compareTo(z)>0) implies x.compareTo(z)>0.
Finally, the implementer must ensure that x.compareTo(y)==0 implies that sgn(x.compareTo(z)) == sgn(y.compareTo(z)), for all z.
It is strongly recommended, but not strictly required that (x.compareTo(y)==0) == (x.equals(y)). Generally speaking, any class that implements the Comparable interface and violates this condition should clearly indicate this fact. The recommended language is "Note: this class has a natural ordering that is inconsistent with equals."
compareTo
in interface Comparable
o
- the Object to be compared.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |