Ejemplo n.º 1
0
        private static string propSheet2XML(string text, PropertySheet propertySheet)
        {
            StringBuilder stringBuilder = new StringBuilder();

            stringBuilder.append("\t<component name=\"").append(text).append("\" type=\"").append(propertySheet.getConfigurableClass().getName()).append("\">");
            Iterator iterator = propertySheet.getRegisteredProperties().iterator();

            while (iterator.hasNext())
            {
                string text2 = (string)iterator.next();
                string text3 = new StringBuilder().append("\n\t\t<property name=\"").append(text2).append("\" ").toString();
                if (propertySheet.getRawNoReplacement(text2) != null)
                {
                    if (ConfigurationManagerUtils_1._SwitchMap_edu_cmu_sphinx_util_props_PropertyType[propertySheet.getType(text2).ordinal()] == 1)
                    {
                        stringBuilder.append("\n\t\t<propertylist name=\"").append(text2).append("\">");
                        List     list      = ConfigurationManagerUtils.toStringList(propertySheet.getRawNoReplacement(text2));
                        Iterator iterator2 = list.iterator();
                        while (iterator2.hasNext())
                        {
                            string text4 = (string)iterator2.next();
                            stringBuilder.append("\n\t\t\t<item>").append(text4).append("</item>");
                        }
                        stringBuilder.append("\n\t\t</propertylist>");
                    }
                    else
                    {
                        stringBuilder.append(text3).append("value=\"").append(propertySheet.getRawNoReplacement(text2)).append("\"/>");
                    }
                }
            }
            stringBuilder.append("\n\t</component>\n\n");
            return(stringBuilder.toString());
        }
Ejemplo n.º 2
0
        protected internal new virtual PropertySheet clone()
        {
            PropertySheet propertySheet = (PropertySheet)base.clone();

            propertySheet.registeredProperties = new HashMap(this.registeredProperties);
            propertySheet.propValues           = new HashMap(this.propValues);
            propertySheet.rawProps             = new HashMap(this.rawProps);
            Iterator iterator = propertySheet.getRegisteredProperties().iterator();

            while (iterator.hasNext())
            {
                string text = (string)iterator.next();
                if (this.getType(text) == PropertyType.__COMPONENT_LIST)
                {
                    propertySheet.rawProps.put(text, ConfigurationManagerUtils.toStringList(this.rawProps.get(text)));
                    propertySheet.propValues.put(text, null);
                }
            }
            propertySheet.cm           = this.cm;
            propertySheet.owner        = null;
            propertySheet.instanceName = this.instanceName;
            return(propertySheet);
        }
Ejemplo n.º 3
0
        internal static void renameComponent(ConfigurationManager configurationManager, string text, string text2)
        {
            if (!ConfigurationManagerUtils.assertionsDisabled && configurationManager == null)
            {
                throw new AssertionError();
            }
            if (!ConfigurationManagerUtils.assertionsDisabled && (text == null || text2 == null))
            {
                throw new AssertionError();
            }
            if (configurationManager.getPropertySheet(text) == null)
            {
                string text3 = new StringBuilder().append("no configurable (to be renamed) named ").append(text).append(" is contained in the CM").toString();

                throw new RuntimeException(text3);
            }
            Iterator iterator = configurationManager.getComponentNames().iterator();

            while (iterator.hasNext())
            {
                string        instanceName  = (string)iterator.next();
                PropertySheet propertySheet = configurationManager.getPropertySheet(instanceName);
                Iterator      iterator2     = propertySheet.getRegisteredProperties().iterator();
                while (iterator2.hasNext())
                {
                    string text4 = (string)iterator2.next();
                    if (propertySheet.getRawNoReplacement(text4) != null)
                    {
                        int num = ConfigurationManagerUtils_1._SwitchMap_edu_cmu_sphinx_util_props_PropertyType[propertySheet.getType(text4).ordinal()];
                        if (num == 1)
                        {
                            List list = ConfigurationManagerUtils.toStringList(propertySheet.getRawNoReplacement(text4));
                            for (int i = 0; i < list.size(); i++)
                            {
                                string text5 = (string)list.get(i);
                                if (String.instancehelper_equals(text5, text))
                                {
                                    list.set(i, text2);
                                }
                            }
                        }
                        else if (num == 2)
                        {
                            if (Object.instancehelper_equals(propertySheet.getRawNoReplacement(text4), text))
                            {
                                propertySheet.setRaw(text4, text2);
                            }
                        }
                    }
                }
            }
            PropertySheet propertySheet2 = configurationManager.getPropertySheet(text);

            propertySheet2.setInstanceName(text2);
            Iterator iterator3 = configurationManager.getGlobalProperties().entrySet().iterator();

            while (iterator3.hasNext())
            {
                Map.Entry entry = (Map.Entry)iterator3.next();
                if (String.instancehelper_equals((string)entry.getValue(), text))
                {
                    configurationManager.setGlobalProperty((string)entry.getKey(), text2);
                }
            }
        }
Ejemplo n.º 4
0
 public virtual List getStringList(string name)
 {
     this.getProperty(name, ClassLiteral <S4StringList> .Value);
     return(ConfigurationManagerUtils.toStringList(this.propValues.get(name)));
 }