public string ToString(bool brackets) { var sb = new StringBuilder(); if (brackets) { sb.Append(BracketsType.Open()); } sb.Append(Sign); if (Argument is BinaryOperator) { var bo = Argument as BinaryOperator; sb.Append(bo.ToString(Priority >= bo.Priority)); } else if (Argument is UnaryOperator) { var uo = Argument as UnaryOperator; sb.Append(uo.ToString(Priority >= uo.Priority)); } else { sb.Append(Argument.ToString()); } if (brackets) { sb.Append(BracketsType.Close()); } return(sb.ToString()); }
public override string ToString() { var currName = name; var sb = new StringBuilder(name); if (Derivatives.Any(d => d != 0)) { if (Arguments.Length == 1) { sb.Append(new String('\'', Derivatives[0])); } else { sb.Append(DerivativeBracketsType.Open()); sb.Append(String.Join(SeparatorType.Value(), Derivatives)); sb.Append(DerivativeBracketsType.Close()); } } name = sb.ToString(); var res = base.ToString(); name = currName; return(res); }