コード例 #1
0
 protected override void Render(HtmlTextWriter writer)
 {
     foreach (var key in Attributes.Keys)
     {
         if ((string)key == "class")
         {
             InputAttributes.Add("class", Attributes["class"]);
             Attributes.Remove("class");
             break;
         }
     }
     base.Render(writer);
 }
コード例 #2
0
        protected override void Render(HtmlTextWriter writer)
        {
            List <string> keysToRemove = new List <string>();

            foreach (object key in Attributes.Keys)
            {
                string keyString = (string)key;
                InputAttributes.Add(keyString, Attributes[keyString]);
                keysToRemove.Add(keyString);
            }
            foreach (string key in keysToRemove)
            {
                Attributes.Remove(key);
            }
            base.Render(writer);
        }
コード例 #3
0
ファイル: SampleSet.cs プロジェクト: CDMMKY/fuzzy_core
        protected bool KEEL_separator(string Line)
        {
            if (Line[0] == '@')
            {
                string[] temp_lines = Line.Split(new char[] { ',', '@', ' ', '[', ']', '{' },
                                                 StringSplitOptions.RemoveEmptyEntries);
                if (temp_lines[0].Equals("relation", StringComparison.OrdinalIgnoreCase))
                {
                    return(true);
                }
                if (temp_lines[0].Equals("attribute", StringComparison.OrdinalIgnoreCase))
                {
                    AttributeInfo temp_Attrtibute = new AttributeInfo();
                    temp_Attrtibute.Name = temp_lines[1];
                    if (temp_lines[2].Equals("integer", StringComparison.OrdinalIgnoreCase))
                    {
                        temp_Attrtibute.Type = AttributeInfo.TypeAttribute.integer;
                    }
                    if (temp_lines[2].Equals("real", StringComparison.OrdinalIgnoreCase))
                    {
                        temp_Attrtibute.Type = AttributeInfo.TypeAttribute.real;
                    }
                    if (temp_lines[2].Equals("integer", StringComparison.OrdinalIgnoreCase) ||
                        temp_lines[2].Equals("real", StringComparison.OrdinalIgnoreCase))
                    {
                        double temp;
                        string comma = System.Globalization.CultureInfo.CurrentCulture.NumberFormat.NumberDecimalSeparator;

                        double.TryParse(temp_lines[3].Replace(".", comma), out temp);
                        temp_Attrtibute.Min = temp;
                        double.TryParse(temp_lines[4].Replace(".", comma), out temp);
                        temp_Attrtibute.Max = temp;
                        InputAttributes.Add(temp_Attrtibute);
                    }
                    else
                    {
                        temp_Attrtibute.Type = AttributeInfo.TypeAttribute.nominate;
                        if (temp_lines.Where(i => i.Contains('}')).Count() > 0)
                        {
                            temp_Attrtibute.Name = temp_lines[1].Split(new char[] { '{', '}' })[0];
                            for (int i = 2; i < temp_lines.Count(); i++)
                            {
                                string[] temp_set_line = temp_lines[i].Split(new char[] { '{', ',', '}' },
                                                                             StringSplitOptions.RemoveEmptyEntries);
                                temp_Attrtibute.LabelsValues.Add(temp_set_line[0].ToLowerInvariant());
                            }
                            InputAttributes.Add(temp_Attrtibute);
                        }
                    }
                    return(true);
                }
                if (temp_lines[0].Equals("inputs", StringComparison.OrdinalIgnoreCase))
                {
                    for (int i = 1; i < temp_lines.Count(); i++)
                    {
                        if (
                            InputAttributes.First(x => x.Name.Equals(temp_lines[i], StringComparison.OrdinalIgnoreCase)) ==
                            null)
                        {
                            return(false);
                        }
                    }
                    return(true);
                }
                if (temp_lines[0].Equals("outputs", StringComparison.OrdinalIgnoreCase) || temp_lines[0].Equals("output", StringComparison.OrdinalIgnoreCase))
                {
                    for (int i = 1; i < temp_lines.Count(); i++)
                    {
                        OutputAttribute =
                            InputAttributes.First(x => x.Name.Equals(temp_lines[i], StringComparison.OrdinalIgnoreCase));
                        InputAttributes.RemoveAll(x => x == OutputAttribute);
                    }
                    return(true);
                }

                if (temp_lines[0].Equals("data", StringComparison.OrdinalIgnoreCase))
                {
                    if (OutputAttribute.LabelsValues.Count() == 0)
                    {
                        Type = TypeSampleSet.Approximation;
                    }
                    else
                    {
                        Type = TypeSampleSet.Classifier;
                    }
                    return(false);
                }
            }
            if (OutputAttribute.LabelsValues.Count() == 0)
            {
                Type = TypeSampleSet.Approximation;
            }
            else
            {
                Type = TypeSampleSet.Classifier;
            }
            return(false);
        }