//checks Default Predicate
        Boolean Compound(Dictionary <string, object> inputDic)
        {
            Boolean result = false;

            switch (predicate.Attribute("booleanOperator"))
            {
            case "or": for (int i = 0; i < predicate.ChildCount(); i++)
                {
                    if (Predicate(inputDic, predicate.Child(i)))
                    {
                        result = true;
                        break;
                    }
                }
                break;

            case "and": for (int i = 0; i < predicate.ChildCount(); i++)
                {
                    result = true;
                    if (!Predicate(inputDic, predicate.Child(i)))
                    {
                        result = false;
                        break;
                    }
                }
                break;

            case "surrogate": for (int i = 0; i < predicate.ChildCount(); i++)
                {
                    if (Predicate(inputDic, predicate.Child(i)) != null)
                    {
                        result = Predicate(inputDic, predicate.Child(i));
                        break;
                    }
                }
                break;
            }

            return(result);
        }
        public TreeNode(Node xmlNd)
        {
            xnode = xmlNd;
            score = xnode.Attribute("score");
            for (int i = 0; i < xnode.ChildCount(); i++)
            {
                switch (xnode.Child(i).Name())
                {
                case "True": predicate = xnode.Child(i);
                    break;

                case "False": predicate = xnode.Child(i);
                    break;

                case "SimplePredicate": predicate = xnode.Child(i);
                    break;

                case "CompoundPredicate": predicate = xnode.Child(i);
                    break;
                }
            }
        }
Example #3
0
        //gets the id of each node. its an integer array. with this array cID of Node object will be initialized
        int[] getChildren(Node xNode)
        {
            List <int> tmp = new List <int>();

            int[] children = null;

            for (int i = 0; i < xNode.ChildCount("Node"); i++)
            {
                tmp.Add(Convert.ToInt16(xNode.Child(i, "Node").Attribute("id")));
            }

            children = tmp.ToArray();
            return(children);
        }