Exemplo n.º 1
0
        private string toString(Antecedent antecedent, Codification codebook, CultureInfo culture)
        {
            int    index = antecedent.Index;
            String name  = Variables[index].Name;

            if (String.IsNullOrEmpty(name))
            {
                name = "x[" + index + "]";
            }

            String op = ComparisonExtensions.ToString(antecedent.Comparison);

            String value;

            if (codebook != null && codebook.Columns.Contains(name))
            {
                value = codebook.Translate(name, (int)antecedent.Value);
            }

            else
            {
                value = antecedent.Value.ToString(culture);
            }

            return(String.Format(culture, "{0} {1} {2}", name, op, value));
        }
Exemplo n.º 2
0
        TreeNode BuildTreeNode(DecisionNode node, string attribute_name)
        {
            if (node.Decision != null)
            {
                return(new TreeNode(ComparisonExtensions.ToString(node.Comparison) + " " + codifier[attribute_name][Convert.ToDouble(node.Value)] + " THEN " + codifier.First().Value[Convert.ToDouble(node.Decision)]));
            }

            List <TreeNode> child_nodes = new List <TreeNode>();

            for (int i = 0; i < node.Branches.Count(); ++i)
            {
                child_nodes.Add(BuildTreeNode(node.Branches[i], node.Attribute.Name));
            }

            if (node.Value != null)
            {
                return(new TreeNode(ComparisonExtensions.ToString(node.Comparison) + " " + codifier[attribute_name][Convert.ToDouble(node.Value)] + " THEN IF " + node.Attribute.Name, child_nodes.ToArray()));
            }
            else
            {
                return(new TreeNode("IF " + node.Attribute.Name, child_nodes.ToArray()));
            }
        }
Exemplo n.º 3
0
        /// <summary>
        ///   Returns a <see cref="System.String"/> that represents this instance.
        /// </summary>
        ///
        /// <returns>
        ///   A <see cref="System.String"/> that represents this instance.
        /// </returns>
        ///
        public override string ToString()
        {
            string op = ComparisonExtensions.ToString(Comparison);

            return(String.Format("x[{0}] {1} {2}", Index, op, Value));
        }