예제 #1
0
        public void AddOperandException()
        {
            var rootNode = new ConnectorNode(ConnectorType.IMPLY);

            rootNode.AddOperand(new AtomNode('A'));
            Assert.Throws(typeof(Exception), () => rootNode.AddOperand(new AtomNode('B')));
        }
        private void SetAtomsRelations(ArrayList rules)
        {
            foreach (ExpertSystemRule rule in rules)
            {
                var left  = SetAtomRelationsFromRPN(rule.NpiLeft);
                var right = SetAtomRelationsFromRPN(rule.NpiRight);

                var connectorImply = new ConnectorNode(ConnectorType.IMPLY);
                right.AddChildren(connectorImply);
                connectorImply.AddOperand(left);
                Implication.Add(new ImplicationData(left, right));
                if (rule.Type != ImplicationType.EQUAL)
                {
                    continue;
                }
                var connectorEqual = new ConnectorNode(ConnectorType.IMPLY);
                left.AddChildren(connectorEqual);
                connectorEqual.AddOperand(right);
                Implication.Add(new ImplicationData(right, left));
            }
        }