示例#1
0
        private void AddUniqueAndNode(params INode[] children)
        {
            foreach (var andNode in _children)
            {
                if (andNode.Children.Count != children.Length)
                    continue;
                bool isMatchedSubTree = IsMatchedSubTree(children, andNode);
                if (isMatchedSubTree)
                    return;
            }

            // not found so return new and node
            var newAndNode = new AndNode();
            foreach (var child in children)
                newAndNode.AddChild(child);

            _children.Add(newAndNode);
        }
示例#2
0
 public void AddUniqueFamily(INode source, INode trigger)
 {
     if (_andNode != null)
         return;
     _andNode = new AndNode();
     _andNode.AddChild(source);
     _andNode.AddChild(trigger);
     _children.Add(_andNode);
 }