Beispiel #1
0
        public override double VisitMmaxMminExpr(ExcelApplicationParser.MmaxMminExprContext context)
        {
            List <double> Tist  = new List <double>();
            int           index = 0;

            while (WalkN(context, index) != 1.0101)
            {
                Tist.Add(WalkN(context, index));
                index++;
            }

            var sortedList = from T in Tist orderby T select T;

            if (context.operatorToken.Type == ExcelApplicationLexer.MMAX)
            {
                Debug.WriteLine("MMAX(");
                for (index = 0; index < Tist.Count(); ++index)
                {
                    Debug.WriteLine("{0}", Tist.ElementAt(index));
                    if (index != Tist.Count() - 1)
                    {
                        Debug.WriteLine(",");
                    }
                }
                Debug.WriteLine(")");
                return(sortedList.ElementAt(sortedList.Count() - 1));
            }
            else
            {
                Debug.WriteLine("MMIN(");
                for (index = 0; index < Tist.Count(); ++index)
                {
                    Debug.WriteLine("{0}", Tist.ElementAt(index));
                    if (index != Tist.Count() - 1)
                    {
                        Debug.WriteLine(",");
                    }
                }
                Debug.WriteLine(")");
                return(sortedList.ElementAt(0));
            }
        }
 /// <summary>
 /// Visit a parse tree produced by the <c>MmaxMminExpr</c>
 /// labeled alternative in <see cref="ExcelApplicationParser.expression"/>.
 /// <para>
 /// The default implementation returns the result of calling <see cref="AbstractParseTreeVisitor{Result}.VisitChildren(IRuleNode)"/>
 /// on <paramref name="context"/>.
 /// </para>
 /// </summary>
 /// <param name="context">The parse tree.</param>
 /// <return>The visitor result.</return>
 public virtual Result VisitMmaxMminExpr([NotNull] ExcelApplicationParser.MmaxMminExprContext context)
 {
     return(VisitChildren(context));
 }
Beispiel #3
0
 /// <summary>
 /// Exit a parse tree produced by the <c>MmaxMminExpr</c>
 /// labeled alternative in <see cref="ExcelApplicationParser.expression"/>.
 /// <para>The default implementation does nothing.</para>
 /// </summary>
 /// <param name="context">The parse tree.</param>
 public virtual void ExitMmaxMminExpr([NotNull] ExcelApplicationParser.MmaxMminExprContext context)
 {
 }