internal override Opcode Eval(ProcessingContext context)
        {
            StackFrame topArg = context.TopArg;
            int        count  = topArg.Count;

            if (count > 0)
            {
                QueryBranchResultSet resultTable = context.Processor.CreateResultSet();
                BranchMatcher        matcher     = new BranchMatcher(count, resultTable);
                for (int i = 0; i < count; i++)
                {
                    this.CollectMatches(i, ref context.Values[topArg[i]], resultTable);
                }
                context.PopFrame();
                if (resultTable.Count > 1)
                {
                    resultTable.Sort();
                }
                if ((this.alwaysBranches != null) && (this.alwaysBranches.Count > 0))
                {
                    matcher.InvokeNonMatches(context, this.alwaysBranches);
                }
                matcher.InvokeMatches(context);
                matcher.Release(context);
            }
            else
            {
                context.PopFrame();
            }
            return(base.next);
        }
示例#2
0
        internal override Opcode Eval(ProcessingContext context)
        {
            StackFrame arg      = context.TopArg;
            int        argCount = arg.Count;

            if (argCount > 0)
            {
                QueryBranchResultSet resultSet = context.Processor.CreateResultSet();
                BranchMatcher        matcher   = new BranchMatcher(argCount, resultSet);
                // Operate on values at the the top frame of the value stack
                // For each source value, find the branch that could be taken
                for (int i = 0; i < argCount; ++i)
                {
                    this.CollectMatches(i, ref context.Values[arg[i]], resultSet);
                }
                // Done with whatever we were testing equality against
                context.PopFrame();
                if (resultSet.Count > 1)
                {
                    // Sort results
                    resultSet.Sort();
                }

                // First, do non-true branches..
                if (null != this.alwaysBranches && this.alwaysBranches.Count > 0)
                {
                    matcher.InvokeNonMatches(context, this.alwaysBranches);
                }

                // Iterate through matches, invoking each matched branch
                matcher.InvokeMatches(context);

                matcher.Release(context);
            }
            else
            {
                context.PopFrame();
            }
            return(this.next);
        }
 internal override Opcode Eval(ProcessingContext context)
 {
     StackFrame topArg = context.TopArg;
     int count = topArg.Count;
     if (count > 0)
     {
         QueryBranchResultSet resultTable = context.Processor.CreateResultSet();
         BranchMatcher matcher = new BranchMatcher(count, resultTable);
         for (int i = 0; i < count; i++)
         {
             this.CollectMatches(i, ref context.Values[topArg[i]], resultTable);
         }
         context.PopFrame();
         if (resultTable.Count > 1)
         {
             resultTable.Sort();
         }
         if ((this.alwaysBranches != null) && (this.alwaysBranches.Count > 0))
         {
             matcher.InvokeNonMatches(context, this.alwaysBranches);
         }
         matcher.InvokeMatches(context);
         matcher.Release(context);
     }
     else
     {
         context.PopFrame();
     }
     return base.next;
 }