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
- ErrorProvider.cs
- OracleParameter.cs
- CellConstantDomain.cs
- SerializationEventsCache.cs
- OleServicesContext.cs
- TableDetailsCollection.cs
- NavigationFailedEventArgs.cs
- TextInfo.cs
- SettingsSavedEventArgs.cs
- PointConverter.cs
- ParallelTimeline.cs
- OutputCacheProfile.cs
- SatelliteContractVersionAttribute.cs
- EntityDataSourceDesigner.cs
- FilteredDataSetHelper.cs
- VsPropertyGrid.cs
- AssemblyHash.cs
- SiteMapNode.cs
- PageAsyncTaskManager.cs
- ClientCultureInfo.cs
- OleDbCommand.cs
- TerminateDesigner.cs
- dataprotectionpermissionattribute.cs
- XamlStream.cs
- DecimalAnimation.cs
- ActivitySurrogate.cs
- EntityCommand.cs
- SoapProtocolReflector.cs
- keycontainerpermission.cs
- AdCreatedEventArgs.cs
- OrderedDictionaryStateHelper.cs
- DataFormat.cs
- EventSourceCreationData.cs
- WithStatement.cs
- ClrPerspective.cs
- DebugView.cs
- FormsAuthenticationEventArgs.cs
- CustomCategoryAttribute.cs
- SaveFileDialog.cs
- ExpressionVisitorHelpers.cs
- arclist.cs
- Task.cs
- MediaContext.cs
- PersonalizationStateInfoCollection.cs
- TransformerInfo.cs
- ResourceSetExpression.cs
- ViewBase.cs
- ValidationManager.cs
- SplineKeyFrames.cs
- BaseAppDomainProtocolHandler.cs
- GetPageCompletedEventArgs.cs
- ValidatorCollection.cs
- FontWeightConverter.cs
- RouteData.cs
- GridEntry.cs
- AvTrace.cs
- TransportChannelListener.cs
- LambdaCompiler.cs
- ModelPropertyImpl.cs
- CreateParams.cs
- NativeMethods.cs
- NullableConverter.cs
- Int16AnimationBase.cs
- InitializationEventAttribute.cs
- ServiceInfo.cs
- Panel.cs
- XmlCharCheckingWriter.cs
- ScriptRef.cs
- DataGridViewAutoSizeModeEventArgs.cs
- ListItemCollection.cs
- ResponseBodyWriter.cs
- RowUpdatedEventArgs.cs
- InputBuffer.cs
- BindingList.cs
- ScriptManagerProxy.cs
- ValidationEventArgs.cs
- CompareInfo.cs
- SoundPlayerAction.cs
- ProvidersHelper.cs
- DataGridViewHeaderCell.cs
- JapaneseLunisolarCalendar.cs
- SimpleHandlerBuildProvider.cs
- RSAPKCS1KeyExchangeDeformatter.cs
- _SingleItemRequestCache.cs
- UndirectedGraph.cs
- altserialization.cs
- ManualResetEventSlim.cs
- EdmFunctionAttribute.cs
- GridViewItemAutomationPeer.cs
- FileAuthorizationModule.cs
- KoreanLunisolarCalendar.cs
- CodeCompiler.cs
- WebBrowserContainer.cs
- StringCollectionMarkupSerializer.cs
- DoubleLinkList.cs
- TickBar.cs
- WsdlBuildProvider.cs
- DbProviderConfigurationHandler.cs
- IdentitySection.cs
- Translator.cs