public bool IsEqualSetTo(Condition other) { if (!((FirstVariable.Equals(other.FirstVariable) && SecondVariable.Equals(other.SecondVariable)) || (FirstVariable.Equals(other.SecondVariable) && SecondVariable.Equals(other.FirstVariable)))) { return(false); } if (FirstVariable.Equals(other.SecondVariable) && SecondVariable.Equals(other.FirstVariable)) { other = Condition.Reorder(other); } if (Goal != other.Goal) { return(false); } if ((FirstVariableModifier / SecondVariableModifier) != (other.FirstVariableModifier / other.SecondVariableModifier)) { return(false); } return(true); }
public bool SimilarTo(Condition other) { return((FirstVariable.Equals(other.FirstVariable) && SecondVariable.Equals(other.SecondVariable)) || (FirstVariable.Equals(other.SecondVariable) && SecondVariable.Equals(other.FirstVariable))); }
public bool IsProperSubsetOf(Condition other) { if (IsEqualSetTo(other)) { return(false); } if (!SimilarTo(other)) { return(false); } if (FirstVariable.Equals(other.SecondVariable) && SecondVariable.Equals(other.FirstVariable)) { other = Condition.Reorder(other); } double ratioThis = FirstVariableModifier / SecondVariableModifier; double ratioOther = other.FirstVariableModifier / other.SecondVariableModifier; switch (Goal) { case Relation.LessThan: if (other.Goal == Relation.LessThan && ratioThis > ratioOther) { return(true); } else if (other.Goal == Relation.LessThanOrEqualTo && ratioThis >= ratioOther) { return(true); } else { return(false); } case Relation.LessThanOrEqualTo: if (other.Goal == Relation.LessThanOrEqualTo && ratioThis > ratioOther) { return(true); } else { return(false); } case Relation.GreaterThan: if (other.Goal == Relation.GreaterThan && ratioThis < ratioOther) { return(true); } else if (other.Goal == Relation.GreaterThanOrEqualTo && ratioThis <= ratioOther) { return(true); } else { return(false); } case Relation.GreaterThanOrEqualTo: if (other.Goal == Relation.GreaterThanOrEqualTo && ratioThis < ratioOther) { return(true); } else { return(false); } case Relation.EqualTo: if (other.Goal == Relation.LessThanOrEqualTo && ratioThis == ratioOther) { return(true); } else if (other.Goal == Relation.GreaterThanOrEqualTo && ratioThis == ratioOther) { return(true); } else { return(false); } default: return(false); } }