From() public method

Sets the starting range member and returns the updated current instance of MdxRange.
public From ( MdxMember member ) : MdxRange
member MdxMember Starting .
return MdxRange
Esempio n. 1
0
        /// <summary>
        /// Performs range syntactical analysis over collection of <see cref="Token"/> objects using <see cref="IStatedTwoWayEnumerator{T}"/>.
        /// </summary>
        /// <param name="enumerator">Extended enumerator of collection of <see cref="Token"/> objects.</param>
        /// <param name="expression">Output parsed range if syntactic analysis was succeeded.</param>
        /// <returns><value>True</value> if succeeded. <value>False</value> if failed.</returns>
        internal static bool TryParseRange(IStatedTwoWayEnumerator <Token> enumerator, out MdxExpressionBase expression)
        {
            enumerator.SavePosition();
            expression = null;

            var range = new MdxRange();

            MdxExpressionBase fromMember;

            if (!TryParseMember(enumerator, out fromMember))
            {
                enumerator.RestoreLastSavedPosition();
                return(false);
            }

            if (!IsNextTokenValid(enumerator, TokenType.RangeSeparator))
            {
                enumerator.RestoreLastSavedPosition();
                return(false);
            }

            range.From((MdxMember)fromMember);

            MdxExpressionBase toMember;

            if (!TryParseMember(enumerator, out toMember))
            {
                enumerator.RestoreLastSavedPosition();
                return(false);
            }

            range.To((MdxMember)toMember);

            expression = range;

            enumerator.RemoveLastSavedState();
            return(true);
        }
Esempio n. 2
0
        /// <summary>
        /// Performs range syntactical analysis over collection of <see cref="Token"/> objects using <see cref="IStatedTwoWayEnumerator{T}"/>.
        /// </summary>
        /// <param name="enumerator">Extended enumerator of collection of <see cref="Token"/> objects.</param>
        /// <param name="expression">Output parsed range if syntactic analysis was succeeded.</param>
        /// <returns><value>True</value> if succeeded. <value>False</value> if failed.</returns>
        internal static bool TryParseRange(IStatedTwoWayEnumerator<Token> enumerator, out MdxExpressionBase expression)
        {
            enumerator.SavePosition();
            expression = null;

            var range = new MdxRange();

            MdxExpressionBase fromMember;
            if (!TryParseMember(enumerator, out fromMember))
            {
                enumerator.RestoreLastSavedPosition();
                return false;
            }

            if (!IsNextTokenValid(enumerator, TokenType.RangeSeparator))
            {
                enumerator.RestoreLastSavedPosition();
                return false;
            }

            range.From((MdxMember)fromMember);

            MdxExpressionBase toMember;
            if (!TryParseMember(enumerator, out toMember))
            {
                enumerator.RestoreLastSavedPosition();
                return false;
            }

            range.To((MdxMember) toMember);

            expression = range;

            enumerator.RemoveLastSavedState();
            return true;
        }