/// <summary>
        /// Powers the label.
        /// </summary>
        /// <param name="includeParentheses">if set to <c>true</c> [include parentheses].</param>
        /// <returns>System.String.</returns>
        protected string powerLabel(bool includeParentheses = false)
        {
            if (!HasPower())
            {
                return(string.Empty);
            }

            string totalPowerLabel;

            if (_power.HasPower())
            {   // Keep negative sign inside of any brackets
                totalPowerLabel = Group.AddOuterBrackets(_power.Label());
            }
            else if (includeParentheses)
            {   // Keep negative sign outside of any brackets
                Sign sign = _power.ValueIsNegative() ? new Sign(-1) : new Sign(1);
                totalPowerLabel = sign * Group.AddOuterBrackets(_power.GetAbsolute().Label());
            }
            else
            {
                totalPowerLabel = _power.Label();
            }

            return(Query.POWER + totalPowerLabel);
        }
Exemple #2
0
        protected IBase getUnit(int index, bool getAbsolute = false)
        {
            IBase unit = _unitOperatorPair[index].Unit;

            if (getAbsolute)
            {
                unit = unit.GetAbsolute();
            }

            return(unit);
        }