Example #1
0
        private bool Equals(BinaryRelationship other)
        {
            if (other == null ||
                GetType() != other.GetType())
            {
                return(false);
            }

            return(LeftOperand.Equals(other.LeftOperand) && RightOperand.Equals(other.RightOperand));
        }
        private ComparisonRelationship GetTransitiveRelationship(ComparisonRelationship other)
        {
            var comparisonKind = ComparisonKind == ComparisonKind.LessOrEqual && other.ComparisonKind == ComparisonKind.LessOrEqual
                    ? ComparisonKind.LessOrEqual
                    : ComparisonKind.Less;

            if (RightOperand.Equals(other.LeftOperand))
            {
                return(new ComparisonRelationship(comparisonKind, LeftOperand, other.RightOperand));
            }
            else if (LeftOperand.Equals(other.RightOperand))
            {
                return(new ComparisonRelationship(comparisonKind, other.LeftOperand, RightOperand));
            }
            else
            {
                return(null);
            }
        }
Example #3
0
        public override bool Equals(object obj)
        {
            if (this == obj)
            {
                return(true);
            }
            if (obj == null)
            {
                return(false);
            }
            if (GetType() != obj.GetType())
            {
                return(false);
            }
            AndMatcher <TKey> other = (AndMatcher <TKey>)obj;

            if (LeftOperand == null)
            {
                if (other.LeftOperand != null)
                {
                    return(false);
                }
            }
            else if (!LeftOperand.Equals(other.LeftOperand))
            {
                return(false);
            }
            if (RightOperand == null)
            {
                if (other.RightOperand != null)
                {
                    return(false);
                }
            }
            else if (!RightOperand.Equals(other.RightOperand))
            {
                return(false);
            }
            return(true);
        }
Example #4
0
 protected BinaryRelationship ComputeTransitiveRelationship(BinaryRelationship other, BinaryRelationship factory)
 {
     if (LeftOperand.Equals(other.LeftOperand))
     {
         return(factory.CreateNew(RightOperand, other.RightOperand));
     }
     else if (RightOperand.Equals(other.LeftOperand))
     {
         return(factory.CreateNew(LeftOperand, other.RightOperand));
     }
     else if (LeftOperand.Equals(other.RightOperand))
     {
         return(factory.CreateNew(other.LeftOperand, RightOperand));
     }
     else if (RightOperand.Equals(other.RightOperand))
     {
         return(factory.CreateNew(other.LeftOperand, LeftOperand));
     }
     else
     {
         return(null);
     }
 }
 private BinaryRelationship GetTransitiveRelationship(EqualsRelationship other)
 {
     if (LeftOperand.Equals(other.LeftOperand))
     {
         return(new ComparisonRelationship(ComparisonKind, other.RightOperand, RightOperand));
     }
     else if (RightOperand.Equals(other.LeftOperand))
     {
         return(new ComparisonRelationship(ComparisonKind, LeftOperand, other.RightOperand));
     }
     else if (LeftOperand.Equals(other.RightOperand))
     {
         return(new ComparisonRelationship(ComparisonKind, other.LeftOperand, RightOperand));
     }
     else if (RightOperand.Equals(other.RightOperand))
     {
         return(new ComparisonRelationship(ComparisonKind, LeftOperand, other.LeftOperand));
     }
     else
     {
         return(null);
     }
 }
Example #6
0
 protected bool AreOperandsMatching(BinaryRelationship rel2)
 {
     return(LeftOperand.Equals(rel2.LeftOperand) && RightOperand.Equals(rel2.RightOperand) ||
            RightOperand.Equals(rel2.LeftOperand) && LeftOperand.Equals(rel2.RightOperand));
 }
Example #7
0
 internal bool AreOperandsMatching(BinaryRelationship other)
 {
     return(LeftOperand.Equals(other.LeftOperand) && RightOperand.Equals(other.RightOperand) ||
            RightOperand.Equals(other.LeftOperand) && LeftOperand.Equals(other.RightOperand));
 }
Example #8
0
 /// <summary>Determines whether the specified object is equal to the current object.</summary>
 /// <param name="operand">Type: <see cref="System.Object" />
 /// The object to compare with the current object.</param>
 /// <returns>Type: <see cref="System.Boolean" />
 /// <b>true</b> if the specified object is equal to the current object; otherwise, <b>false</b>.</returns>
 public override bool Equals(object operand)
 {
     return((!Object.Equals(operand, null)) && (operand.GetType() == typeof(BinaryOperator)) &&
            (LeftOperand != null ? LeftOperand.Equals(((BinaryOperator)operand).LeftOperand) : Object.Equals(((BinaryOperator)operand).LeftOperand, null)) &&
            (RightOperand != null ? RightOperand.Equals(((BinaryOperator)operand).RightOperand) : Object.Equals(((BinaryOperator)operand).RightOperand, null)));
 }
 internal bool AreOperandsSwapped(ComparisonRelationship rel)
 {
     return(LeftOperand.Equals(rel.RightOperand) && RightOperand.Equals(rel.LeftOperand));
 }
 protected bool Equals(BinaryExpression other)
 {
     return(LeftOperand.Equals(other.LeftOperand) && Operator == other.Operator &&
            RightOperand.Equals(other.RightOperand));
 }