public class UnitWords
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
private double |
numberOfWords |
private boolean |
recalcNecessary |
private java.util.Hashtable<java.lang.String,java.lang.Double> |
wordFreq |
private int |
x |
private int |
y |
private int |
z |
Constructor and Description |
---|
UnitWords(int x,
int y,
int z) |
Modifier and Type | Method and Description |
---|---|
void |
addWord(java.lang.String word)
Adds a word with frequency=1
|
void |
addWord(java.lang.String word,
double frequency)
Adds a word with its frequency.
|
double |
getAbsoluteFrequency(java.lang.String word)
Calculates the relative frequency of a word in a unit
|
double |
getNumberOfWords() |
double |
getRelativeFrequency(java.lang.String word)
Calculates the relative frequency of a word in a unit
|
java.util.Set<java.lang.String> |
getWordSet()
Returns a Set which contains all words of this unit
|
int |
getX() |
int |
getY() |
int |
getZ() |
private void |
recalcNumberOfWords()
Calculates the total number of words
|
void |
setNumberOfWords(double numberOfWords) |
void |
setX(int x) |
void |
setY(int y) |
void |
setZ(int z) |
private int x
private int y
private int z
private double numberOfWords
private boolean recalcNecessary
private java.util.Hashtable<java.lang.String,java.lang.Double> wordFreq
public UnitWords(int x, int y, int z)
x
- Position of the unit on the x-axisy
- Position of the unit on the y-axisz
- Position of the unit on the z-axispublic void setX(int x)
x
- The x to set.public int getX()
public void setY(int y)
y
- The y to set.public int getY()
public void setZ(int z)
z
- The z to set.public int getZ()
public void setNumberOfWords(double numberOfWords)
numberOfWords
- The numberOfWords to set.public double getNumberOfWords()
public double getAbsoluteFrequency(java.lang.String word)
public double getRelativeFrequency(java.lang.String word)
public void addWord(java.lang.String word)
word
- the word to addaddWord(String word, double frequency)
public void addWord(java.lang.String word, double frequency)
word
- the word to addfrequency
- of the occurrence of the wordprivate void recalcNumberOfWords()
public java.util.Set<java.lang.String> getWordSet()