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

java.lang.Object
  extended by edu.cmu.sphinx.tools.gui.util.ModelBuilder
All Implemented Interfaces:
GUIFileActionListener

public class ModelBuilder
extends java.lang.Object
implements GUIFileActionListener

This class builds a model of the sphinx configurable system it will create ConfigurableComponent and ConfigurableProperty instances as the main components of the model.

Also holds configuration values and current state of the model

Author:
Ariani

Method Summary
 boolean checkDuplicateConfigurationSet(java.lang.String name)
          Check if there is already a configuration set with this name in the whole model
 void clearAll()
          This method is inherited from GUIFileActionListener Delete all configurable property values that are stored in the Model
 java.util.Iterator getClasses()
           
 java.util.Iterator getClassGroup(java.lang.String groupname)
           
 java.util.Map getclasslist(java.lang.String classtype)
          get list of Configurable classes that is of specified type
 java.util.Iterator getGroups()
           
static ModelBuilder getInstance()
          Obtain a reference to the ModelBuilder instance.
 java.lang.String getSourceCode(java.lang.String classname)
          This method would return the source code for the specified class name
 void modelRefresh()
          This method is inherited from GUIFileActionListener Reload model
 void printModel()
          This function is used to trace the whole Sphinx model and print out all the Component and Property information, including its configuration values
 void refresh()
          Refresh the Sphinx model
 void saveData(ConfigProperties cp)
          This method is inherited from GUIFileActionListener Currently the saved data all come only from ModelBuilder
 void update(ConfigProperties cp)
          This method is inherited from GUIFileActionListener update the model by reloading the configuration values
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getInstance

public static ModelBuilder getInstance()
Obtain a reference to the ModelBuilder instance. There is only one ModelBuilder instance created for the whole system.

Returns:
ModelBuilder singleton object

getClasses

public java.util.Iterator getClasses()
Returns:
Iterator for all the classes in the model

getGroups

public java.util.Iterator getGroups()
Returns:
main groups of the model

checkDuplicateConfigurationSet

public boolean checkDuplicateConfigurationSet(java.lang.String name)
Check if there is already a configuration set with this name in the whole model

Parameters:
name -
Returns:
true if configuration with specified name exists

clearAll

public void clearAll()
This method is inherited from GUIFileActionListener Delete all configurable property values that are stored in the Model

Specified by:
clearAll in interface GUIFileActionListener

update

public void update(ConfigProperties cp)
This method is inherited from GUIFileActionListener update the model by reloading the configuration values

Specified by:
update in interface GUIFileActionListener
Parameters:
cp - ConfigProperty that holds the new property values

saveData

public void saveData(ConfigProperties cp)
This method is inherited from GUIFileActionListener Currently the saved data all come only from ModelBuilder

Specified by:
saveData in interface GUIFileActionListener
Parameters:
cp - load all the data to be saved into cp

modelRefresh

public void modelRefresh()
                  throws ConfigurableUtilException
This method is inherited from GUIFileActionListener Reload model

Specified by:
modelRefresh in interface GUIFileActionListener
Throws:
ConfigurableUtilException

getSourceCode

public java.lang.String getSourceCode(java.lang.String classname)
This method would return the source code for the specified class name

Parameters:
classname - Name of class to be searched

getclasslist

public java.util.Map getclasslist(java.lang.String classtype)
get list of Configurable classes that is of specified type

Parameters:
classtype - Type of class
Returns:
List of classes

getClassGroup

public java.util.Iterator getClassGroup(java.lang.String groupname)
Returns:
component Iterator for the specified group

printModel

public void printModel()
This function is used to trace the whole Sphinx model and print out all the Component and Property information, including its configuration values


refresh

public void refresh()
             throws ConfigurableUtilException
Refresh the Sphinx model

Throws:
ConfigurableUtilException - when there is an error during re-reading of Sphinx system