protected internal override Expression VisitOperatorNot(OperatorNot node) { if (node.Operand is Predicate) { return(node); } else if (node.Operand is OperatorNot) { // Cancel double negation return(((OperatorNot)node.Operand).Operand); } else if (node.Operand is OperatorAnd) { // Apply de Morgan's law var op = node.Operand as OperatorAnd; return(Visit(new OperatorOr(new OperatorNot(op.Left), new OperatorNot(op.Right)))); } else if (node.Operand is OperatorOr) { // Apply de Morgan's law var op = node.Operand as OperatorOr; return(Visit(new OperatorAnd(new OperatorNot(op.Left), new OperatorNot(op.Right)))); } else { throw new NotImplementedException(); } }
protected internal override Expression VisitOperatorNot(OperatorNot node) { if (node.Operand is Predicate) { return node; } else if (node.Operand is OperatorNot) { // Cancel double negation return ((OperatorNot)node.Operand).Operand; } else if (node.Operand is OperatorAnd) { // Apply de Morgan's law var op = node.Operand as OperatorAnd; return Visit(new OperatorOr(new OperatorNot(op.Left), new OperatorNot(op.Right))); } else if (node.Operand is OperatorOr) { // Apply de Morgan's law var op = node.Operand as OperatorOr; return Visit(new OperatorAnd(new OperatorNot(op.Left), new OperatorNot(op.Right))); } else { throw new NotImplementedException(); } }
protected internal virtual Expression VisitOperatorNot(OperatorNot node) { var op = Visit(node.Operand); if (op == node.Operand) { return node; } else { return new OperatorNot(op); } }
protected internal virtual Expression VisitOperatorNot(OperatorNot node) { var op = Visit(node.Operand); if (op == node.Operand) { return(node); } else { return(new OperatorNot(op)); } }