gov.nih.nlm.mms.cxt
Class MRCXTBuilder

java.lang.Object
  extended by gov.nih.nlm.mms.AbstractGUIConfigurable
      extended by gov.nih.nlm.mms.cxt.MRCXTBuilder
All Implemented Interfaces:
Configurable, GUIConfigurable, LocalNullValueSupport, Comparable

public class MRCXTBuilder
extends AbstractGUIConfigurable
implements LocalNullValueSupport

Application for building MRCXT.RRF from MRCONSO.RRF and MRHIER.RRF

Author:
Deborah Shapiro

Field Summary
protected  boolean null_value_flag
           
protected  String regex_null_value
           
 
Fields inherited from class gov.nih.nlm.mms.AbstractGUIConfigurable
data_changed, default_configuration, listeners, user_configuration
 
Constructor Summary
MRCXTBuilder()
          Instantiates a MRCXTBuilder and builds the frame.
 
Method Summary
 void addSelectedSource(Source source)
          Indicates that the given Source will be included in the list of sources from which contexts will be built.
 void addSourceToList(Source source)
          Adds a Source to the full list.
 void buildIndexes()
          Builds indexes for MRCXT Builder processing if they do not already exist.
 void disableGlassPane()
          Disable glass pane.
 List disqualifySourcesFromList(List source_candidates)
          Returns modified List from given list of source candidates.
 void enableGlassPane()
          Enable glass pane.
 boolean getAddUnicodeBOM()
          Indicates if the UTF8 Byte Order Mark (BOM) should be prepended to the output MRCXT.RRF.
 boolean getBuildChildren()
          Indicates if context children should be written to MRCXT.RRF.
 boolean getBuildSiblings()
          Indicates if context siblings should be written to MRCXT.RRF.
 boolean getComputeXC()
          Indicates if the XC flag should be computed for MRCXT.RRF.
 MRCXTBuilderGUI getGui()
          Returns the MRCXTBuilderGUI.
 List getIncludedSources()
          Returns List of Sources that have been selected to be included in MRCXT.RRF.
 boolean getMaxContexts()
          Indicates if there is a maximum number of contexts that will be written to MRCXT.RRF for any given atom/sab.
 int getMaxContextsCount()
          Indicates the maximum number of contexts that will be written to MRCXT.RRF for any given atom/sab assuming that the corresponding checkbox is selected.
 String getNullValue()
          Returns the null value.
 JPanel getPanel()
          Returns the GUI panel that will display the user iterface.
 Properties getProperties()
          Returns the current state of the MRCXTBuilder as a Properties object.
 int getRowForSource(Source source)
          Returns the index of the row in the table for a given Source
 File getSourceDir()
          Returns the File where the MRHIER.RRF will be found and the MRCXT.RRF should be written.
 List getSourceList()
          Returns the full list of sources.
 Source[] getSourceListAsArray()
          Returns the full list of sources.
 JTable getSourceTable()
          Returns the JTable that displays the list of sources.
 boolean getVersionedSabs()
          Indicates if MRCXT.RRF should be written with versioned or versionless source abbreviations.
 boolean getWriteMRCXTFileStatistics()
          Indicates if statistics should be computed for MRCXT.RRF.
 boolean isEmptyValue(String token)
          Indicates whether or not the specified token is null or contains a null value as defined by being either zero length or a value equal to the null value.
 void makeMRCXT(ProgressMonitor progress)
          Calls the MRCXTBuilderOutputStream and instructs it to write the MRCXT.RRF file.
 void removeSelectedSource(Source source)
          Indicates that the given Source will not have contexts built from it.
 void resetToDefaults()
          Resets MRCXTBuilder state to default.
protected  String resolveNull(String line)
          Replaces all "null value" characters in the line.
 void setAddUnicodeBOM(boolean add_unicode_bom)
          Sets the parameter indicating if the UTF8 Byte Order Mark (BOM) should be prepended to the output MRCXT.RRF.
 void setBuildChildren(boolean build_children)
          Sets the parameter indicating if children should be built or not
 void setBuildSiblings(boolean build_siblings)
          Sets the parameter indicating if siblings should be built or not
 void setComputeXC(boolean compute_xc)
          Sets the parameter indicating if the XC flag should be computed for MRCXT.RRF.
 void setEnableComponents()
          Logic for control of enabling and disabling gui components.
 void setGui(MRCXTBuilderGUI gui)
          Sets the MRCXTBuilderGUI.
 void setMaxContexts(boolean max_contexts)
          Sets if there is a maximum number of contexts that will be written to MRCXT.RRF for any given atom/sab.
 void setMaxContextsCount(int max_contexts_count)
          Sets the maximum number of contexts that will be written to MRCXT.RRF for any given atom/sab assuming that the corresponding checkbox is selected .
 void setNullValue(String null_value)
          Sets the null value to use.
 void setPanelSelections()
          Applies state to panel selections.
 void setProperties(Properties p)
          Sets the current state of the MRCXTBuilder from a Properties object.
 void setSelectedSourceSet(Set source_set)
          Supplies the Set of Sources that are selected for inclusion in the built MRCXT.RRF
 void setSourceDir(File source_dir)
          Sets the File where the MRHIER.RRF will be found and the MRCXT.RRF should be written.
 void setSourceList(List sources)
          Sets the full list of Sources.
 void setSourceList(Source[] sources)
          Sets the source list to the given Source[]
 void setVersionedSabs(boolean versioned_sabs)
          Sets the parameter indicating if MRCXT.RRF should be written with versioned or versionless source abbreviations.
 void setWriteMRCXTFileStatistics(boolean write_mrcxt_file_statistics)
          Sets the parameter indicating if statistics should be computed for MRCXT.RRF.
 void subsetDirectoryOpened(File source_dir)
          Handles opening of a source directory.
 
Methods inherited from class gov.nih.nlm.mms.AbstractGUIConfigurable
addDataChangeListener, addValidationError, addValidationWarning, clearValidationErrors, clearValidationWarnings, compareTo, fireDataChanged, getColor, getConfigurationDetails, getGUIConfigurableForValidationFailure, getHelpPanel, getName, getTabDescription, getValidationErrors, getValidationWarnings, hasAdvancedOptions, hasDataChanged, removeDataChangeListener, resetDataChanged, setConfiguration, setConfiguration, setDataChanged, showOptions, validate
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

regex_null_value

protected String regex_null_value

null_value_flag

protected boolean null_value_flag
Constructor Detail

MRCXTBuilder

public MRCXTBuilder()
Instantiates a MRCXTBuilder and builds the frame.

Method Detail

getPanel

public JPanel getPanel()
Returns the GUI panel that will display the user iterface.

Specified by:
getPanel in interface GUIConfigurable
Overrides:
getPanel in class AbstractGUIConfigurable
Returns:
JPanel that displays graphical interface for the application.

subsetDirectoryOpened

public void subsetDirectoryOpened(File source_dir)
Handles opening of a source directory. Should be called from a separate thread.

Parameters:
source_dir - the source directory

disqualifySourcesFromList

public List disqualifySourcesFromList(List source_candidates)
Returns modified List from given list of source candidates. Sources are removed if their concept count = 0 or they are without contexts or they are not in the current subset

Parameters:
source_candidates -
Returns:
qualified subset

getSourceList

public List getSourceList()
Returns the full list of sources.

Returns:
List of sources

getSourceListAsArray

public Source[] getSourceListAsArray()
Returns the full list of sources.

Returns:
Source[] of sources

getSourceTable

public JTable getSourceTable()
Returns the JTable that displays the list of sources.

Returns:
JTable

getRowForSource

public int getRowForSource(Source source)
Returns the index of the row in the table for a given Source

Parameters:
source - Source
Returns:
int

setSourceList

public void setSourceList(Source[] sources)
Sets the source list to the given Source[]

Parameters:
sources - array

addSourceToList

public void addSourceToList(Source source)
Adds a Source to the full list.

Parameters:
source - Source

setSourceList

public void setSourceList(List sources)
Sets the full list of Sources.

Parameters:
sources - List

addSelectedSource

public void addSelectedSource(Source source)
Indicates that the given Source will be included in the list of sources from which contexts will be built.

Parameters:
source - Source to be included in context building

removeSelectedSource

public void removeSelectedSource(Source source)
Indicates that the given Source will not have contexts built from it.

Parameters:
source - Source to be excluded from context building

setSelectedSourceSet

public void setSelectedSourceSet(Set source_set)
Supplies the Set of Sources that are selected for inclusion in the built MRCXT.RRF

Parameters:
source_set -

buildIndexes

public void buildIndexes()
Builds indexes for MRCXT Builder processing if they do not already exist.


getBuildSiblings

public boolean getBuildSiblings()
Indicates if context siblings should be written to MRCXT.RRF.

Returns:
true if siblings should be built false otherwise

setBuildSiblings

public void setBuildSiblings(boolean build_siblings)
Sets the parameter indicating if siblings should be built or not

Parameters:
build_siblings -

getBuildChildren

public boolean getBuildChildren()
Indicates if context children should be written to MRCXT.RRF.

Returns:
true if children should be built false otherwise

setBuildChildren

public void setBuildChildren(boolean build_children)
Sets the parameter indicating if children should be built or not

Parameters:
build_children -

getComputeXC

public boolean getComputeXC()
Indicates if the XC flag should be computed for MRCXT.RRF.

Returns:
true if yes false otherwise

setComputeXC

public void setComputeXC(boolean compute_xc)
Sets the parameter indicating if the XC flag should be computed for MRCXT.RRF.

Parameters:
compute_xc -

getMaxContextsCount

public int getMaxContextsCount()
Indicates the maximum number of contexts that will be written to MRCXT.RRF for any given atom/sab assuming that the corresponding checkbox is selected.

Returns:
int maximum contexts

getMaxContexts

public boolean getMaxContexts()
Indicates if there is a maximum number of contexts that will be written to MRCXT.RRF for any given atom/sab.

Returns:
boolean true if limited false false otherwise

setMaxContextsCount

public void setMaxContextsCount(int max_contexts_count)
Sets the maximum number of contexts that will be written to MRCXT.RRF for any given atom/sab assuming that the corresponding checkbox is selected .

Parameters:
max_contexts_count -

setMaxContexts

public void setMaxContexts(boolean max_contexts)
Sets if there is a maximum number of contexts that will be written to MRCXT.RRF for any given atom/sab.

Parameters:
max_contexts - true if limited false false otherwise

setNullValue

public void setNullValue(String null_value)
Sets the null value to use. This is needed if release.dat specifies some non-standard null value char sequence.

Specified by:
setNullValue in interface LocalNullValueSupport
Parameters:
null_value - the new null string value

getNullValue

public String getNullValue()
Returns the null value. This is needed if release.dat specifies some non-standard null value char sequence.

Specified by:
getNullValue in interface LocalNullValueSupport
Returns:
the string value for "null"

isEmptyValue

public boolean isEmptyValue(String token)
Indicates whether or not the specified token is null or contains a null value as defined by being either zero length or a value equal to the null value.

Specified by:
isEmptyValue in interface LocalNullValueSupport

resolveNull

protected String resolveNull(String line)
Replaces all "null value" characters in the line.

Parameters:
line - input line
Returns:
output line

setAddUnicodeBOM

public void setAddUnicodeBOM(boolean add_unicode_bom)
Sets the parameter indicating if the UTF8 Byte Order Mark (BOM) should be prepended to the output MRCXT.RRF.

Parameters:
add_unicode_bom -

getAddUnicodeBOM

public boolean getAddUnicodeBOM()
Indicates if the UTF8 Byte Order Mark (BOM) should be prepended to the output MRCXT.RRF.

Returns:
true if BOM is required false if not

setWriteMRCXTFileStatistics

public void setWriteMRCXTFileStatistics(boolean write_mrcxt_file_statistics)
Sets the parameter indicating if statistics should be computed for MRCXT.RRF.

Parameters:
write_mrcxt_file_statistics -

getWriteMRCXTFileStatistics

public boolean getWriteMRCXTFileStatistics()
Indicates if statistics should be computed for MRCXT.RRF.

Returns:
true if statistics should be computed false if not

setVersionedSabs

public void setVersionedSabs(boolean versioned_sabs)
Sets the parameter indicating if MRCXT.RRF should be written with versioned or versionless source abbreviations.

Parameters:
versioned_sabs -

getVersionedSabs

public boolean getVersionedSabs()
Indicates if MRCXT.RRF should be written with versioned or versionless source abbreviations.

Returns:
true if versioned false if versionless

getSourceDir

public File getSourceDir()
Returns the File where the MRHIER.RRF will be found and the MRCXT.RRF should be written.

Returns:
File directory

setSourceDir

public void setSourceDir(File source_dir)
                  throws IOException
Sets the File where the MRHIER.RRF will be found and the MRCXT.RRF should be written.

Parameters:
source_dir - File directory
Throws:
IOException

getIncludedSources

public List getIncludedSources()
Returns List of Sources that have been selected to be included in MRCXT.RRF.

Returns:
List of included Sources

makeMRCXT

public void makeMRCXT(ProgressMonitor progress)
Calls the MRCXTBuilderOutputStream and instructs it to write the MRCXT.RRF file.

Parameters:
progress -

setGui

public void setGui(MRCXTBuilderGUI gui)
Sets the MRCXTBuilderGUI.

Parameters:
gui -

getGui

public MRCXTBuilderGUI getGui()
Returns the MRCXTBuilderGUI.

Returns:
gui

setEnableComponents

public void setEnableComponents()
Logic for control of enabling and disabling gui components.


resetToDefaults

public void resetToDefaults()
Resets MRCXTBuilder state to default.

Specified by:
resetToDefaults in interface Configurable
Overrides:
resetToDefaults in class AbstractGUIConfigurable

setPanelSelections

public void setPanelSelections()
Applies state to panel selections.

Specified by:
setPanelSelections in interface GUIConfigurable
Overrides:
setPanelSelections in class AbstractGUIConfigurable

getProperties

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

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

setProperties

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

Specified by:
setProperties in interface Configurable
Overrides:
setProperties in class AbstractGUIConfigurable
Parameters:
p - Properties only those directly related to the gui

enableGlassPane

public void enableGlassPane()
Enable glass pane.


disableGlassPane

public void disableGlassPane()
Disable glass pane.



Copyright ©2005