AssertSeparator() private méthode

private AssertSeparator ( bool isSeparator ) : void
isSeparator bool
Résultat void
        /// <summary>
        /// Format the given xsl:number place marker
        /// </summary>
        /// <param name="val">Place marker - either a sequence of ints, or a double singleton</param>
        /// <returns>Formatted string</returns>
        public string FormatSequence(IList <XPathItem> val)
        {
            StringBuilder sb = new StringBuilder();

            // If the value was supplied directly, in the 'value' attribute, check its validity
            if (val.Count == 1 && val[0].ValueType == typeof(double))
            {
                double dblVal = val[0].ValueAsDouble;
                if (!(0.5 <= dblVal && dblVal < double.PositiveInfinity))
                {
                    // Errata E24: It is an error if the number is NaN, infinite or less than 0.5; an XSLT processor may signal
                    // the error; if it does not signal the error, it must recover by converting the number to a string as if
                    // by a call to the 'string' function and inserting the resulting string into the result tree.
                    return(XPathConvert.DoubleToString(dblVal));
                }
            }

            if (_tokens == null)
            {
                // Special case of the default format
                for (int idx = 0; idx < val.Count; idx++)
                {
                    if (idx > 0)
                    {
                        sb.Append('.');
                    }
                    FormatItem(sb, val[idx], DefaultStartChar, 1);
                }
            }
            else
            {
                int       cFormats = _tokens.Count;
                TokenInfo prefix = _tokens[0], suffix;

                if (cFormats % 2 == 0)
                {
                    suffix = null;
                }
                else
                {
                    suffix = _tokens[--cFormats];
                }

                TokenInfo periodicSeparator = 2 < cFormats ? _tokens[cFormats - 2] : s_defaultSeparator;
                TokenInfo periodicFormat    = 0 < cFormats ? _tokens[cFormats - 1] : s_defaultFormat;

                if (prefix != null)
                {
                    prefix.AssertSeparator(true);
                    sb.Append(prefix.formatString, prefix.startIdx, prefix.length);
                }

                int valCount = val.Count;
                for (int i = 0; i < valCount; i++)
                {
                    int  formatIndex = i * 2;
                    bool haveFormat  = formatIndex < cFormats;

                    if (i > 0)
                    {
                        TokenInfo thisSeparator = haveFormat ? _tokens[formatIndex + 0] : periodicSeparator;
                        thisSeparator.AssertSeparator(true);
                        sb.Append(thisSeparator.formatString, thisSeparator.startIdx, thisSeparator.length);
                    }

                    TokenInfo thisFormat = haveFormat ? _tokens[formatIndex + 1] : periodicFormat;
                    thisFormat.AssertSeparator(false);
                    FormatItem(sb, val[i], thisFormat.startChar, thisFormat.length);
                }

                if (suffix != null)
                {
                    suffix.AssertSeparator(true);
                    sb.Append(suffix.formatString, suffix.startIdx, suffix.length);
                }
            }
            return(sb.ToString());
        }