edu.cmu.sphinx.tools.gui.util
Class ConfigurableComponent

java.lang.Object
  extended by edu.cmu.sphinx.tools.gui.util.ConfigurableComponent

public class ConfigurableComponent
extends java.lang.Object

This class holds information about one configurable class in the Sphinx model Which includes the classname, property list, class description,group name, and the configuration sets that are defined for this class

This class, combined with ConfigurableProperty construct the Sphinx model.

RawPropertyData is used to hold the configuration values set for this component

Author:
Ariani
See Also:
ConfigurableProperty, RawPropertyData

Constructor Summary
ConfigurableComponent(java.lang.String section, java.lang.Class component, java.lang.String name, java.lang.String desc)
          Creates a new instance of ConfigurableComponent
 
Method Summary
 void addConfigurationProp(RawPropertyData rpd)
          This function is used to attach a configuration set for this component
 void addProperty(ConfigurableProperty cp)
          Add a new property for this component
 void changeConfigurationPropValue(java.lang.String rpdname, java.lang.String propname, java.util.List newvalue)
          Change the value of a specific property inside one of the configuration sets
 void changeConfigurationPropValue(java.lang.String rpdname, java.lang.String propname, java.lang.String newvalue)
          Change the value of a specific property inside one of the configuration sets
 boolean containsConfigurationSet(java.lang.String name)
          check if this component has a RawPropertyData configuration set with specified name
 boolean containsProperty(java.lang.String name)
          Check if component has the property
 void createNewSet(java.lang.String setname)
          This function is used to create a new configuration set for this type of class The property values are set as their default values
 void deleteAllConfigurationProp()
          Delete all configuration sets from this component
 void deleteConfigurationProp(java.lang.String rpdname)
          Delete the configuration set with specified name
 void deleteOneConfigurationPropFromSet(java.lang.String rpdname, java.lang.String propname)
          Remove a specific property from one of the configuration sets
 java.lang.Class getComponentClass()
           
 java.util.Map getConfigurationPropMap()
           
 java.lang.Object getConfigurationPropValue(java.lang.String rpdName, java.lang.String propname)
          Get current value of the configuration
 java.lang.String getDesc()
           
 java.lang.String getName()
           
 ConfigurableProperty getProperty(java.lang.String name)
          get the property with specified name
 java.util.Map getPropertyMap()
           
 java.lang.String getSectionName()
           
 java.lang.String toString()
          used to list the information contained in this component mainly for debugging and testing
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ConfigurableComponent

public ConfigurableComponent(java.lang.String section,
                             java.lang.Class component,
                             java.lang.String name,
                             java.lang.String desc)
Creates a new instance of ConfigurableComponent

Parameters:
section - the group that this class belongs to
component - reference to the class that this object represents
name - class name
desc - brief description of this configurable component
Method Detail

toString

public java.lang.String toString()
used to list the information contained in this component mainly for debugging and testing

Overrides:
toString in class java.lang.Object
Returns:
string description of model

getSectionName

public java.lang.String getSectionName()
Returns:
Returns group / section name that this component belongs to

getPropertyMap

public java.util.Map getPropertyMap()
Returns:
Returns the Map that holds the component properties (pair of String, ConfigurableProperty)

addProperty

public void addProperty(ConfigurableProperty cp)
Add a new property for this component

Parameters:
cp - ConfigurableProperty

containsProperty

public boolean containsProperty(java.lang.String name)
Check if component has the property

Parameters:
name - Name of property
Returns:
Boolean true if property exists

getProperty

public ConfigurableProperty getProperty(java.lang.String name)
get the property with specified name

Parameters:
name - Name of property
Returns:
ConfigurableProperty with the specified name; returns null if the property does not exist

getComponentClass

public java.lang.Class getComponentClass()
Returns:
the Class that this component refers to

getName

public java.lang.String getName()
Returns:
class name of component

getDesc

public java.lang.String getDesc()
Returns:
class description

addConfigurationProp

public void addConfigurationProp(RawPropertyData rpd)
This function is used to attach a configuration set for this component

Parameters:
rpd - RawPropertyData that holds the property values

deleteAllConfigurationProp

public void deleteAllConfigurationProp()
Delete all configuration sets from this component


deleteConfigurationProp

public void deleteConfigurationProp(java.lang.String rpdname)
Delete the configuration set with specified name

Parameters:
rpdname - name of RawPropertyData to be deleted

deleteOneConfigurationPropFromSet

public void deleteOneConfigurationPropFromSet(java.lang.String rpdname,
                                              java.lang.String propname)
Remove a specific property from one of the configuration sets

Parameters:
rpdname - Name of RawPropertyData that stores the property values
propname - Property name to be modified

changeConfigurationPropValue

public void changeConfigurationPropValue(java.lang.String rpdname,
                                         java.lang.String propname,
                                         java.lang.String newvalue)
Change the value of a specific property inside one of the configuration sets

Parameters:
rpdname - Name of RawPropertyData that stores the property values
propname - Property name to be modified
newvalue - New value of the property

changeConfigurationPropValue

public void changeConfigurationPropValue(java.lang.String rpdname,
                                         java.lang.String propname,
                                         java.util.List newvalue)
Change the value of a specific property inside one of the configuration sets

Parameters:
rpdname - Name of RawPropertyData that stores the property values
propname - Property name to be modified
newvalue - List of new values of the property

getConfigurationPropValue

public java.lang.Object getConfigurationPropValue(java.lang.String rpdName,
                                                  java.lang.String propname)
Get current value of the configuration

Parameters:
rpdName - Name of RawPropertyData that holds the configuration values
propname - Property name
Returns:
Either a String or List that contains value of the property

getConfigurationPropMap

public java.util.Map getConfigurationPropMap()
Returns:
Map of RawPropertyData that has all the configuration sets of this component. Each entry consists of String setname, RawPropertyData setproperties

containsConfigurationSet

public boolean containsConfigurationSet(java.lang.String name)
check if this component has a RawPropertyData configuration set with specified name

Returns:
true if the configuration with specified name exists

createNewSet

public void createNewSet(java.lang.String setname)
This function is used to create a new configuration set for this type of class The property values are set as their default values

Parameters:
setname - Name of new configuration set