/// <summary> /// Calculates the members of the bracket. /// </summary> /// <returns>An object represent the result of calculation operation.</returns> public object calculate() { int operatorIdx; while (_childs.Count > 1) { operatorIdx = -1; foreach (char c in OPERATORS) { if (_childs.Contains(c.ToString().Trim())) { operatorIdx = _childs.IndexOf(c.ToString().Trim()); break; } } if (operatorIdx == -1) { break; } operateChild((string)_childs[operatorIdx], operatorIdx); } if (_function != null) { return(_function.calculate(this)); } return(_childs[0]); }