You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

57 lines
1.2 KiB

namespace Calculator
{
internal class OperationElement : CalculationElement
{
public Operation Operation { get; }
public OperationElement(Operation operation)
{
Operation = operation;
}
public override string ToString()
{
switch (Operation)
{
case Operation.Add:
return "+";
case Operation.Subtract:
return "-";
case Operation.Muliply:
return "*";
case Operation.Divide:
return "/";
default:
return "Null";
}
}
public override bool Equals(object obj)
{
return Equals(obj as OperationElement);
}
public bool Equals(OperationElement other)
{
return other != null &&
Operation == other.Operation;
}
public override int GetHashCode()
{
return 1706920598 + Operation.GetHashCode();
}
}
internal enum Operation
{
Add,
Subtract,
Muliply,
Divide
}
}