|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.statcato.utils.CategoryCounter
public class CategoryCounter
Keeps track of a previously unspecified number of categories and the frequency of each category. Maps each category to a unique number.
Constructor Summary | |
---|---|
CategoryCounter()
Constructor. |
Method Summary | |
---|---|
void |
addCategory(java.lang.String cat)
Adds the given category to the counter. |
java.util.Vector<java.lang.String> |
getCategories()
|
java.lang.String |
getCategory(int i)
Returns the category at the given index. |
int |
getEqualFrequency()
Checks if all the frequencies are the same. |
int |
getFrequency(java.lang.String cat)
Returns the frequency of the given category. |
int |
getIndex(java.lang.String cat)
Returns the index corresponding to the given category, or returns -1 if the category is not found. |
int |
getSize()
Returns the number of categories found by this counter. |
java.lang.String |
toString()
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public CategoryCounter()
Method Detail |
---|
public void addCategory(java.lang.String cat)
cat
- category stringpublic java.lang.String getCategory(int i)
i
- index
public java.util.Vector<java.lang.String> getCategories()
public int getIndex(java.lang.String cat)
cat
- category
public int getSize()
public int getEqualFrequency()
public int getFrequency(java.lang.String cat)
cat
- category
public java.lang.String toString()
toString
in class java.lang.Object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |