Ejemplo n.º 1
0
        // Construtors
        public Node(IAttributes attribute, List <int> index)
        {
            Attribute = attribute;

            //continuous
            if (Attribute.GetAttributeType() == "continuous")
            {
                Threshold = attribute.GetThreshold();

                // setting the Branchs
                lessThanBranch    = new Branch("less", Attribute.GetLessThanList(index, Threshold));
                GreaterThanBranch = new Branch("greater", Attribute.GetGreaterThanList(index, Threshold));
                // add to branches
                branchs.Add(lessThanBranch);
                branchs.Add(GreaterThanBranch);

                // Sets the type of node
                nodeType = "Continuous";
            }
            if (Attribute.GetAttributeType() == "discrete")
            {
                //Create branches
                foreach (string value in Attribute.GetAttributeValues())
                {
                    branchs.Add(new Branch(value, Attribute.GetAttributeValueList(index, value)));
                }

                // sets the type of node
                nodeType = "Discrete";
            }
        }