gov.nih.nlm.mms
Class RichMRMetamorphoSysInputStream

java.lang.Object
  extended bygov.nih.nlm.umls.io.RichMRFilesConceptInputStream
      extended bygov.nih.nlm.umls.io.RichMRMetathesaurusInputStream
          extended bygov.nih.nlm.mms.RichMRMetamorphoSysInputStream
All Implemented Interfaces:
Comparable, ConceptInputStream, Configurable, GUIConfigurable, MetamorphoSysInputStream, MetathesaurusInputStream, SubsetListener
Direct Known Subclasses:
NLMFileMetamorphoSysInputStream

public class RichMRMetamorphoSysInputStream
extends RichMRMetathesaurusInputStream
implements MetamorphoSysInputStream

Represents a MetamorphoSysInputStream that reads content from a directory containing Rich Release Format Metathesaurus files.

Author:
Deborah Shapiro

Field Summary
protected  CuiList cui_list
           
protected  ApplicationConfiguration default_config
           
protected  UserConfiguration user_configuration
           
protected  String validate_msg
           
 
Fields inherited from class gov.nih.nlm.umls.io.RichMRMetathesaurusInputStream
current_index, index_counter, index_lines, mraui_source, mrcui_source, mrsab_source, mrx_sources
 
Fields inherited from class gov.nih.nlm.umls.io.RichMRFilesConceptInputStream
add_suffix, atom_hm, file_names, from_rsab, from_vsab, install_paths, mrcoc_source, mrconso_counter, mrconso_lines, mrconso_source, mrcxt_source, mrdef_source, mrdoc_source, mrhier_source, mrhist_source, mrmap_source, mrrel_source, mrsat_source, mrsty_source, rel_hm, this_concept, to_rsab, to_vsab, tokens
 
Constructor Summary
RichMRMetamorphoSysInputStream()
          Instantiates an empty RichMRMetamorphoSysInputStream.
 
Method Summary
 void addDataChangeListener(DataChangeListener dcl)
          Adds a DataChangeListener that will be notified every time a fireDataChanged() call is made.
 void beginInitializeCuiList()
          Informs SubsetListener that the Initialize Cui List phase is starting.
 void beginSubsetContent()
          Informs SubsetListener that the Subset Content phase is starting.
 void close()
          Close files opened during RichMRMetathesaurusInputStream.open(String[]).
 int compareTo(Object o)
          Compares this object with the specified object for order.
 void endInitializeCuiList()
          Informs SubsetListener that the Initialize Cui List phase is ending.
 void endSubsetContent()
          Informs SubsetListener that the Subset Content phase is ending.
protected  void fireDataChanged()
          Enables filters to inform listeners of data changed event.
protected  void fireNotUndoableDataChanged()
          Enables filters to indicate that data has changed without notifying the listeners or making this change undoable.
 int getChooserType()
          Indicates the type of file accepted by the JFileChooser.
 Color getColor()
          Returns the Color that should be used to display the name.
 String getConfigurationDetails()
          Returns a message for the log.
 GUIConfigurable getGUIConfigurableForValidationFailure()
          Returns the GUIConfigurable whose tab should next be displayed to allow the user to correct an error or warning.
 JPanel getHelpPanel()
          Provides a JPanel that will be displayed when the user selects the corresponding menu item from the Help menu and will provide the user with detailed instructions on the tab's use.
 String getName()
          Returns the short name for display purposes.
 JPanel getPanel()
          Returns GUI panel that will be displayed on one of the tabs on the main GUI window.
 Properties getProperties()
          Returns the current state of the input stream as a Properties object.
 String getTabDescription()
          Returns a basic description of how to configure the input stream.
 String getValidateMessage()
          Returns the message that the user will see if this GUIConfigurable is invalid.
 String[] getValidationErrors()
          Returns the messages indicating why validation failed.
 String[] getValidationWarnings()
          Returns warnings that were indicated during validation.
 boolean hasAdvancedOptions()
          Indicates whether or not an options menu item should be supplied for advanced configuration options.
 boolean hasDataChanged()
          Returns a boolean indicating whether or not the values on this gui have changed.
 boolean hasFullContextData()
          Indicates whether this input source has full context data, such as that included in a MRCXT file.
 boolean isEfficientMode()
          Returns the mode in which subsetting will be run.
 Concept readConcept()
          Returns a Concept containing data from the MR Files.
 void removeDataChangeListener(DataChangeListener dcl)
          Removes a DataChangeListener so that it will no longer be notified every time a fireDataChanged() call is made from this gui.
 void resetDataChanged()
          Resets the "has data changed" flag to indicate that no data has been changed since the last save.
 void resetToDefaults()
          Resets the state of the input stream to its default state.
 void setConfiguration(ApplicationConfiguration c)
          Sets the ApplicationConfiguration representing the default state.
 void setConfiguration(UserConfiguration user_configuration)
          Sets the UserConfiguration.
 void setCuiList(CuiList cui_list)
          Sets the CuiList reference.
 void setDataChanged(boolean b)
          Sets the "has data changed" value.
 void setEfficientMode(boolean efficient)
          Sets the subsetting mode to efficient.
 void setPanelSelections()
          Applies the input stream state to the GUI panel.
 void setProperties(Properties p)
          Sets the current state of the input stream from a Properties object.
 void showOptions()
          Presents an advanced options GUI to the user.
 boolean validate()
          Indicates whether or not the GUIConfigurable is valid.
 boolean validateSourcePath(String source_path)
          Validates the source path.
 boolean validateSourcePaths(String[] source_paths)
          Validates the source paths.
 boolean validateVersion(String source_path)
          Attempts to determine the version of the release being used and validate it against the version from the properties file.
 boolean validateVersions(String[] paths)
          For each source path it attempts to determine the version of the release being used and validate it against the version from the properties file.
 
Methods inherited from class gov.nih.nlm.umls.io.RichMRMetathesaurusInputStream
getAmbiguousStringIdentifiers, getAmbiguousStringIdentifiersAsList, getAmbiguousTermIdentifiers, getAmbiguousTermIdentifiersAsList, getIndexProgress, getLineCounts, open, readIndexEntry, readReleaseMetadata
 
Methods inherited from class gov.nih.nlm.umls.io.RichMRFilesConceptInputStream
getAtoms, getAttributes, getComponentHistories, getConceptProgress, getContexts, getCoocurrences, getDefinitions, getMappings, getRelationships, getSemanticTypes, newInstanceFromMRCONSO, newInstanceFromMRHIER, openMRFiles, openSourceFile, setAdditionalSuffix
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface gov.nih.nlm.mms.MetamorphoSysInputStream
getConceptProgress, getIndexProgress
 
Methods inherited from interface gov.nih.nlm.umls.io.MetathesaurusInputStream
getAmbiguousStringIdentifiers, getAmbiguousStringIdentifiersAsList, getAmbiguousTermIdentifiers, getAmbiguousTermIdentifiersAsList, readIndexEntry, readReleaseMetadata
 
Methods inherited from interface gov.nih.nlm.umls.io.ConceptInputStream
open
 

Field Detail

user_configuration

protected UserConfiguration user_configuration

default_config

protected ApplicationConfiguration default_config

cui_list

protected CuiList cui_list

validate_msg

protected String validate_msg
Constructor Detail

RichMRMetamorphoSysInputStream

public RichMRMetamorphoSysInputStream()
Instantiates an empty RichMRMetamorphoSysInputStream.

Method Detail

setConfiguration

public void setConfiguration(UserConfiguration user_configuration)
Sets the UserConfiguration.

Specified by:
setConfiguration in interface Configurable
Parameters:
user_configuration - the UserConfiguration.

getName

public String getName()
Returns the short name for display purposes.

Specified by:
getName in interface GUIConfigurable
Returns:
the short name for display purposes.

getConfigurationDetails

public String getConfigurationDetails()
Returns a message for the log.

Specified by:
getConfigurationDetails in interface Configurable
Returns:
a message for the log

setCuiList

public void setCuiList(CuiList cui_list)
Sets the CuiList reference.

Specified by:
setCuiList in interface SubsetListener
Parameters:
cui_list - CuiList

readConcept

public Concept readConcept()
                    throws IOException
Returns a Concept containing data from the MR Files. Different from UMLS objects implementation in that it requires that the Concept be present on the CuiList before reading the Concept's data from the MR Files.

Specified by:
readConcept in interface ConceptInputStream
Overrides:
readConcept in class RichMRFilesConceptInputStream
Returns:
a Concept containing data from the MR Files.
Throws:
IOException - if files could not be read

close

public void close()
           throws IOException
Close files opened during RichMRMetathesaurusInputStream.open(String[]).

Specified by:
close in interface ConceptInputStream
Overrides:
close in class RichMRMetathesaurusInputStream
Throws:
IOException - if files can not be closed

getPanel

public JPanel getPanel()
Returns GUI panel that will be displayed on one of the tabs on the main GUI window.

Specified by:
getPanel in interface GUIConfigurable
Returns:
JPanel that displays graphical interface for a tab

hasDataChanged

public boolean hasDataChanged()
Returns a boolean indicating whether or not the values on this gui have changed.

Specified by:
hasDataChanged in interface GUIConfigurable
Returns:
boolean true if data has changed false otherwise

setDataChanged

public void setDataChanged(boolean b)
Sets the "has data changed" value.

Specified by:
setDataChanged in interface GUIConfigurable
Parameters:
b - boolean indicating whether or not data in the GUI configuration has changed.

getProperties

public Properties getProperties()
Returns the current state of the input stream as a Properties object.

Specified by:
getProperties in interface Configurable
Returns:
Properties only those directly related to the gui

setProperties

public void setProperties(Properties p)
Sets the current state of the input stream from a Properties object.

Specified by:
setProperties in interface Configurable
Parameters:
p - Properties pertaining to the gui

resetDataChanged

public void resetDataChanged()
Resets the "has data changed" flag to indicate that no data has been changed since the last save.

Specified by:
resetDataChanged in interface GUIConfigurable

addDataChangeListener

public void addDataChangeListener(DataChangeListener dcl)
Adds a DataChangeListener that will be notified every time a fireDataChanged() call is made. Allows main GUI to record all changes to this gui in the undo/redo mechanism.

Specified by:
addDataChangeListener in interface GUIConfigurable
Parameters:
dcl - DataChangeListener

removeDataChangeListener

public void removeDataChangeListener(DataChangeListener dcl)
Removes a DataChangeListener so that it will no longer be notified every time a fireDataChanged() call is made from this gui.

Specified by:
removeDataChangeListener in interface GUIConfigurable
Parameters:
dcl - DataChangeListener

getColor

public Color getColor()
Returns the Color that should be used to display the name.

Specified by:
getColor in interface GUIConfigurable
Returns:
Color

getTabDescription

public String getTabDescription()
Returns a basic description of how to configure the input stream.

Specified by:
getTabDescription in interface GUIConfigurable
Returns:
String text of input stream instructions

resetToDefaults

public void resetToDefaults()
Resets the state of the input stream to its default state. This is not used to actually change the gui. setPanelSelections() is always called after this method and will update the gui based on the variable values.

Specified by:
resetToDefaults in interface Configurable

showOptions

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

Specified by:
showOptions in interface GUIConfigurable

hasAdvancedOptions

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

Specified by:
hasAdvancedOptions in interface GUIConfigurable
Returns:
true if so; false otherwise

getHelpPanel

public JPanel getHelpPanel()
Provides a JPanel that will be displayed when the user selects the corresponding menu item from the Help menu and will provide the user with detailed instructions on the tab's use.

Specified by:
getHelpPanel in interface GUIConfigurable
Returns:
JPanel to be added to the Help menu

setPanelSelections

public void setPanelSelections()
Applies the input stream state to the GUI panel.

Specified by:
setPanelSelections in interface GUIConfigurable

validate

public boolean validate()
Indicates whether or not the GUIConfigurable is valid.

Specified by:
validate in interface GUIConfigurable
Returns:
booleantrue if GUIConfigurable is valid false if GUIConfigurable is invalid

getValidateMessage

public String getValidateMessage()
Returns the message that the user will see if this GUIConfigurable is invalid.

Returns:
String with error message

getValidationErrors

public String[] getValidationErrors()
Returns the messages indicating why validation failed. Should only be called if validate() returns false.

Specified by:
getValidationErrors in interface GUIConfigurable
Returns:
the failure messages

getValidationWarnings

public String[] getValidationWarnings()
Returns warnings that were indicated during validation.

Specified by:
getValidationWarnings in interface GUIConfigurable
Returns:
the warning messages

getGUIConfigurableForValidationFailure

public GUIConfigurable getGUIConfigurableForValidationFailure()
Returns the GUIConfigurable whose tab should next be displayed to allow the user to correct an error or warning.

Specified by:
getGUIConfigurableForValidationFailure in interface GUIConfigurable
Returns:
GUIConfigurable to be displayed

validateSourcePaths

public boolean validateSourcePaths(String[] source_paths)
Validates the source paths. This involves checking that they both exist, are readable and that they have access to MR data.

Specified by:
validateSourcePaths in interface MetamorphoSysInputStream
Parameters:
source_paths - to be validated
Returns:
true if validation passes false otherwise

validateSourcePath

public boolean validateSourcePath(String source_path)
Validates the source path. This involves checking that it both exists, is readable and that it has access to MR data.

Specified by:
validateSourcePath in interface MetamorphoSysInputStream
Parameters:
source_path - path to be validated
Returns:
true if validation passes false otherwise

validateVersions

public boolean validateVersions(String[] paths)
For each source path it attempts to determine the version of the release being used and validate it against the version from the properties file. If the version is determined to be a mismatch of if it cannot be determined, false is returned.

Specified by:
validateVersions in interface MetamorphoSysInputStream
Parameters:
paths - to be validated
Returns:
true if validation passes false otherwise

validateVersion

public boolean validateVersion(String source_path)
Attempts to determine the version of the release being used and validate it against the version from the properties file. If the version is determined to be a mismatch of if it cannot be determined, false is returned.

Specified by:
validateVersion in interface MetamorphoSysInputStream
Parameters:
source_path - to be validated
Returns:
true if validation passes false otherwise

fireDataChanged

protected void fireDataChanged()
Enables filters to inform listeners of data changed event.


fireNotUndoableDataChanged

protected void fireNotUndoableDataChanged()
Enables filters to indicate that data has changed without notifying the listeners or making this change undoable.


getChooserType

public int getChooserType()
Indicates the type of file accepted by the JFileChooser.

Specified by:
getChooserType in interface MetamorphoSysInputStream
Returns:
String

setConfiguration

public void setConfiguration(ApplicationConfiguration c)
Sets the ApplicationConfiguration representing the default state.

Specified by:
setConfiguration in interface Configurable
Parameters:
c - ApplicationConfiguration

beginInitializeCuiList

public void beginInitializeCuiList()
Informs SubsetListener that the Initialize Cui List phase is starting.

Specified by:
beginInitializeCuiList in interface SubsetListener

endInitializeCuiList

public void endInitializeCuiList()
Informs SubsetListener that the Initialize Cui List phase is ending.

Specified by:
endInitializeCuiList in interface SubsetListener

beginSubsetContent

public void beginSubsetContent()
Informs SubsetListener that the Subset Content phase is starting.

Specified by:
beginSubsetContent in interface SubsetListener

endSubsetContent

public void endSubsetContent()
Informs SubsetListener that the Subset Content phase is ending.

Specified by:
endSubsetContent in interface SubsetListener

setEfficientMode

public void setEfficientMode(boolean efficient)
Sets the subsetting mode to efficient. In the efficient mode, the "Initialize Cuis" phase of the subsetting only references MRCONSO and MRSTY.

Specified by:
setEfficientMode in interface MetamorphoSysInputStream
Parameters:
efficient - true if subsetting should be run in efficient mode false if not

isEfficientMode

public boolean isEfficientMode()
Returns the mode in which subsetting will be run. In the efficient mode, the "Initialize Cuis" phase of the subsetting only references MRCONSO and MRSTY.

Specified by:
isEfficientMode in interface MetamorphoSysInputStream
Returns:
true if subsetting will be run in efficent mode false otherwise

hasFullContextData

public boolean hasFullContextData()
Indicates whether this input source has full context data, such as that included in a MRCXT file.

Specified by:
hasFullContextData in interface MetamorphoSysInputStream
Returns:
true if this input source has full context data; false otherwise.

compareTo

public int compareTo(Object o)
Compares this object with the specified object for order. Returns a negative integer, zero, or a positive integer as this object is less than, equal to, or greater than the specified object.

Required method for implementing Comparable interface. Indicates the means for comparison between two MetamorphoSysInputStreams.

Specified by:
compareTo in interface Comparable
Parameters:
o - the Object to be compared.
Returns:
a negative integer, zero, or a positive integer as this object is less than, equal to, or greater than the specified object.
Throws:
ClassCastException - if the specified object's type is not GUIConfigurable.


Copyright ©2005