kwic
Class KWIC

java.lang.Object
  extended by kwic.KWIC

public class KWIC
extends Object

Key Word in Context


Field Summary
protected  Map<Word,Set<Phrase>> map
           
protected  PropertyChangeSupport pcs
           
 
Constructor Summary
KWIC()
           
 
Method Summary
 void addPhrase(Phrase p)
          For each Word in the Phrase, add the Word to the association.
 void addPhrase(String s)
          Convenient interface, accepts a standrd Java String
 void addPhrases(File file)
          Add each line in the file as a phrase.
 void deletePhrase(Phrase p)
          For each word in the Phrase, delete the association between the word and the phrase.
 void deleteWord(Word w)
          Drop a word completely from the KWIC
 void dropAssoc(Word w, Phrase p)
          Drop the association between the specified Word and Phrase, if any
 void forceAssoc(Word w, Phrase p)
          Force a mapping between the speicified Word and Phrase
 PropertyChangeSupport getPCS()
          Required for part (b) of this lab.
 Set<Phrase> getPhrases(Word w)
          Return a Set that provides each Phrase associated with the specified Word.
 Set<Word> getWords()
          Rerturn a Set of all words
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

pcs

protected PropertyChangeSupport pcs

map

protected Map<Word,Set<Phrase>> map
Constructor Detail

KWIC

public KWIC()
Method Detail

getPCS

public PropertyChangeSupport getPCS()
Required for part (b) of this lab. Accessor for the PropertyChangeSuppport


addPhrase

public void addPhrase(String s)
Convenient interface, accepts a standrd Java String

Parameters:
s - String to be added

addPhrases

public void addPhrases(File file)
Add each line in the file as a phrase. For each line in the file, call addPhrase(String) to add the line as a phrase.

Parameters:
file - the file whose lines should be loaded as phrases

addPhrase

public void addPhrase(Phrase p)
For each Word in the Phrase, add the Word to the association. Use reduction to forceAssoc(Word, Phrase).

Parameters:
p - Phrase to be added

deletePhrase

public void deletePhrase(Phrase p)
For each word in the Phrase, delete the association between the word and the phrase. Use reduction to dropAssoc(Word, Phrase).


forceAssoc

public void forceAssoc(Word w,
                       Phrase p)
Force a mapping between the speicified Word and Phrase


dropAssoc

public void dropAssoc(Word w,
                      Phrase p)
Drop the association between the specified Word and Phrase, if any


getPhrases

public Set<Phrase> getPhrases(Word w)
Return a Set that provides each Phrase associated with the specified Word.


deleteWord

public void deleteWord(Word w)
Drop a word completely from the KWIC

Parameters:
w - Word to be dropped

getWords

public Set<Word> getWords()
Rerturn a set of all words