当前位置: 首页>>代码示例>>C#>>正文


C# ProcessingContext.ReplaceSequenceAt方法代码示例

本文整理汇总了C#中System.ServiceModel.Dispatcher.ProcessingContext.ReplaceSequenceAt方法的典型用法代码示例。如果您正苦于以下问题:C# ProcessingContext.ReplaceSequenceAt方法的具体用法?C# ProcessingContext.ReplaceSequenceAt怎么用?C# ProcessingContext.ReplaceSequenceAt使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.ServiceModel.Dispatcher.ProcessingContext的用法示例。


在下文中一共展示了ProcessingContext.ReplaceSequenceAt方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Eval

 internal override Opcode Eval(ProcessingContext context)
 {
     StackFrame topSequenceArg = context.TopSequenceArg;
     SeekableXPathNavigator contextNode = null;
     Value[] sequences = context.Sequences;
     for (int i = topSequenceArg.basePtr; i <= topSequenceArg.endPtr; i++)
     {
         NodeSequence sequence = sequences[i].Sequence;
         int count = sequence.Count;
         if (count == 0)
         {
             context.ReplaceSequenceAt(i, NodeSequence.Empty);
             context.ReleaseSequence(sequence);
         }
         else
         {
             NodeSequenceItem[] items = sequence.Items;
             if (sequence.CanReuse(context))
             {
                 contextNode = items[0].GetNavigator();
                 sequence.Clear();
                 sequence.StartNodeset();
                 this.criteria.Select(contextNode, sequence);
                 sequence.StopNodeset();
             }
             else
             {
                 NodeSequence destSequence = null;
                 for (int j = 0; j < count; j++)
                 {
                     contextNode = items[j].GetNavigator();
                     if (destSequence == null)
                     {
                         destSequence = context.CreateSequence();
                     }
                     destSequence.StartNodeset();
                     this.criteria.Select(contextNode, destSequence);
                     destSequence.StopNodeset();
                 }
                 context.ReplaceSequenceAt(i, (destSequence != null) ? destSequence : NodeSequence.Empty);
                 context.ReleaseSequence(sequence);
             }
         }
     }
     return base.next;
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:46,代码来源:SelectOpcode.cs

示例2: Eval

 internal override Opcode Eval(ProcessingContext context)
 {
     StackFrame topSequenceArg = context.TopSequenceArg;
     StackFrame topArg = context.TopArg;
     NodeSequenceBuilder builder = new NodeSequenceBuilder(context);
     Value[] sequences = context.Sequences;
     int basePtr = topSequenceArg.basePtr;
     int index = topArg.basePtr;
     while (basePtr <= topSequenceArg.endPtr)
     {
         NodeSequence sequence = sequences[basePtr].Sequence;
         if (sequence.Count > 0)
         {
             NodesetIterator iterator = new NodesetIterator(sequence);
             while (iterator.NextNodeset())
             {
                 builder.StartNodeset();
                 while (iterator.NextItem())
                 {
                     if (context.Values[index].Boolean)
                     {
                         builder.Add(ref sequence.Items[iterator.Index]);
                     }
                     index++;
                 }
                 builder.EndNodeset();
             }
             context.ReplaceSequenceAt(basePtr, builder.Sequence);
             context.ReleaseSequence(sequence);
             builder.Sequence = null;
         }
         basePtr++;
     }
     context.PopFrame();
     return base.next;
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:36,代码来源:ApplyFilterOpcode.cs

示例3: Eval

        internal override Opcode Eval(ProcessingContext context)
        {
            StackFrame sequences = context.TopSequenceArg;
            StackFrame results = context.TopArg;
            NodeSequenceBuilder sequenceBuilder = new NodeSequenceBuilder(context);
            Value[] sequenceBuffer = context.Sequences;

            for (int seqIndex = sequences.basePtr, resultIndex = results.basePtr; seqIndex <= sequences.endPtr; ++seqIndex)
            {
                NodeSequence sourceSequence = sequenceBuffer[seqIndex].Sequence;
                if (sourceSequence.Count > 0)
                {
                    NodesetIterator nodesetIterator = new NodesetIterator(sourceSequence);
                    while (nodesetIterator.NextNodeset())
                    {
                        sequenceBuilder.StartNodeset();
                        while (nodesetIterator.NextItem())
                        {
                            Fx.Assert(context.Values[resultIndex].IsType(ValueDataType.Boolean), "");
                            if (context.Values[resultIndex].Boolean)
                            {
                                sequenceBuilder.Add(ref sourceSequence.Items[nodesetIterator.Index]);
                            }
                            ++resultIndex;
                        }
                        sequenceBuilder.EndNodeset();
                    }
                    context.ReplaceSequenceAt(seqIndex, sequenceBuilder.Sequence);
                    context.ReleaseSequence(sourceSequence);
                    sequenceBuilder.Sequence = null;
                }
            }

            context.PopFrame();
            return this.next;
        }
开发者ID:nlh774,项目名称:DotNetReferenceSource,代码行数:36,代码来源:QuerySetOp.cs

示例4: Eval

        internal override Opcode Eval(ProcessingContext context)
        {
            StackFrame topFrame = context.TopSequenceArg;
            SeekableXPathNavigator node = null;
            Value[] sequences = context.Sequences;

            for (int i = topFrame.basePtr; i <= topFrame.endPtr; ++i)
            {
                // Each NodeSequence will generate a new one, but only if the source FilterSequence isn't empty
                // If the source FilterSequence is empty, release it and replace it with an empty sequence
                NodeSequence sourceSeq = sequences[i].Sequence;
                int sourceSeqCount = sourceSeq.Count;
                if (sourceSeqCount == 0)
                {
                    context.ReplaceSequenceAt(i, NodeSequence.Empty);
                    context.ReleaseSequence(sourceSeq);
                }
                else
                {
                    NodeSequenceItem[] items = sourceSeq.Items;
                    if (sourceSeq.CanReuse(context))
                    {
                        node = items[0].GetNavigator();
                        sourceSeq.Clear();
                        sourceSeq.StartNodeset();

                        this.criteria.Select(node, sourceSeq);

                        sourceSeq.StopNodeset();
                    }
                    else
                    {
                        NodeSequence newSeq = null;
                        for (int item = 0; item < sourceSeqCount; ++item)
                        {
                            node = items[item].GetNavigator();
                            Fx.Assert(null != node, "");
                            if (null == newSeq)
                            {
                                newSeq = context.CreateSequence();
                            }
                            newSeq.StartNodeset();
                            this.criteria.Select(node, newSeq);
                            newSeq.StopNodeset();
                        }
                        context.ReplaceSequenceAt(i, (null != newSeq) ? newSeq : NodeSequence.Empty);
                        context.ReleaseSequence(sourceSeq);
                    }
                }
            }

            return this.next;
        }
开发者ID:iskiselev,项目名称:JSIL.NetFramework,代码行数:53,代码来源:QuerySelectOp.cs


注:本文中的System.ServiceModel.Dispatcher.ProcessingContext.ReplaceSequenceAt方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。