Example #1
0
 public void Execute(SourceStack stack, TStoreProcessor processor, string token)
 {
     RecordSource right = stack.Pop();
     RecordSource left = stack.Pop();
     RecordSource source = processor.Pair(left, right, PairOperation.FilterLeftNotInRight);
     stack.Push(source);
 }
Example #2
0
            public void Execute(SourceStack stack, TStoreProcessor processor, string token)
            {
                Match m = regex.Match(token);
                if (!m.Success) {
                    Console.WriteLine("syntax error in Merge()");
                    Environment.Exit(0);
                }

                string direction = m.Groups["d"].ToString().Trim();
                bool ascending = true;
                if (direction.Equals("-")) {
                    ascending = false;
                }

                int nary = int.Parse(m.Groups["n"].ToString());

                // set the direction of the empty source so that a sorter doesn't get inserted
                // to sort nothing.

                RecordSource source = processor.EmptySource(true, ascending);
                for (int i = 0; i < nary; i++) {
                    RecordSource next = stack.Pop();
                    if (ascending) source = processor.Pair(next, source, PairOperation.MergeAscend);
                    else source = processor.Pair(next, source, PairOperation.MergeDescend);
                }

                stack.Push(source);
            }
Example #3
0
            public void Execute(SourceStack stack, TStoreProcessor processor, string token)
            {
                Match m = regex.Match(token);
                if (!m.Success) {
                    Console.WriteLine("syntax error in Concat()");
                    Environment.Exit(0);
                }

                int arity = int.Parse(m.Groups["a"].ToString());
                if (arity > stack.Size) {
                    Console.WriteLine("Concat arity greater than stack size.");
                    Environment.Exit(0);
                }

                RecordSource right = stack.Pop();
                for (int i = 1; i < arity; i++) {
                    RecordSource left = stack.Pop();
                    right = processor.Pair(left, right, PairOperation.CatLeftThenRight);
                }

                stack.Push(right);
            }