|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectedu.cmu.sphinx.util.SphinxProperties
Manages configuration data for sphinx. Configuration data in Sphinx is managed via property files. Objects that need configuration data should get the SphinxProperties object for their context and extract properties. Property names have the form: objectName.propertyName There is a hierarchy of Configuration data. When a getProperty method is called on a SphinxProperties object, the System properties are checked first to see if there is a property with the given name, if so, the system property is used, otherwise the properties associated with the URL are checked and if found that is used, otherwise the default value for the property is used.
Field Summary | |
static java.lang.String |
PROP_WARN_NO_PROPERTY
SphinxProperty specifying whether a warning message should be printed out if a queried property is not defined. |
static boolean |
PROP_WARN_NO_PROPERTY_DEFAULT
The default value of PROP_WARN_NO_PROPERTY. |
Method Summary | |
boolean |
contains(java.lang.String propertyName)
Returns true if this SphinxProperties contains the given property. |
boolean |
getBoolean(java.lang.String propertyName,
boolean defaultValue)
Searches for the property with the specified name. |
boolean |
getBoolean(java.lang.String instanceName,
java.lang.String propertyName,
boolean defaultValue)
Searches for the property with the specified name of a particular instance. |
java.lang.String |
getContext()
Retrieves the context name for this SphinxProperties |
double |
getDouble(java.lang.String propertyName,
double defaultValue)
Searches for the property with the specified name. |
double |
getDouble(java.lang.String instanceName,
java.lang.String propertyName,
double defaultValue)
Searches for the property with the specified name of a particular instance. |
float |
getFloat(java.lang.String propertyName,
float defaultValue)
Searches for the property with the specified name. |
float |
getFloat(java.lang.String instanceName,
java.lang.String propertyName,
float defaultValue)
Searches for the property with the specified name of a particular instance. |
int |
getInt(java.lang.String propertyName,
int defaultValue)
Searches for the property with the specified name. |
int |
getInt(java.lang.String instanceName,
java.lang.String propertyName,
int defaultValue)
Searches for the property with the specified name of a particular instance. |
java.util.Properties |
getProperties()
Returns a new Property object that contains all the properties of this SphinxProperties. |
static SphinxProperties |
getSphinxProperties(java.lang.String context)
Retrieves the SphinxProperties for the particular context. |
java.lang.String |
getString(java.lang.String propertyName,
java.lang.String defaultValue)
Searches for the property with the specified name. |
java.lang.String |
getString(java.lang.String instanceName,
java.lang.String propertyName,
java.lang.String defaultValue)
Searches for the property with the specified name of a particular instance. |
static void |
initContext(java.lang.String context,
java.util.Properties properties)
Initialize a new SphinxProperty with the given Properties object and context. |
static void |
initContext(java.lang.String context,
java.net.URL url)
Initialize a particular context. |
void |
list(java.io.PrintStream out)
Prints this property list out to the specified output stream |
void |
listUnused(java.io.PrintStream out)
Prints the list of unused properties to the specified stream. |
void |
setProperty(java.lang.String name,
java.lang.String value)
Sets a sphinx property. |
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final java.lang.String PROP_WARN_NO_PROPERTY
public static final boolean PROP_WARN_NO_PROPERTY_DEFAULT
Method Detail |
public static void initContext(java.lang.String context, java.net.URL url) throws java.io.IOException
context
- the name of the contexturl
- the location of the property sheet, or null if there
is no property sheet.
java.io.IOException
- if the property list cannot be loaded from
the given urlpublic static void initContext(java.lang.String context, java.util.Properties properties)
context
- the name of the contextproperties
- the Properties object where our Properties residepublic static SphinxProperties getSphinxProperties(java.lang.String context)
context
- the context of interest
public java.lang.String getContext()
public void list(java.io.PrintStream out)
out
- an output stream.public void setProperty(java.lang.String name, java.lang.String value)
name
- the name of the propertyvalue
- the new value for the propertypublic void listUnused(java.io.PrintStream out)
out
- an output stream.public java.util.Properties getProperties()
public boolean contains(java.lang.String propertyName)
public java.lang.String getString(java.lang.String propertyName, java.lang.String defaultValue)
propertyName
- the name of the property to search fordefaultValue
- the value to return if the property is not
found
public java.lang.String getString(java.lang.String instanceName, java.lang.String propertyName, java.lang.String defaultValue)
instanceName
- the name of the particular instancepropertyName
- the name of the property to search fordefaultValue
- the value to return if the property is not
found
public float getFloat(java.lang.String propertyName, float defaultValue) throws java.lang.NumberFormatException
propertyName
- the name of the property to search fordefaultValue
- the value to return if the property is not
found
java.lang.NumberFormatException
- if the property cannot be
converted to the number formatpublic float getFloat(java.lang.String instanceName, java.lang.String propertyName, float defaultValue) throws java.lang.NumberFormatException
instanceName
- the name of the particular instancepropertyName
- the name of the property to search fordefaultValue
- the value to return if the property is not
found
java.lang.NumberFormatException
- if the property cannot be
converted to the number formatpublic double getDouble(java.lang.String propertyName, double defaultValue) throws java.lang.NumberFormatException
propertyName
- the name of the property to search fordefaultValue
- the value to return if the property is not
found
java.lang.NumberFormatException
- if the property cannot be
converted to the number formatpublic double getDouble(java.lang.String instanceName, java.lang.String propertyName, double defaultValue) throws java.lang.NumberFormatException
instanceName
- the name of the particular instancepropertyName
- the name of the property to search fordefaultValue
- the value to return if the property is not
found
java.lang.NumberFormatException
- if the property cannot be
converted to the number formatpublic int getInt(java.lang.String propertyName, int defaultValue) throws java.lang.NumberFormatException
propertyName
- the name of the property to search fordefaultValue
- the value to return if the property is not
found
java.lang.NumberFormatException
- if the property cannot be
converted to the number formatpublic int getInt(java.lang.String instanceName, java.lang.String propertyName, int defaultValue) throws java.lang.NumberFormatException
instanceName
- the name of the particular instancepropertyName
- the name of the property to search fordefaultValue
- the value to return if the property is not
found
java.lang.NumberFormatException
- if the property cannot be
converted to the number formatpublic boolean getBoolean(java.lang.String propertyName, boolean defaultValue)
propertyName
- the name of the property to search fordefaultValue
- the value to return if the property is not
found
public boolean getBoolean(java.lang.String instanceName, java.lang.String propertyName, boolean defaultValue)
instanceName
- the name of the particular instancepropertyName
- the name of the property to search fordefaultValue
- the value to return if the property is not
found
java.lang.NumberFormatException
- if the property cannot be
converted to the number format
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |