|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object edu.northwestern.at.wordhoard.swing.calculator.modelutils.CountableWordDataCounter
public class CountableWordDataCounter
Countable word data counter.
Counts the data in one or more CountableWordData
objects.
These are most often the results of a WordHoard CQL query.
Field Summary | |
---|---|
protected static int |
batchSize
Batch size for counting word data entries. |
protected java.util.Map |
countableWordDataMap
Countable word data map. |
protected java.util.Map |
posMap
Word class/word class map for spellings. |
protected java.util.Map[] |
totalWordCountMaps
The word total count maps. |
protected java.util.Map[] |
wordCountMaps
The word count maps. |
protected java.util.Collection |
wordDataList
The list of countable word data items to count. |
protected java.util.Set |
wordIDsForPhrasesSet
Set of unique word ID lists for phrases. |
protected java.util.Set |
wordTagsSet
Set of word tags encountered. |
protected java.util.Set |
workIDsSet
Set of work IDs encountered. |
protected java.util.Set |
workPartIDsSet
Set of work part IDs encountered. |
Constructor Summary | |
---|---|
CountableWordDataCounter()
Create countable word data counter. |
|
CountableWordDataCounter(java.util.Collection wordDataList)
Create countable word data counter. |
|
CountableWordDataCounter(java.util.Iterator iterator)
Create countable word data counter. |
Method Summary | |
---|---|
protected static void |
countOneWordForm(java.util.Map wordCountMap,
java.util.Map totalWordCountMap,
Spelling[] values,
java.lang.Long workId)
Update a count map for several word form values for a word. |
protected static void |
countOneWordForm(java.util.Map wordCountMap,
java.util.Map totalWordCountMap,
Spelling value,
java.lang.Long workId)
Update a count map for a specific word and word form. |
void |
countPhrases()
Count phrases. |
void |
countSpellings()
Count spellings. |
void |
countSpellings(java.util.Map countableWordDataMap,
java.util.Map[] wordCountMaps,
java.util.Map[] totalWordCountMaps)
Count spellings. |
void |
countWordParts(java.util.Collection words,
boolean lastWords,
ProgressReporter progressReporter)
Count words from a list of Word objects. |
void |
countWordParts(java.util.Collection wordDataList,
java.util.Map[] wordCountMaps,
java.util.Map[] totalWordCountMaps)
Get word counts for a set of words. |
void |
countWordParts(java.util.Iterator iterator,
boolean lastIterator,
ProgressReporter progressReporter)
Count words from an iterator over CountWordData objects. |
void |
countWordParts(Word[] words,
boolean lastWords,
ProgressReporter progressReporter)
Count words from a list of Word objects. |
void |
createPhrases()
Create phrases. |
java.util.Map |
getCountableWordDataMap()
Get the countable word data map. |
java.util.Map[] |
getTotalWordCountMaps()
Get the total count maps. |
java.util.Map[] |
getWordCountMaps()
Get the word count maps. |
int |
getWordPartsCounted()
Get number of word parts counted. |
int |
getWordsCounted()
Get number of words counted. |
int |
getWorkPartsCounted()
Get number of work parts counted. |
int |
getWorksCounted()
Get number of works counted. |
protected void |
initMaps()
Initializes the maps and sets used to hold the word data and counts. |
protected void |
mergeWordDataIntoPhraseData(CountableWordData wordData,
CountableWordData phraseData)
Merge word data into phrase data. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected java.util.Collection wordDataList
protected java.util.Map[] wordCountMaps
protected java.util.Map[] totalWordCountMaps
protected java.util.Map countableWordDataMap
protected java.util.Map posMap
protected java.util.Set wordIDsForPhrasesSet
protected java.util.Set workPartIDsSet
protected java.util.Set workIDsSet
protected java.util.Set wordTagsSet
protected static final int batchSize
Constructor Detail |
---|
public CountableWordDataCounter()
public CountableWordDataCounter(java.util.Collection wordDataList)
wordDataList
- A collection of countable word data
items to count.
Use this constructor when all the words to be counted are present in the collection passed as an argument.
public CountableWordDataCounter(java.util.Iterator iterator)
iterator
- Iterator over countable word data objects.
Use this constructor when the objects to count come from a scrollable query result. The word data is counted in batches to reduce memory requirements.
Method Detail |
---|
protected void initMaps()
public java.util.Map[] getWordCountMaps()
public java.util.Map[] getTotalWordCountMaps()
protected static void countOneWordForm(java.util.Map wordCountMap, java.util.Map totalWordCountMap, Spelling value, java.lang.Long workId)
wordCountMap
- The word counts.totalWordCountMap
- The total counts.value
- The word value.workId
- The work ID for this word. protected static void countOneWordForm(java.util.Map wordCountMap, java.util.Map totalWordCountMap, Spelling[] values, java.lang.Long workId)
wordCountMap
- The word counts.totalWordCountMap
- The total counts.values
- The word values.workId
- The work ID for this word. public void countWordParts(java.util.Collection wordDataList, java.util.Map[] wordCountMaps, java.util.Map[] totalWordCountMaps)
wordDataList
- The countable word data for the words.wordCountMaps
- The output word count maps.totalWordCountMaps
- The output total word count maps.
The indices of the count maps and total counts match those of
of the word forms as given in WordForms
.
public void countSpellings(java.util.Map countableWordDataMap, java.util.Map[] wordCountMaps, java.util.Map[] totalWordCountMaps)
countableWordDataMap
- The countable word data.wordCountMaps
- The word count maps.totalWordCountMaps
- The total word count maps.
The word count and total word count maps are updated with the spelling counts.
public void countSpellings()
The word count and total word count maps are updated with the spelling counts.
public void countWordParts(java.util.Iterator iterator, boolean lastIterator, ProgressReporter progressReporter)
iterator
- Iterator over CountableWordData objects.lastIterator
- True if this iterator is for the last
batch of words to count.progressReporter
- Progress reporter. Can be null. public void countWordParts(Word[] words, boolean lastWords, ProgressReporter progressReporter)
words
- Array of Word objects.lastWords
- True if this is the last batch of words
to count.progressReporter
- Progress reporter. Can be null. public void countWordParts(java.util.Collection words, boolean lastWords, ProgressReporter progressReporter)
words
- Collection of Word objects.lastWords
- True if this is the last batch of words
to count.progressReporter
- Progress reporter. Can be null. protected void mergeWordDataIntoPhraseData(CountableWordData wordData, CountableWordData phraseData)
wordData
- The data for a word.phraseData
- The data for a phrase. public void createPhrases()
public void countPhrases()
public java.util.Map getCountableWordDataMap()
public int getWordPartsCounted()
public int getWordsCounted()
public int getWorksCounted()
public int getWorkPartsCounted()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |