/// <summary> /// Visits and performs a property count on predicate expression. /// </summary> /// <param name="expression">Predicate expression.</param> /// <returns>Tuple (property satisfied count, property not satisfied count).</returns> public Tuple <double, double> Visit(ImplyExpression expression) { var leftChildPropCounts = expression.LeftChild.Accept(this); var rightChildPropCounts = expression.RightChild.Accept(this); return(Tuple.Create(Math.Max(leftChildPropCounts.Item2, rightChildPropCounts.Item1), Math.Max(leftChildPropCounts.Item1, rightChildPropCounts.Item2))); }
/// <summary> /// Visits and performs a property count on predicate expression. /// </summary> /// <param name="expression">Predicate expression.</param> /// <returns>Tuple (property satisfied count, property not satisfied count).</returns> public Tuple <int, int> Visit(ImplyExpression expression) { var leftChildPropCounts = expression.LeftChild.Accept(this); var rightChildPropCounts = expression.RightChild.Accept(this); // fulfilled: min(notFulfilled(a),fulfilled(b)); notFulfilled: min(fulfilled(a),notFulfilled(b)) return(Tuple.Create(Math.Min(leftChildPropCounts.Item2, rightChildPropCounts.Item1), Math.Min(leftChildPropCounts.Item1, rightChildPropCounts.Item2))); }
/// <summary> /// Checks the equality of objects. /// </summary> /// <param name="obj">Object to be checked.</param> /// <returns>True if the objects are equal, false otherwise.</returns> public override bool Equals(object obj) { ImplyExpression other = obj as ImplyExpression; if (other == null) { return(false); } return(LeftChild.Equals(other.LeftChild) && RightChild.Equals(other.RightChild)); }
/// <summary> /// Visits and transforms the expression. /// </summary> /// <param name="expression">Source expression.</param> /// <returns>Transformed expression.</returns> public override IExpression Visit(ImplyExpression expression) { List <IExpression> arguments = new List <IExpression>(); IsNegating = !IsNegating; arguments.Add(expression.LeftChild.Accept(this)); IsNegating = !IsNegating; arguments.Add(expression.RightChild.Accept(this)); if (IsNegating) { return(new AndExpression(arguments)); } return(new OrExpression(arguments)); }
/// <summary> /// Visits the expression. /// </summary> /// <param name="expression">Expression.</param> public void Visit(ImplyExpression expression) { expression.LeftChild.Accept(this); expression.RightChild.Accept(this); }
/// <summary> /// Visits and transforms the expression. /// </summary> /// <param name="expression">Source expression.</param> /// <returns>Transformed expression.</returns> public IExpression Visit(ImplyExpression expression) { return(new ImplyExpression(expression.LeftChild.Accept(this), expression.RightChild.Accept(this))); }