org.eml.sir.rel
Class FrequencyList

java.lang.Object
  extended byorg.eml.sir.rel.FrequencyList
All Implemented Interfaces:
java.io.Serializable
Direct Known Subclasses:
StemFrequencyList, WordFrequencyList

public class FrequencyList
extends java.lang.Object
implements java.io.Serializable

List containing Strings and their frequency.

Author:
Hendrik Niederlich (EML-R)
See Also:
Serialized Form

Field Summary
static char ORDER_ALPHABETICAL
           
static char ORDER_BY_FREQUENCY
           
 
Constructor Summary
FrequencyList()
          Create a new instance of FrequencyList.
 
Method Summary
 void add(java.lang.String graphs)
          Add a String to this FrequencyList.
 void addSome(java.lang.String graphs, int number)
          Add the multiple occurrence of a String to this FrequencyList.
 java.util.ArrayList getAlphabeticalList()
          Return the Strings that have been added to this FrequencyList ordered alpabetically.
 int getFrequency(java.lang.String graphs)
          Return the frequency of the specified String.
 java.util.ArrayList getFrequencyList()
          Return the Strings that have been added to this FrequencyList ordered by their frequency.
 java.util.HashMap getMap()
          Return an HashMap with Strings as keys and their frequency as the values.
 char getPartOfSpeech()
          Return part of speech of this FrequencyList.
 int getSumOverAll()
          Return the number of all Strings that have been added.
static FrequencyList load(java.lang.String fileName)
          Load a serialized instance of FrequencyList.
 boolean save(java.lang.String fileName)
          Serialize an instance of FrequencyList and save it to a file.
 void setPartOfSpeech(char pos)
          Set part of speech of this FrequencyList.
 int size()
          Return the number of different Strings that have been counted.
 java.lang.String[] toStrings(char what)
          Return a String array that contains the Strings of this FrequencyList and their frequency ordered by frequency or alphabetically.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ORDER_ALPHABETICAL

public static final char ORDER_ALPHABETICAL
See Also:
Constant Field Values

ORDER_BY_FREQUENCY

public static final char ORDER_BY_FREQUENCY
See Also:
Constant Field Values
Constructor Detail

FrequencyList

public FrequencyList()
Create a new instance of FrequencyList.

Method Detail

getPartOfSpeech

public char getPartOfSpeech()
Return part of speech of this FrequencyList.


setPartOfSpeech

public void setPartOfSpeech(char pos)
Set part of speech of this FrequencyList.


add

public void add(java.lang.String graphs)
Add a String to this FrequencyList. It is counted once.


addSome

public void addSome(java.lang.String graphs,
                    int number)
Add the multiple occurrence of a String to this FrequencyList. It is counted as often as the number says.

Parameters:
number - Number of the String to be counted.

size

public int size()
Return the number of different Strings that have been counted. Note that this is not the number all Strings that have been added!


getSumOverAll

public int getSumOverAll()
Return the number of all Strings that have been added.


getMap

public java.util.HashMap getMap()
Return an HashMap with Strings as keys and their frequency as the values.

Returns:
HashMap containing keys (String) and values (Integer).

getAlphabeticalList

public java.util.ArrayList getAlphabeticalList()
Return the Strings that have been added to this FrequencyList ordered alpabetically.

Returns:
ArrayList of Strings of this FrequencyList ordered alpabetically.

getFrequencyList

public java.util.ArrayList getFrequencyList()
Return the Strings that have been added to this FrequencyList ordered by their frequency.

Returns:
ArrayList of Strings of this FrequencyList ordered by their frequency.

getFrequency

public int getFrequency(java.lang.String graphs)
Return the frequency of the specified String.


toStrings

public java.lang.String[] toStrings(char what)
Return a String array that contains the Strings of this FrequencyList and their frequency ordered by frequency or alphabetically.

Parameters:
what - The order. Use the field constants ORDER_ALPHABETICAL or ORDER_BY_FREQUENCY.

load

public static FrequencyList load(java.lang.String fileName)
Load a serialized instance of FrequencyList.

Parameters:
fileName - Complete path and file name.

save

public boolean save(java.lang.String fileName)
Serialize an instance of FrequencyList and save it to a file.

Parameters:
fileName - Complete path and file name.