|
|||||||||
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.PhraseSetUtils
public class PhraseSetUtils
Phrase set utilities.
Constructor Summary | |
---|---|
protected |
PhraseSetUtils()
Don't allow instantiation but do allow overrides. |
Method Summary | |
---|---|
static boolean |
addPhrases(PhraseSet phraseSet,
java.util.Map words,
java.util.Map phrases,
ProgressReporter progressReporter)
Add phrases to a phrase set. |
static PhraseSet |
addPhraseSet(java.lang.String title,
java.lang.String description,
java.lang.String webPageURL,
java.lang.String owner,
boolean isPublic,
java.lang.String query)
Add a new phrase set. |
static PhraseSet |
addPhraseSet(java.lang.String title,
java.lang.String description,
java.lang.String webPageURL,
java.lang.String owner,
boolean isPublic,
java.lang.String query,
java.util.Map words,
java.util.Map phrases,
ProgressReporter progressReporter)
Add a new phrase set with specified phrases. |
static PhraseSet |
addPhraseSet(java.lang.String title,
java.lang.String description,
java.lang.String webPageURL,
java.lang.String owner,
boolean isPublic,
WordCounter analysisText,
java.lang.String query,
java.awt.Window parentWindow)
Add a new phrase set using a specified query. |
static boolean |
deletePhraseSet(PhraseSet phraseSet)
Delete a phrase set. |
static boolean |
deletePhraseSet(java.lang.String title,
java.lang.String owner)
Delete a phrase set by title. |
static boolean |
deletePhraseSets(PhraseSet[] phraseSets)
Delete multiple phrase sets. |
static boolean |
deletePhraseSets(PhraseSet[] phraseSets,
ProgressReporter progressReporter)
Delete multiple phrase sets. |
static int |
getDistinctWordFormCount(PhraseSet phraseSet,
int wordForm)
Get distinct word form count in a phrase set. |
static java.util.Map[] |
getPhraseCounts(PhraseSet[] phraseSets,
int wordForm)
Get word form counts in a set of phrase sets. |
static java.util.Map[] |
getPhraseCounts(PhraseSet[] phraseSets,
int wordForm,
boolean getWorkCounts)
Get word form counts in a set of phrase sets. |
static java.util.Map |
getPhraseCounts(PhraseSet phraseSet,
int wordForm)
Get phrase counts in a single phrase set. |
static Phrase[] |
getPhrases(PhraseSet phraseSet)
Get all available phrases in a phrase set as an array. |
static PhraseSet |
getPhraseSet(java.lang.String title)
Get a phrase set by title. |
static PhraseSet |
getPhraseSet(java.lang.String title,
java.lang.String owner)
Get a phrase set by title. |
static PhraseSet[] |
getPhraseSets()
Get all available public phrase sets as an array. |
static PhraseSet[] |
getPhraseSets(java.lang.String owner)
Get all available phrase sets for a specified owner as an array. |
static PhraseSet[] |
getPhraseSets(java.lang.String owner,
boolean onlyPrivate)
Get all available phrase sets for a specified owner as an array. |
static int |
getPhraseSetsCount()
Get count of all available phrase sets. |
static int |
getPhraseSetsCount(java.lang.String owner)
Get count of phrase sets for a user. |
static int |
getPhraseSetsCount(java.lang.String owner,
boolean onlyPrivate)
Get count of phrase sets for a user. |
static PhraseSet[] |
getPhraseSetsForLoggedInUser()
Get phrase sets for logged in user. |
static Word[] |
getSpan(PhraseSet phraseSet,
Word word,
int leftSpan,
int rightSpan)
Get surrounding words of a specified word in a phrase set. |
static java.util.Map[] |
getWordCounts(PhraseSet[] phraseSets,
int wordForm)
|
static java.util.Map[] |
getWordCounts(PhraseSet[] phraseSets,
int wordForm,
boolean getWorkCounts)
Get word form counts in a set of phrase sets. |
static java.util.Map |
getWordCounts(PhraseSet phraseSet,
int wordForm)
Get word counts in a single phrase set. |
static java.util.Map |
getWordFormCount(PhraseSet[] phraseSets,
Spelling[] words,
int wordForm)
Get word count for multiple words in a set of phrase sets. |
static int |
getWordFormCount(PhraseSet phraseSet,
int wordForm)
Get total word form count in a phrase set. |
static int |
getWordFormCount(PhraseSet phraseSet,
int wordForm,
Work work)
Get total word form count for one work represented in a phrase set. |
static java.util.Map |
getWordFormCount(PhraseSet phraseSet,
Spelling[] words,
int wordForm)
Get word count for multiple words in a phrase set. |
static int |
getWordFormCount(PhraseSet phraseSet,
Spelling word,
int wordForm)
Get word count in a phrase set. |
static int |
getWordFormCount(PhraseSet phraseSet,
Spelling word,
int wordForm,
Work work)
Get word count in a phrase set for a specific work. |
static int |
getWordFormPhraseCount(PhraseSet phraseSet,
Spelling phrase,
int wordForm,
Work work)
Get phrase count in a phrase set for a specific phrase in a work. |
static Word[] |
getWordOccurrences(PhraseSet phraseSet,
int wordForm,
Spelling word)
Get word occurrences for a word in a specified phrase set. |
static Word[] |
getWords(PhraseSet phraseSet)
Get all available words in a phrase set as an array. |
static WorkPart[] |
getWorkParts(PhraseSet phraseSet)
Get array of all work parts for a phrase set. |
static Work[] |
getWorks(PhraseSet phraseSet)
Get array of all works for a phrase set. |
static java.util.Collection |
preloadPhrases(PhraseSet phraseSet)
Preload phrase data. |
protected static PhraseSet[] |
udosToPhraseSets(UserDataObject[] udos)
Copy UserDataObject array to PhraseSet array. |
static boolean |
updatePhraseSet(PhraseSet phraseSet,
java.lang.String title,
java.lang.String description,
java.lang.String webPageURL,
boolean isPublic)
Update a phrase set. |
static boolean |
updatePhraseSet(PhraseSet phraseSet,
java.lang.String title,
java.lang.String description,
java.lang.String webPageURL,
boolean isPublic,
java.util.Collection phrases)
Update a phrase set. |
static boolean |
updatePhraseSet(PhraseSet phraseSet,
java.lang.String title,
java.lang.String description,
java.lang.String webPageURL,
boolean isPublic,
Phrase[] phrases)
Update a phrase set. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
protected PhraseSetUtils()
Method Detail |
---|
protected static PhraseSet[] udosToPhraseSets(UserDataObject[] udos)
udos
- Array of user data objects, all actually
PhraseSet objects.
public static PhraseSet addPhraseSet(java.lang.String title, java.lang.String description, java.lang.String webPageURL, java.lang.String owner, boolean isPublic, java.lang.String query, java.util.Map words, java.util.Map phrases, ProgressReporter progressReporter) throws DuplicatePhraseSetException
title
- Title for the new phrase set.description
- Description for the new phrase set.webPageURL
- Web page URL for the new phrase set.owner
- The phrase set owner.isPublic
- True if phrase set to be public.query
- The query string generating the phrases.phrases
- Phrases to add to phrase set.progressReporter
- Progress display to update. May be null.
DuplicatePhraseSetException
public static PhraseSet addPhraseSet(java.lang.String title, java.lang.String description, java.lang.String webPageURL, java.lang.String owner, boolean isPublic, java.lang.String query) throws DuplicatePhraseSetException
title
- Title for the new phrase set.description
- Description for the new phrase set.webPageURL
- Web page URL for the new phrase set.owner
- The phrase set owner.isPublic
- True if phrase set is to be public.query
- The query string generating the phrases.
DuplicatePhraseSetException
public static PhraseSet addPhraseSet(java.lang.String title, java.lang.String description, java.lang.String webPageURL, java.lang.String owner, boolean isPublic, WordCounter analysisText, java.lang.String query, java.awt.Window parentWindow) throws DuplicatePhraseSetException, InvalidCQLQueryException
title
- Title for the new phrase set.description
- Description for the new phrase set.webPageURL
- Web page URL for the new phrase set.owner
- The phrase set owner.isPublic
- True if phrase set to be public.analysisText
- Text set from which to extract phrases.query
- Query to select phrases in analysis text.parentWindow
- Parent window.
DuplicatePhraseSetException
InvalidCQLQueryException
public static boolean addPhrases(PhraseSet phraseSet, java.util.Map words, java.util.Map phrases, ProgressReporter progressReporter)
phraseSet
- The phrase set.words
- Words to add to phrase set.phrases
- Phrases to add to phrase set.progressReporter
- Progress display to update. May be null.
If this method returns false, the caller should delete the phrase set.
public static boolean deletePhraseSet(PhraseSet phraseSet)
phraseSet
- The phrase set to delete.
public static boolean deletePhraseSet(java.lang.String title, java.lang.String owner)
title
- The title of the phrase set to delete.owner
- Owner of phrase set.
public static boolean deletePhraseSets(PhraseSet[] phraseSets)
phraseSets
- The phrase sets to delete.
public static boolean deletePhraseSets(PhraseSet[] phraseSets, ProgressReporter progressReporter)
phraseSets
- The phrase sets to delete.progressReporter
- A progress reporter.
public static PhraseSet getPhraseSet(java.lang.String title, java.lang.String owner)
title
- The title of the phrase set to fetch.owner
- The owner of the phrase set to fetch.
public static PhraseSet getPhraseSet(java.lang.String title)
title
- The title of the phrase set to fetch.
public static PhraseSet[] getPhraseSets()
public static PhraseSet[] getPhraseSets(java.lang.String owner, boolean onlyPrivate)
owner
- Currently logged in owner.onlyPrivate
- True to get only private phrase sets for owner.
public static PhraseSet[] getPhraseSets(java.lang.String owner)
owner
- Currently logged in owner.
public static int getPhraseSetsCount(java.lang.String owner, boolean onlyPrivate)
owner
- Currently logged in owner.onlyPrivate
- True to count only private phrase sets for owner.
public static PhraseSet[] getPhraseSetsForLoggedInUser()
public static int getPhraseSetsCount(java.lang.String owner)
owner
- Currently logged in owner.
public static int getPhraseSetsCount()
public static Phrase[] getPhrases(PhraseSet phraseSet)
phraseSet
- The phrase set.
Returns null if phrase set is null.
public static java.util.Collection preloadPhrases(PhraseSet phraseSet)
phraseSet
- The phrase set.
Returns null if phrase set is null.
public static Word[] getWords(PhraseSet phraseSet)
phraseSet
- The phrase set.
Returns null if phrase set is null.
public static boolean updatePhraseSet(PhraseSet phraseSet, java.lang.String title, java.lang.String description, java.lang.String webPageURL, boolean isPublic, Phrase[] phrases) throws DuplicatePhraseSetException
phraseSet
- The phrase set to update.title
- Title for the phrase set.description
- Description for the phrase set.webPageURL
- Web page URL for the phrase set.isPublic
- True if phrase set is public.phrases
- Array of Phrase entries for phrase set.
Set to null to leave current phrase set.
Set to empty array to remove current phrases.
DuplicatePhraseSetException
public static boolean updatePhraseSet(PhraseSet phraseSet, java.lang.String title, java.lang.String description, java.lang.String webPageURL, boolean isPublic, java.util.Collection phrases) throws DuplicatePhraseSetException
phraseSet
- The phrase set to update.title
- Title for the phrase set.description
- Description for the phrase set.webPageURL
- Web page URL for the phrase set.isPublic
- True if phrase set is public.phrases
- Collection of Phrase entries for phrase set.
DuplicatePhraseSetException
public static boolean updatePhraseSet(PhraseSet phraseSet, java.lang.String title, java.lang.String description, java.lang.String webPageURL, boolean isPublic) throws DuplicatePhraseSetException
phraseSet
- The phrase set to update.title
- Title for the phrase set.description
- Description for the phrase set.webPageURL
- Web page URL for the phrase set.isPublic
- True if phrase set is public.
DuplicatePhraseSetException
public static WorkPart[] getWorkParts(PhraseSet phraseSet)
phraseSet
- The phrase set.
public static Work[] getWorks(PhraseSet phraseSet)
phraseSet
- The phrase set.
public static int getWordFormCount(PhraseSet phraseSet, int wordForm, Work work)
phraseSet
- The phrase set.wordForm
- The word form.work
- The work.
public static int getWordFormCount(PhraseSet phraseSet, int wordForm)
phraseSet
- The phrase set.wordForm
- The word form.
public static int getDistinctWordFormCount(PhraseSet phraseSet, int wordForm)
phraseSet
- The phrase set.wordForm
- The word form.
public static int getWordFormCount(PhraseSet phraseSet, Spelling word, int wordForm)
phraseSet
- The phrase set.word
- The word.wordForm
- The word form.
public static int getWordFormCount(PhraseSet phraseSet, Spelling word, int wordForm, Work work)
phraseSet
- The phrase set.word
- The word.wordForm
- The word form.work
- The work.
public static java.util.Map getWordFormCount(PhraseSet phraseSet, Spelling[] words, int wordForm)
phraseSet
- The phrase set.words
- The words.wordForm
- The word form.
public static java.util.Map getWordFormCount(PhraseSet[] phraseSets, Spelling[] words, int wordForm)
phraseSets
- The phrase sets.words
- The words.wordForm
- The word form.
public static java.util.Map getWordCounts(PhraseSet phraseSet, int wordForm)
phraseSet
- The phrase set.wordForm
- The word form to count.
public static java.util.Map getPhraseCounts(PhraseSet phraseSet, int wordForm)
phraseSet
- The phrase set.wordForm
- The word form to count.
public static java.util.Map[] getWordCounts(PhraseSet[] phraseSets, int wordForm, boolean getWorkCounts)
phraseSets
- The phrase sets.wordForm
- The word form to count.getWorkCounts
- if true, work counts are returned in the second
result map (see below). If false, hashsets of
work IDs are returned in the second result map.
public static java.util.Map[] getWordCounts(PhraseSet[] phraseSets, int wordForm)
public static java.util.Map[] getPhraseCounts(PhraseSet[] phraseSets, int wordForm, boolean getWorkCounts)
phraseSets
- The phrase sets.wordForm
- The word form to count.getWorkCounts
- if true, work counts are returned in the second
result map (see below). If false, hashsets of
work IDs are returned in the second result map.
public static java.util.Map[] getPhraseCounts(PhraseSet[] phraseSets, int wordForm)
phraseSets
- The phrase sets.wordForm
- The word form to count.
public static int getWordFormPhraseCount(PhraseSet phraseSet, Spelling phrase, int wordForm, Work work)
phraseSet
- The phrase set.phrase
- The phrase text.wordForm
- The word form.work
- The work.
public static Word[] getWordOccurrences(PhraseSet phraseSet, int wordForm, Spelling word)
phraseSet
- The phrase set.wordForm
- The word form.word
- The word to look up.
public static Word[] getSpan(PhraseSet phraseSet, Word word, int leftSpan, int rightSpan)
phraseSet
- The phrase set.word
- Word for which to get span.leftSpan
- # of words to left of
specified word to retrieve.rightSpan
- # of words to right of
specified word to retrieve.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |