本文整理汇总了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;
}
示例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;
}
示例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;
}
示例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;
}