Code:
/ WCF / WCF / 3.5.30729.1 / untmp / Orcas / SP / ndp / cdf / src / WCF / ServiceModel / System / ServiceModel / Dispatcher / QuerySetOp.cs / 1 / QuerySetOp.cs
//------------------------------------------------------------ // Copyright (c) Microsoft Corporation. All rights reserved. //----------------------------------------------------------- namespace System.ServiceModel.Dispatcher { using System.Collections; using System.Diagnostics; internal class OrdinalOpcode : Opcode { internal OrdinalOpcode() : base(OpcodeID.Ordinal) { } internal override Opcode Eval(ProcessingContext context) { StackFrame sequences = context.TopSequenceArg; StackFrame ordinals = context.TopArg; Value[] sequenceBuffer = context.Sequences; for (int seqIndex = sequences.basePtr, ordinalIndex = ordinals.basePtr; seqIndex <= sequences.endPtr; ++seqIndex) { NodeSequence sequence = sequenceBuffer[seqIndex].Sequence; for (int item = 0; item < sequence.Count; ++item) { context.Values[ordinalIndex].Boolean = (sequence[item].Position == context.Values[ordinalIndex].Double); ordinalIndex++; } } return this.next; } } internal class LiteralOrdinalOpcode : Opcode { int ordinal; // 1 based internal LiteralOrdinalOpcode(int ordinal) : base(OpcodeID.LiteralOrdinal) { DiagnosticUtility.DebugAssert(ordinal > 0, ""); this.ordinal = ordinal; } #if NO // Never used for inverse query, so don't need this internal override bool Equals(Opcode op) { if (base.Equals (op)) { return (this.ordinal == ((LiteralOrdinalOpcode) op).ordinal); } return false; } #endif internal override Opcode Eval(ProcessingContext context) { StackFrame sequences = context.TopSequenceArg; Value[] sequenceBuffer = context.Sequences; context.PushFrame(); for (int i = sequences.basePtr; i <= sequences.endPtr; ++i) { NodeSequence sequence = sequenceBuffer[i].Sequence; for (int item = 0; item < sequence.Count; ++item) { context.Push(sequence[item].Position == this.ordinal); } } return this.next; } #if DEBUG_FILTER public override string ToString() { return string.Format("{0} {1}", base.ToString(), this.ordinal); } #endif } // Filters context sequences using the results of the last executed predicate // Does pop result values internal class ApplyFilterOpcode : Opcode { internal ApplyFilterOpcode() : base(OpcodeID.Filter) { } 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()) { DiagnosticUtility.DebugAssert(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; } } ////// Union the sequences found in the top two frames of the value stack /// The unionized sequence /// internal class UnionOpcode : Opcode { internal UnionOpcode() : base(OpcodeID.Union) { } internal override Opcode Eval(ProcessingContext context) { StackFrame topArg = context.TopArg; StackFrame secondArg = context.SecondArg; DiagnosticUtility.DebugAssert(topArg.Count == secondArg.Count, ""); for (int x = topArg.basePtr, y = secondArg.basePtr; x <= topArg.endPtr; ++x, ++y) { NodeSequence seqX = context.Values[x].Sequence; NodeSequence seqY = context.Values[y].Sequence; // Replace with a new sequence that is the union of the two context.SetValue(context, y, seqY.Union(context, seqX)); } context.PopFrame(); return this.next; } } internal class MergeOpcode : Opcode { internal MergeOpcode() : base(OpcodeID.Merge) { } internal override Opcode Eval(ProcessingContext context) { Value[] values = context.Values; StackFrame arg = context.TopArg; for (int i = arg.basePtr; i <= arg.endPtr; ++i) { DiagnosticUtility.DebugAssert(ValueDataType.Sequence == values[i].Type, ""); NodeSequence seq = values[i].Sequence; NodeSequence newSeq = context.CreateSequence(); for(int j = 0; j < seq.Count; ++j) { NodeSequenceItem item = seq[j]; newSeq.AddCopy(ref item); } newSeq.Merge(); context.SetValue(context, i, newSeq); } return this.next; } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. // Copyright (c) Microsoft Corporation. All rights reserved.
Link Menu

This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- UserCancellationException.cs
- ScrollEventArgs.cs
- ThreadStaticAttribute.cs
- XamlPathDataSerializer.cs
- DynamicDiscoveryDocument.cs
- MissingFieldException.cs
- COM2IProvidePropertyBuilderHandler.cs
- PersonalizationProviderHelper.cs
- WebPartConnectionsConfigureVerb.cs
- Line.cs
- InputReportEventArgs.cs
- SiteMapNode.cs
- SHA256Managed.cs
- GridProviderWrapper.cs
- XmlAnyElementAttributes.cs
- SystemIPv4InterfaceProperties.cs
- InternalSafeNativeMethods.cs
- RequestQueryProcessor.cs
- DataRow.cs
- Utils.cs
- DataControlFieldCollection.cs
- XmlLoader.cs
- WaitHandleCannotBeOpenedException.cs
- ActivityCodeDomSerializer.cs
- HttpResponseWrapper.cs
- Stream.cs
- AspProxy.cs
- NamedPipeAppDomainProtocolHandler.cs
- Queue.cs
- ExcludeFromCodeCoverageAttribute.cs
- ModuleElement.cs
- KoreanCalendar.cs
- OutgoingWebRequestContext.cs
- PenLineJoinValidation.cs
- CellTreeNodeVisitors.cs
- InfiniteIntConverter.cs
- WebPartsSection.cs
- StrokeNode.cs
- SafePointer.cs
- TakeOrSkipQueryOperator.cs
- Metafile.cs
- FileCodeGroup.cs
- XmlEntityReference.cs
- FaultPropagationQuery.cs
- EllipticalNodeOperations.cs
- Converter.cs
- RegistrySecurity.cs
- PageAsyncTaskManager.cs
- BrowserDefinitionCollection.cs
- TemplateBamlTreeBuilder.cs
- XmlSerializerFormatAttribute.cs
- CodeDelegateCreateExpression.cs
- FormsAuthenticationEventArgs.cs
- ImageKeyConverter.cs
- ReadOnlyDictionary.cs
- TextLine.cs
- Geometry.cs
- OrderedDictionary.cs
- ObjectFactoryCodeDomTreeGenerator.cs
- Property.cs
- MimeWriter.cs
- httpstaticobjectscollection.cs
- FontCollection.cs
- ConfigXmlAttribute.cs
- SourceSwitch.cs
- ConnectivityStatus.cs
- BmpBitmapDecoder.cs
- MessageAction.cs
- PersonalizationAdministration.cs
- DynamicObjectAccessor.cs
- SvcMapFileSerializer.cs
- TypeUtils.cs
- MatrixConverter.cs
- SRef.cs
- VScrollBar.cs
- XmlSchemaType.cs
- DetailsViewInsertedEventArgs.cs
- UnsafeNativeMethodsCLR.cs
- AccessDataSource.cs
- EdmPropertyAttribute.cs
- ObjectSpanRewriter.cs
- BitmapInitialize.cs
- SafeEventHandle.cs
- ZipQueryOperator.cs
- DefaultExpressionVisitor.cs
- DivideByZeroException.cs
- ZipIOLocalFileHeader.cs
- ConstantExpression.cs
- PasswordTextContainer.cs
- DataGridViewTextBoxColumn.cs
- NavigationCommands.cs
- XamlReaderHelper.cs
- WebBrowsableAttribute.cs
- HeaderedContentControl.cs
- BlockingCollection.cs
- MsmqIntegrationReceiveParameters.cs
- Encoder.cs
- KeyToListMap.cs
- WebBrowserDocumentCompletedEventHandler.cs
- BinaryReader.cs