public override bool Equals(object obj) { var eq = obj as Equation; if (eq != null) { return(Lhs.Equals(eq.Lhs) && Rhs.Equals(eq.Rhs)); } return(false); }
public override bool Equals(object obj) { var eqGoal = obj as EqGoal; if (eqGoal != null) { if (Rhs == null) { return(Lhs.Equals(eqGoal.Lhs)); } bool isNum1 = LogicSharp.IsNumeric(Rhs); bool isNum2 = LogicSharp.IsNumeric(eqGoal.Rhs); bool result; if (isNum1 && isNum2) { result = LogicSharp.NumericEqual(Rhs, eqGoal.Rhs); } else { result = Rhs.Equals(eqGoal.Rhs); } return(Lhs.Equals(eqGoal.Lhs) && result); } var eq = obj as Equation; if (eq != null) { if (Rhs == null) { return(Lhs.Equals(eq.Lhs)); } bool isNum1 = LogicSharp.IsNumeric(Rhs); bool isNum2 = LogicSharp.IsNumeric(eq.Rhs); bool result; if (isNum1 && isNum2) { result = LogicSharp.NumericEqual(Rhs, eq.Rhs); } else { result = Rhs.Equals(eq.Rhs); } if (eq.Lhs == null) { return(false); } return(Lhs.ToString().Equals(eq.Lhs.ToString()) && result); } return(false); }
public bool ContainsVar(Var variable) { var lhsVar = Lhs as Var; bool result; if (lhsVar != null) { result = lhsVar.Equals(variable); if (result) { return(true); } } var lhsTerm = Lhs as Term; if (lhsTerm != null) { result = lhsTerm.ContainsVar(variable); if (result) { return(true); } } var rhsVar = Rhs as Var; if (rhsVar != null) { result = Rhs.Equals(variable); if (result) { return(true); } } return(false); }
public bool Equals(BinaryOperation operation) => HashCode == operation.HashCode && Value == operation.Value && Operator == operation.Operator && Lhs.Equals(operation.Lhs) && Rhs.Equals(operation.Rhs);