|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectgov.nih.nlm.nls.utils.GlobalBehavior
GlobalBehavior governs what options are set, what configuration settings used when analizing the text. Options are configurable settings. This package allows for the creation, use, and maitenance of options. Options can be set from configuration files and/or from the command line. The presidence is the last configuration file setting run overides prior settings. The non-configuration file calling command line settings get applied last and overide everything else. Configuration settings have a short form (one or two characters), and a long form for clarity. Short forms are referred to with a single dash, and long forms are referred to with a double dash. Configuration settings can be
boolean
Integer
string
The configuration files contents are similar to properties files. They have the syntax attribute=value on each line, where each attribute is either a long or a short name, referenced with the dash or double dash. This gives some continuity between what is put on the commandline and what can be found in a configuration file.
All possible Configuration settings are to be registered in a registry file. Registry files have a different syntax and contain additional information than configuration files.
The registry file, contains the following fields:
shortName|longName |type |Default value |Description ---------+------------+------+----------------------------------+------------- -X |--configFile|string|/export/nls/mmtx/config/ |Bla bla blaWe have also added an extensible number of fields to the end of the above line to accommodate specifying what options specifically go to which user/program component of MMTX. Fields added so far include:
optForMetaMap - MetaMap specific options - boolean
optForMMTX - MMTX specific options - boolean
Configuration/registry files are either read from the $MMTX/config directory, (having
the $MMTX/config directory in the CLASSPATH in unix or in the PATH environment
variable on the NT.
The get methods all take ONLY the long names. The modivation behind this is that the long names provide maintainers (beyond the original authors) a clearer indication of what is being asked for. Operationally, the hash function is a constant operation and no more expensive than getting the hash of the shorter name less illustritive name.
Examples:
--configName=[path]ConfigFile -X=[path]ConfigFileExamples of how one would use options in an application:
String version = (StringOption) o.get("Version");
boolean bestMappings = o.getBoolean("bestMappingsOnly");
Description: java source file.
History
Fri Jun 02 17:46:45 EDT 2000, divita Initial Version
Notes:
| Constructor Summary | |
GlobalBehavior(java.lang.String pApplication,
java.lang.String registryFile)
The constructor for GlobalBehavior instantiates configurable settings that other packages can take advantage of. |
|
GlobalBehavior(java.lang.String pApplication,
java.lang.String registryFile,
java.lang.String configFile)
The constructor for GlobalBehavior instantiates configurable settings that other packages can take advantage of. |
|
GlobalBehavior(java.lang.String pApplication,
java.lang.String registryFile,
java.lang.String[] args)
The constructor for GlobalBehavior instantiates configurable settings that other packages can take advantage of. |
|
GlobalBehavior(java.lang.String pApplication,
java.lang.String registryFile,
java.lang.String configFile,
java.lang.String[] args)
The constructor for GlobalBehavior instantiates configurable settings that other packages can take advantage of. |
|
| Method Summary | |
void |
checkConflictingOptions()
Method checkConflictingOptions makes sure that conflicting options are mediated. |
void |
close()
Method close closes the output DataOutputStream. |
boolean |
detectAmbiguousAbbreviation()
Method detectAmbiguousAbbreviation returns true if the global behavior is to detect and not break sentences on ambiguous abbreviations. |
boolean |
display(java.lang.String x)
Method display(x) returns whether or not the -x flag has been set to display x. |
boolean |
displayLexicalElements()
Method displayLexicalElements returns true if --lexicalElements has been specified. |
java.util.Vector |
displayOptions(boolean allOptions,
boolean withDescriptions)
Method displayOptions returns a Vector of strings containing the options that have been set, and optionally, the descriptions of each of these options. |
boolean |
displayPipedOutput()
Method displayPipedOutput returns whether or not the -pipedOutput flag has been set to display pipe delimited fields. |
boolean |
displaySentences()
Method displaySentences returns whether or not the -sentence flag has been set to display sentences. |
boolean |
displaysettings()
Method displaySettings returns whether or not the --displaySettings flag has been set to display Options. |
boolean |
displayTokens()
Method displayTokens returns whether or not the -tokens flag has been set to display tokens. |
java.util.Vector |
echoSetOptions()
Method echoSetOptions returns a Vector of strings containing the options that are currently set to true (for boolean) and options that have been specifically set. |
void |
flush()
Method flush flushes the output DataOutputStream. |
Option |
get(java.lang.String longOptionName)
get retrieves an option given the object's long option name. |
java.lang.String |
getAmbigAbbreviationsFile()
getAmbigAbbreviationsFile returns the full path to the properties file that contains a short list of ambiguous abbreviations. |
java.lang.String |
getApplicationName()
Method getApplicationName retrieves the applicationName (if set) |
boolean |
getBoolean(java.lang.String longOptionName)
Method getBoolean returns the value from a known boolean option |
java.lang.ClassLoader |
getClassLoader()
Method getClassLoader retrieves the current class loader |
java.lang.String |
getDataModel()
Method getDataModel calculates what the data model is based on whether the --strict_model, --moderate_model, --relaxed_model has been set. |
java.lang.String |
getDataSet()
Method getDataSet returns a String with the either the default Knowledge Source database name or user specified (-V option) database name. |
java.lang.String |
getDefaultDataSet()
Method getDefaultDataSet returns a String with the either the default Knowledge Source database name or user specified (-V option) database name. |
java.lang.String |
getFileName()
Method getFileName returns the name of the file that is being processed. |
static java.lang.String |
getFullFile(java.lang.String fileName)
Method getFullFile retrieves the full path of the file, given no path. |
int |
getInt(java.lang.String longOptionName)
Method getInt returns the value from a known int option |
java.lang.String |
getInternalDBName(java.lang.String which)
Method getInternalDBName returns a String with the internal nomenclature for the specified DB. |
java.lang.String |
getKSYear()
Method getKSYear returns a String with the either the default Knowledge Source 2-digit year or user specified KS year. |
java.io.PrintWriter |
getOutputPrintWriter()
Method getOutputPrintWriter By default this is standard out, but is the file pointed to by --outputFile= if this is specified. |
double |
getReal(java.lang.String longOptionName)
Method getReal returns the value from a known real option |
java.lang.String |
getRunYear()
Method getRunYear returns a String with the either the default Knowledge Source year or user specified KS year. |
java.lang.String |
getString(java.lang.String longOptionName)
Method getString returns the value from a known string option |
int |
getThreshold()
Method getThreshold returns an int with the value of threshold |
int |
getTruncNumber()
Method getTruncNumber returns an int with the value of the truncate_candidates_number. |
java.lang.String |
getUsage(java.lang.String fileName)
getUsage returns a string with the usage in it. |
boolean |
isOptionSet(java.lang.String longOptionName)
Method isOptionSet returns whether the option is set or not |
static boolean |
isShortName(java.lang.String optionName)
isShortName method indicates whether the name is a long name (argument preceeded by "--") or a shortName (argument preceeded by a "-") |
static void |
main(java.lang.String[] args)
This is a test main, whose purpose is to test the functionality of each method developed for this class. |
void |
print(java.lang.String x)
Method print prints the string out to a DataOutputStream. |
void |
println()
Method println prints a NL out to a DataOutputStream, By default this is standard out, but is the file pointed to by --outputFile= if this is specified. |
void |
println(java.lang.String x)
Method println prints the string out to a DataOutputStream, (with a newLine appended). |
void |
pull(java.lang.String longOptionName,
java.lang.String shortOptionName)
Method pull removes this option from the set of options |
void |
readCommandLineOptions(java.lang.String[] args)
Method readCommandLineOptions sets options to what was given via command line options. |
void |
readConfigFile(java.lang.String fileName)
Method readConfigFile sets options for an application. |
void |
set(Option option)
Method set adds this option to the set of options |
void |
set(java.lang.String pCommandLineOption)
Method set adds this option to the set of options |
void |
set(java.lang.String longOptionName,
Option option)
Method set adds this option to the set of options |
void |
setApplicationName(java.lang.String pApplicationName)
Method setApplicationName sets what application has been called |
void |
setBoolean(java.lang.String longOptionName,
boolean pValue)
Method setBoolean sets the boolean option to the value specified. |
void |
setOutputFile(java.io.OutputStream pStream)
Method setOutputFile By default this is standard out, but is the file pointed to by --outputFile= if this is specified. |
void |
setOutputFile(java.io.PrintWriter pStream)
Method setOutputFile By default this is standard out, but is the file pointed to by --outputFile= if this is specified. |
void |
setOutputFile(java.lang.String pFileName)
Method setOutputFile By default this is standard out, but is the file pointed to by --outputFile= if this is specified. |
void |
setPOptionOn()
Method setPOptionOn Sets all of the values to TRUE for the Composite_Phrase option. |
void |
setQOptionOn()
Method setQOptionOn Sets all of the values to TRUE for the Quick_Composite_Phrase option. |
void |
setQuickBrowseModeOn()
Method setQuickBrowseModeOn Sets all of the values to TRUE for the --quick_browse_mode option. |
void |
setUnicodeOutput(boolean pValue)
Method setUnicodeOutput enables the outputfile to print out unicode streams |
java.lang.String |
showProperties()
showProperties returns all the configuration settings |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
public GlobalBehavior(java.lang.String pApplication,
java.lang.String registryFile,
java.lang.String configFile,
java.lang.String[] args)
pApplication - [NULL|MmtX|Tokenize|Parse|Tag|lexicalLookUp|VariantGeneration ...]registryFile - The name of a Registry configuration file (contains all ops)configFile - The name of a configuration file to read values
from.args - an array of strings that come from the command line
public GlobalBehavior(java.lang.String pApplication,
java.lang.String registryFile,
java.lang.String[] args)
pApplication - [NULL|MmtX|Tokenize|Parse|Tag|lexicalLookUp|VariantGeneration ...]registryFile - The name of a Registry configuration file (contains all ops)args - an array of strings that come from the command line
public GlobalBehavior(java.lang.String pApplication,
java.lang.String registryFile,
java.lang.String configFile)
pApplication - [NULL|MmtX|Tokenize|Parse|Tag|lexicalLookUp|VariantGeneration ...]registryFile - The name of a Registry configuration file (contains all ops)configFile - The name of a configuration file to read values
from.
public GlobalBehavior(java.lang.String pApplication,
java.lang.String registryFile)
pApplication - [NULL|MmtX|Tokenize|Parse|Tag|lexicalLookUp|VariantGeneration ...]registryFile - The name of a Registry configuration file (contains all ops)| Method Detail |
public Option get(java.lang.String longOptionName)
longOptionName -
public boolean getBoolean(java.lang.String longOptionName)
longOptionName -
public void setBoolean(java.lang.String longOptionName,
boolean pValue)
longOptionName - pValue - public java.lang.String getString(java.lang.String longOptionName)
longOptionName -
public int getInt(java.lang.String longOptionName)
longOptionName -
public double getReal(java.lang.String longOptionName)
longOptionName -
public boolean isOptionSet(java.lang.String longOptionName)
longOptionName -
public java.lang.String getRunYear()
public java.lang.String getDataSet()
public java.lang.String getDefaultDataSet()
public java.lang.String getInternalDBName(java.lang.String which)
public java.lang.String getKSYear()
public int getThreshold()
public int getTruncNumber()
public void pull(java.lang.String longOptionName,
java.lang.String shortOptionName)
longOptionName - shortOptionName -
public void set(java.lang.String longOptionName,
Option option)
longOptionName - option - public void set(Option option)
option - public void set(java.lang.String pCommandLineOption)
pCommandLineOption - public void setPOptionOn()
public void setQuickBrowseModeOn()
public void setQOptionOn()
public void checkConflictingOptions()
public void readConfigFile(java.lang.String fileName)
throws java.lang.RuntimeException
fileName - application config file. This will either be
the full path or no path, assuming it's in the
application config directory, that has been
added to the CLASSPATH or equivalant.
java.lang.RuntimeException
public java.util.Vector displayOptions(boolean allOptions,
boolean withDescriptions)
allOptions - if you want to see all options rather than
just those options that were set to something
other than the default value.withDescriptions - Add descriptions to the output
public java.util.Vector echoSetOptions()
public java.lang.String getAmbigAbbreviationsFile()
public boolean displaysettings()
public java.lang.String getUsage(java.lang.String fileName)
fileName - Name of the Usage file.
public java.lang.String getFileName()
public java.lang.String showProperties()
public boolean displaySentences()
public boolean displayTokens()
public boolean displayPipedOutput()
public boolean display(java.lang.String x)
x -
public boolean detectAmbiguousAbbreviation()
public boolean displayLexicalElements()
public static boolean isShortName(java.lang.String optionName)
optionName -
public static java.lang.String getFullFile(java.lang.String fileName)
fileName -
public void setOutputFile(java.io.PrintWriter pStream)
pStream - public void setOutputFile(java.io.OutputStream pStream)
pStream -
public void setOutputFile(java.lang.String pFileName)
throws java.lang.Exception
pFileName -
java.lang.Exception
public java.io.PrintWriter getOutputPrintWriter()
throws java.lang.Exception
java.lang.Exceptionpublic void setUnicodeOutput(boolean pValue)
pValue - True turns on , false turns this offpublic void print(java.lang.String x)
x - public void println(java.lang.String x)
x - public void println()
public void close()
public void flush()
public void setApplicationName(java.lang.String pApplicationName)
pApplicationName - public java.lang.String getApplicationName()
public java.lang.ClassLoader getClassLoader()
throws java.lang.Exception
java.lang.Exceptionpublic java.lang.String getDataModel()
public void readCommandLineOptions(java.lang.String[] args)
args - arguments from the command linepublic static final void main(java.lang.String[] args)
args - The command line input, tokenized
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||