public ImplicationNode(FilterImplication implication)
     : this()
 {
     this.Implication = implication;
 }
        public static ExpressionTree AssociateTreeWithFilter(ExpressionTree tree, FilterBase filter, 
            FilterImplication implication, TreeDirection treeDirection)
        {
            // check the parameters
            Debug.Assert(tree != null && filter != null, "Null parameters");
            ExpressionTree result = new ExpressionTree();

            if(treeDirection == TreeDirection.Left) {
                result.AddRoot(ExpressionType.Implication, implication);
                result.Root.Left = tree.Root;
                result.AddNode(result.Root, TreeDirection.Right, ExpressionType.Filter, filter);
            }
            else {
                result.AddRoot(ExpressionType.Implication, implication);
                result.Root.Right = tree.Root;
                result.AddNode(result.Root, TreeDirection.Left, ExpressionType.Filter, filter);
            }

            return result;
        }
        public static ExpressionTree AssociateFilters(FilterBase a, FilterBase b, 
            FilterImplication implication)
        {
            // check the parameters
            Debug.Assert(a != null && b != null, "Null parameters");

            ExpressionTree result = new ExpressionTree();
            result.AddRoot(ExpressionType.Implication, implication);
            result.AddNode(result.Root, TreeDirection.Left, ExpressionType.Filter, a);
            result.AddNode(result.Root, TreeDirection.Right, ExpressionType.Filter, b);
            return result;
        }
        public static ExpressionTree AssociateTrees(ExpressionTree a, ExpressionTree b, FilterImplication implication)
        {
            // check the parameters
            Debug.Assert(a != null && b != null, "Null parameters");

            ExpressionTree result = new ExpressionTree();
            result.AddRoot(ExpressionType.Implication, implication);
            result.Root.Left = a.Root;
            result.Root.Right = b.Root;
            return result;
        }
        /// <summary>
        /// Gets the type of the implication.
        /// </summary>
        /// <param name="s">The string.</param>
        /// <param name="implication">The implication.</param>
        /// <returns></returns>
        private bool GetImplicationType(string s, out FilterImplication implication)
        {
            implication = FilterImplication.AND;

            if(s == null || s.Length == 0) {
                return false;
            }

            if(s == AndImplication) {
                implication = FilterImplication.AND;
                return true;
            }
            else if(s == OrImplication) {
                implication = FilterImplication.OR;
                return true;
            }

            return false;
        }