public int CompareTo(IExpressionMemberComparable other) { if (other is ConstantToken) { return(1); } if (other is VariableToken) { return(1); } if (other is FractionToken f) { if (GetHashCode() > f.GetHashCode()) { return(1); } else if (GetHashCode() < f.GetHashCode()) { return(-1); } else { return(0); } } throw new Exception("Unknown comparison type."); }
public int CompareTo(IExpressionMemberComparable other) { if (other is ConstantToken) { if (NumericValue > ((ConstantToken)other).NumericValue) { return(1); } else if (NumericValue < ((ConstantToken)other).NumericValue) { return(-1); } else { return(0); } } if (other is VariableToken) { return(-1); } if (other is FractionToken) { return(-1); } throw new Exception("Unknown comparison type."); }