gov.nih.nlm.mms.browser
Class WordSearchFinder

java.lang.Object
  extended by gov.nih.nlm.mms.browser.AbstractFinder
      extended by gov.nih.nlm.mms.browser.WordSearchFinder
All Implemented Interfaces:
Finder, Configurable, GUIConfigurable, Comparable

public class WordSearchFinder
extends AbstractFinder

Finds Concepts via word searches. All methods in this class should be called from a separate thread.

Author:
Deborah Shapiro

Nested Class Summary
 class WordSearchFinder.BackwardAction
          Action provided to display the previous page of word search results.
 class WordSearchFinder.ForwardAction
          Action provided to display the next page of word search results.
static class WordSearchFinder.Options
          Options is the model of the WordSearchFinder.OptionsGUI dialog.
 class WordSearchFinder.OptionsGUI
          Options GUI for WordSearchFinder.
 class WordSearchFinder.PopupListener
          Listens to display the JPopupMenu.
static class WordSearchFinder.RadioButtonChoice
          Enumerates radio button choices in WordSearchFinder.OptionsGUI.
 
Field Summary
protected static String DELIM
           
static String normalized_mode
          Normalized Search Mode
static String regular_mode
          Regular Search Mode
 
Fields inherited from class gov.nih.nlm.mms.browser.AbstractFinder
clm, fBrowsableInputStream, font_family, font_point_size, has_data_changed, user_configuration
 
Constructor Summary
WordSearchFinder()
          Instantiates a WordSearchFinder.
 
Method Summary
 void addDataChangeListener(DataChangeListener dcl)
          Adds a DataChangeListener that responds to configuration changes.
protected  double estimateCost(String[] searchWords, WordSearchFinder.RadioButtonChoice radioButtonChoice, Map wordFrequencyMap)
          Estimates the cost of searching for the specified words, given a Map of the word frequency counts within strings.
protected  Concept[] findConceptsByWords(String[] words, Map wordFrequencyMap, WordSearchFinder.Options options)
          Find Concepts that match search words, with results filtered by WordSearchFinder.Options.
 String getLvgConfigFile()
          Returns the LVG configuration file.
 String getName()
          Returns the name.
 JPanel getPanel()
          Returns a JPanel containing configuration options.
 Properties getProperties()
          Method returns all properties specific to the Finder.
 String getSearchMode()
          Returns the search mode.
 boolean hasAdvancedOptions()
          Indicates whether or not an options menu item should be supplied for advanced configuration options.
 void highlightText()
          Highlights the text displayed in the word text field.
 void refresh()
          Redraws the text portions of the Finder.
 void removeDataChangeListener(DataChangeListener dcl)
          Removes the specified DataChangeListener.
 void resetToDefaults()
          Resets the configuration back to default values.
 void setLvgConfigFile(String lvg_config_file)
          Sets the LVG configuration file.
 void setProperties(Properties p)
          Sets the finder properties.
 void setSearchMode(String search_mode)
          Sets the search mode.
 void showOptions()
          Presents an advanced options GUI to the user.
 void subsetDirectoryOpened(File source_dir)
          Handles opening of a source directory.
 
Methods inherited from class gov.nih.nlm.mms.browser.AbstractFinder
compareTo, getBrowsableInputStream, getColor, getConfigurationDetails, getGUIConfigurableForValidationFailure, getHelpPanel, getTabDescription, getValidateMessage, getValidationErrors, getValidationWarnings, hasDataChanged, resetDataChanged, setBrowsableInputStream, setConceptListManager, setConfiguration, setConfiguration, setDataChanged, setFontFamily, setFontPointSize, setPanelSelections, validate
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

regular_mode

public static String regular_mode
Regular Search Mode


normalized_mode

public static String normalized_mode
Normalized Search Mode


DELIM

protected static final String DELIM
See Also:
Constant Field Values
Constructor Detail

WordSearchFinder

public WordSearchFinder()
Instantiates a WordSearchFinder.

Method Detail

getPanel

public JPanel getPanel()
Returns a JPanel containing configuration options.

Returns:
a JPanel containing configuration options

getProperties

public Properties getProperties()
Method returns all properties specific to the Finder.

Specified by:
getProperties in interface Configurable
Overrides:
getProperties in class AbstractFinder
Returns:
Properties only those directly related to the finder.

setProperties

public void setProperties(Properties p)
Sets the finder properties.

Specified by:
setProperties in interface Configurable
Overrides:
setProperties in class AbstractFinder
Parameters:
p - Properties

subsetDirectoryOpened

public void subsetDirectoryOpened(File source_dir)
Handles opening of a source directory.

Specified by:
subsetDirectoryOpened in interface Finder
Overrides:
subsetDirectoryOpened in class AbstractFinder
Parameters:
source_dir - the source directory

getSearchMode

public String getSearchMode()
Returns the search mode.

Returns:
search mode

setSearchMode

public void setSearchMode(String search_mode)
Sets the search mode.

Parameters:
search_mode -

getLvgConfigFile

public String getLvgConfigFile()
Returns the LVG configuration file.

Returns:
lvg configuration file

setLvgConfigFile

public void setLvgConfigFile(String lvg_config_file)
Sets the LVG configuration file.

Parameters:
lvg_config_file -

resetToDefaults

public void resetToDefaults()
Resets the configuration back to default values. When used with a GUI this method should change the data model behind the GUI and allow setPanelSelections to actually update the GUI.


findConceptsByWords

protected Concept[] findConceptsByWords(String[] words,
                                        Map wordFrequencyMap,
                                        WordSearchFinder.Options options)
                                 throws InterruptedException,
                                        IOException
Find Concepts that match search words, with results filtered by WordSearchFinder.Options.

Parameters:
words - search words
wordFrequencyMap - Map of search word frequencies.
options - WordSearchFinder.Options
Returns:
array of Concept matches.
Throws:
InterruptedException
IOException

estimateCost

protected double estimateCost(String[] searchWords,
                              WordSearchFinder.RadioButtonChoice radioButtonChoice,
                              Map wordFrequencyMap)
Estimates the cost of searching for the specified words, given a Map of the word frequency counts within strings.

Parameters:
searchWords - array of words to be searched
radioButtonChoice - (@link RadioButtonChoice} for limiting results
wordFrequencyMap - Map from words to frequencies of those words within strings
Returns:
estimated cost of the search.

highlightText

public void highlightText()
Highlights the text displayed in the word text field.


addDataChangeListener

public void addDataChangeListener(DataChangeListener dcl)
Adds a DataChangeListener that responds to configuration changes. Allows main GUI to record all changes to this gui in the undo/redo mechanism.

Specified by:
addDataChangeListener in interface GUIConfigurable
Overrides:
addDataChangeListener in class AbstractFinder
Parameters:
dcl - the DataChangeListener to add

removeDataChangeListener

public void removeDataChangeListener(DataChangeListener dcl)
Removes the specified DataChangeListener.

Specified by:
removeDataChangeListener in interface GUIConfigurable
Overrides:
removeDataChangeListener in class AbstractFinder
Parameters:
dcl - the DataChangeListener to remove

getName

public String getName()
Returns the name.

Returns:
the name

showOptions

public void showOptions()
Presents an advanced options GUI to the user.


hasAdvancedOptions

public boolean hasAdvancedOptions()
Indicates whether or not an options menu item should be supplied for advanced configuration options.

Returns:
true if so; false otherwise

refresh

public void refresh()
Redraws the text portions of the Finder.

Specified by:
refresh in interface Finder
Overrides:
refresh in class AbstractFinder


Copyright ©2005