elge.lexikon
Class Lexikon

java.lang.Object
  |
  +--java.util.Dictionary
        |
        +--java.util.Hashtable
              |
              +--elge.lexikon.Lexikon
All Implemented Interfaces:
Cloneable, Map, Serializable

public class Lexikon
extends Hashtable

This instance performs very simple implementation of the aganet lexikon, only as an association table.

Author:
Pavol Žibrita
See Also:
Word, Serialized Form

Field Summary
static Integer DEFAULT_LENGTH
          default length of words
protected  char[] lexems
          the chars to create the words from.
protected  Class wordClass
           
protected  Integer wordLength
          the length of world to use.
 
Constructor Summary
Lexikon()
          Creates a new instance of Lexikon
Lexikon(int wordLength)
          Creates a new instance of Lexikon
Lexikon(Integer wordLength)
          Creates a new instance of Lexikon
 
Method Summary
 void addNameObject(Object obj, Word w)
          Like name object, but only adds the word. if it already exists, it does nothing (like increasing the use or success)
 Word createWord()
          Creates a word with a length specified for the lexikon.
 Word createWord(double p)
          Creates a random word with probability of p
 Word createWord(Integer length)
          Creates a word of length of the param.
 Word existName(Object obj, Word w)
          return a not null value, if there is a name equal with the param w for referent obj.
protected  char[] getLexems()
          returns the lexems.
 Word getMostSucessfullObjectName(Object obj)
          Returns the most sucessful object name.
 Vector getObjectNames(Object obj)
          Returns all words associatedwith the given object
 Vector getObjectsForWord(Word w)
          Returns all associated objects with a given word.
 Class getWordClass()
           
 boolean incSucess(Object obj, Word w)
          Increases the success of association if it is found.
 void nameObject(Object obj, Word w)
          names object obj, with word w?
 void setWordClass(Class cls)
           
 void sucessGame(Object obj, Word w)
          increase the use and sucess.
 
Methods inherited from class java.util.Hashtable
clear, clone, contains, containsKey, containsValue, elements, entrySet, equals, get, hashCode, isEmpty, keys, keySet, put, putAll, rehash, remove, size, toString, values
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

DEFAULT_LENGTH

public static final Integer DEFAULT_LENGTH
default length of words


wordClass

protected Class wordClass

lexems

protected char[] lexems
the chars to create the words from.


wordLength

protected Integer wordLength
the length of world to use.

Constructor Detail

Lexikon

public Lexikon()
Creates a new instance of Lexikon


Lexikon

public Lexikon(int wordLength)
Creates a new instance of Lexikon

Parameters:
wordLength - the world length to use when creating new words.

Lexikon

public Lexikon(Integer wordLength)
Creates a new instance of Lexikon

Parameters:
wordLength - the world length to use when creating new words.
Method Detail

setWordClass

public void setWordClass(Class cls)

getWordClass

public Class getWordClass()

getLexems

protected char[] getLexems()
returns the lexems.

Returns:
the lexems.

createWord

public Word createWord(Integer length)
Creates a word of length of the param.

Parameters:
length - length of the world.
Returns:
returns a random word.

createWord

public Word createWord()
Creates a word with a length specified for the lexikon.

Returns:
random word.

createWord

public Word createWord(double p)
Creates a random word with probability of p

Parameters:
p - probability from 0 to 1
Returns:
creates word

nameObject

public void nameObject(Object obj,
                       Word w)
names object obj, with word w? if object exits, inceace use of the name. But not sucess. if object or word does not exists, creates new reference

Parameters:
obj - object to name
w - word to assign to the object

addNameObject

public void addNameObject(Object obj,
                          Word w)
Like name object, but only adds the word. if it already exists, it does nothing (like increasing the use or success)

Parameters:
obj - object to be named
w - word to assign to the object

existName

public Word existName(Object obj,
                      Word w)
return a not null value, if there is a name equal with the param w for referent obj. The name is returnd. Null if not found.

Parameters:
obj - object that is named
w - the name of the object
Returns:
returns the word if the association is found, else null

incSucess

public boolean incSucess(Object obj,
                         Word w)
Increases the success of association if it is found.

Parameters:
obj - object
w - word
Returns:
true if the succes was updated

sucessGame

public void sucessGame(Object obj,
                       Word w)
increase the use and sucess.

Parameters:
obj - object
w - word

getObjectNames

public Vector getObjectNames(Object obj)
Returns all words associatedwith the given object

Parameters:
obj - object
Returns:
Vector of Word instances or null if not found.

getObjectsForWord

public Vector getObjectsForWord(Word w)
Returns all associated objects with a given word.

Parameters:
w - Word
Returns:
Vector of objects. Can be zero size.

getMostSucessfullObjectName

public Word getMostSucessfullObjectName(Object obj)
Returns the most sucessful object name.

Parameters:
obj - Object
Returns:
return the most succesfull word for it.