at.tuwien.ifs.somtoolbox.output.labeling
Class UnitWordsMap

java.lang.Object
  extended by at.tuwien.ifs.somtoolbox.output.labeling.UnitWordsMap

public class UnitWordsMap
extends java.lang.Object

Contains all UnitWords for the map and can be used to calculate goodnesses of words and select the best words from an unit.

Version:
$Id: UnitWordsMap.java 4185 2011-03-01 14:18:52Z mayer $
Author:
Hauke Schuldt, Alois Wollersberger

Field Summary
 int A0_RADIUS
           
 int A1_RADIUS
           
private  UnitWords[][][] unitWords
           
 
Constructor Summary
UnitWordsMap(int x, int y, int z)
          Generates a new empty UnitWordsMap with the specified dimensions
 
Method Summary
 double calcGoodness(int x, int y, int z, java.lang.String word)
          Calculates goodness G1 for map units
 java.util.Hashtable<java.lang.String,java.lang.Double> chooseBestWord(int x, int y, int z, java.util.Hashtable<java.lang.String,java.lang.Double> top)
          Choose word from hashmap based on G2 Goodness
 java.util.Hashtable<java.lang.String,java.lang.Double> getBestWords(int x, int y, int z, int num)
          get number of count Words in hashtable with G1 goodness value
 UnitWords getUnitWords(int x, int y, int z)
          Returns the UnitWords at the specified position
 java.util.List<UnitWords> getUnitWordsInsideRadius(int x, int y, int z, int radius)
          Returns for a UnitWords at a specified postion all UnitWords which are inside its radius
 java.util.List<UnitWords> getUnitWordsOutsideRadius(int x, int y, int z, int radius)
          Returns for a UnitWords at a specified postion all UnitWords which are outside its radius
 double mapAreaGoodness(int x, int y, int z, java.lang.String word)
          Calculates goodness G1 for map areas
 UnitWords newUnitWords(int x, int y, int z)
          Creates and returns a new, empty UnitWords at the specified position
 void setUnitWords(UnitWords unitWords, int x, int y, int z)
          Sets a UnitWords to the specified position
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

unitWords

private UnitWords[][][] unitWords

A0_RADIUS

public int A0_RADIUS

A1_RADIUS

public int A1_RADIUS
Constructor Detail

UnitWordsMap

public UnitWordsMap(int x,
                    int y,
                    int z)
Generates a new empty UnitWordsMap with the specified dimensions

Parameters:
x - the size of the x-axis
y - the size of the y-axis
z - the size of the z-axis
Method Detail

setUnitWords

public void setUnitWords(UnitWords unitWords,
                         int x,
                         int y,
                         int z)
Sets a UnitWords to the specified position

Parameters:
unitWords - the UnitWords to set
x - the position on the x-axis
y - the position on the y-axis
z - the position on the z-axis

getUnitWords

public UnitWords getUnitWords(int x,
                              int y,
                              int z)
Returns the UnitWords at the specified position

Parameters:
x - the position on the x-axis
y - the position on the y-axis
z - the position on the z-axis
Returns:
the UnitWords at the specified position

newUnitWords

public UnitWords newUnitWords(int x,
                              int y,
                              int z)
Creates and returns a new, empty UnitWords at the specified position

Parameters:
x - the position on the x-axis
y - the position on the y-axis
z - the position on the z-axis *
Returns:
a newly created UnitWords which contains no words yet.

getUnitWordsOutsideRadius

public java.util.List<UnitWords> getUnitWordsOutsideRadius(int x,
                                                           int y,
                                                           int z,
                                                           int radius)
Returns for a UnitWords at a specified postion all UnitWords which are outside its radius

Parameters:
x - the position of the unit on the x-axis
y - the position of the unit on the y-axis
z - the position of the unit on the z-axis
radius - the distance the units have to be away
Returns:
all UnitWords which are outside the radius

getUnitWordsInsideRadius

public java.util.List<UnitWords> getUnitWordsInsideRadius(int x,
                                                          int y,
                                                          int z,
                                                          int radius)
Returns for a UnitWords at a specified postion all UnitWords which are inside its radius

Parameters:
x - the position of the unit on the x-axis
y - the position of the unit on the y-axis
z - the position of the unit on the z-axis
radius - the distance in which the units have to be
Returns:
all UnitWords which are inside the radius

calcGoodness

public double calcGoodness(int x,
                           int y,
                           int z,
                           java.lang.String word)
Calculates goodness G1 for map units

Parameters:
x - the position of the unit on the x-axis
y - the position of the unit on the y-axis
z - the position of the unit on the z-axis
word - the word to process
Returns:
the goodness of the word for this unit

getBestWords

public java.util.Hashtable<java.lang.String,java.lang.Double> getBestWords(int x,
                                                                           int y,
                                                                           int z,
                                                                           int num)
get number of count Words in hashtable with G1 goodness value

Parameters:
x - the position of the unit on the x-axis
y - the position of the unit on the y-axis
z - the position of the unit on the z-axis
num - the number how many best words to return
Returns:
a sorted hashtable with the best words

mapAreaGoodness

public double mapAreaGoodness(int x,
                              int y,
                              int z,
                              java.lang.String word)
Calculates goodness G1 for map areas

Parameters:
x - the position of the unit on the x-axis
y - the position of the unit on the y-axis
z - the position of the unit on the z-axis
word - the word to process
Returns:
the goodness of the word for this unit

chooseBestWord

public java.util.Hashtable<java.lang.String,java.lang.Double> chooseBestWord(int x,
                                                                             int y,
                                                                             int z,
                                                                             java.util.Hashtable<java.lang.String,java.lang.Double> top)
Choose word from hashmap based on G2 Goodness

Parameters:
x - the position of the unit on the x-axis
y - the position of the unit on the y-axis
z - the position of the unit on the z-axis
top - top
Returns:
the best word for the map area. It is returned in an hashmap with size = 1.