using System; using System.Diagnostics; namespace MathInterpreter.Core; /// /// Represents a mathematical expression /// public sealed class MathExpression { // TODO /* private double? _leftOperand; private Operator? _operator; private double? _result; private double? _rightOperand; */ /// /// Creates a new instance of from the provided expression string. /// Validates the provided expression and throws an exception if it is invalid. /// /// The expression as a string /// Thrown if a problem with the operator is found /// Thrown if a problem with the expression format is found /// Thrown if a problem with the value of a number is found public MathExpression(string expressionString) { ValidateAndParse(expressionString.Trim().AsSpan()); } /// /// Gets the calculated result of the expression /// /// /// Thrown if validation during construction did not guard against an unexpected, invalid expression /// public double Result { get { // TODO throw new NotImplementedException(); } } /// /// Returns a string representation of the expression - this is not the originally provided string /// but the cleaned up version /// /// String representation of the expression /// /// Thrown if validation during construction did not guard against an unexpected, invalid expression /// and left this instance in an invalid state /// public override string ToString() { // TODO throw new NotImplementedException(); } private void ValidateAndParse(ReadOnlySpan expression) { // TODO throw new NotImplementedException(); } }