Code:
/ WCF / WCF / 3.5.30729.1 / untmp / Orcas / SP / ndp / cdf / src / WCF / ServiceModel / System / ServiceModel / Dispatcher / QueryMath.cs / 1 / QueryMath.cs
//------------------------------------------------------------ // Copyright (c) Microsoft Corporation. All rights reserved. //----------------------------------------------------------- namespace System.ServiceModel.Dispatcher { using System.Collections; using System.Diagnostics; internal enum MathOperator { None, Plus, Minus, Div, Multiply, Mod, Negate } internal class MathOpcode : Opcode { MathOperator mathOp; internal MathOpcode(OpcodeID id, MathOperator op) : base(id) { this.mathOp = op; } internal override bool Equals(Opcode op) { if (base.Equals(op)) { return (this.mathOp == ((MathOpcode) op).mathOp); } return false; } #if DEBUG_FILTER public override string ToString() { return string.Format("{0} {1}", base.ToString(), this.mathOp.ToString()); } #endif } internal class PlusOpcode : MathOpcode { internal PlusOpcode() : base(OpcodeID.Plus, MathOperator.Plus) { } internal override Opcode Eval(ProcessingContext context) { StackFrame argX = context.TopArg; StackFrame argY = context.SecondArg; DiagnosticUtility.DebugAssert(argX.Count == argY.Count, ""); Value[] values = context.Values; for (int x = argX.basePtr, y = argY.basePtr; x <= argX.endPtr; ++x, ++y) { DiagnosticUtility.DebugAssert(values[x].IsType(ValueDataType.Double), ""); DiagnosticUtility.DebugAssert(values[y].IsType(ValueDataType.Double), ""); values[y].Add(values[x].Double); } context.PopFrame(); return this.next; } } internal class MinusOpcode : MathOpcode { internal MinusOpcode() : base(OpcodeID.Minus, MathOperator.Minus) { } internal override Opcode Eval(ProcessingContext context) { StackFrame argX = context.TopArg; StackFrame argY = context.SecondArg; DiagnosticUtility.DebugAssert(argX.Count == argY.Count, ""); Value[] values = context.Values; for (int x = argX.basePtr, y = argY.basePtr; x <= argX.endPtr; ++x, ++y) { DiagnosticUtility.DebugAssert(values[x].IsType(ValueDataType.Double), ""); DiagnosticUtility.DebugAssert(values[y].IsType(ValueDataType.Double), ""); values[y].Double = values[x].Double - values[y].Double; } context.PopFrame(); return this.next; } } internal class MultiplyOpcode : MathOpcode { internal MultiplyOpcode() : base(OpcodeID.Multiply, MathOperator.Multiply) { } internal override Opcode Eval(ProcessingContext context) { StackFrame argX = context.TopArg; StackFrame argY = context.SecondArg; DiagnosticUtility.DebugAssert(argX.Count == argY.Count, ""); Value[] values = context.Values; for (int x = argX.basePtr, y = argY.basePtr; x <= argX.endPtr; ++x, ++y) { DiagnosticUtility.DebugAssert(values[x].IsType(ValueDataType.Double), ""); DiagnosticUtility.DebugAssert(values[y].IsType(ValueDataType.Double), ""); values[y].Multiply(values[x].Double); } context.PopFrame(); return this.next; } } internal class DivideOpcode : MathOpcode { internal DivideOpcode() : base(OpcodeID.Divide, MathOperator.Div) { } internal override Opcode Eval(ProcessingContext context) { StackFrame argX = context.TopArg; StackFrame argY = context.SecondArg; DiagnosticUtility.DebugAssert(argX.Count == argY.Count, ""); Value[] values = context.Values; for (int x = argX.basePtr, y = argY.basePtr; x <= argX.endPtr; ++x, ++y) { DiagnosticUtility.DebugAssert(values[x].IsType(ValueDataType.Double), ""); DiagnosticUtility.DebugAssert(values[y].IsType(ValueDataType.Double), ""); values[y].Double = values[x].Double / values[y].Double; } context.PopFrame(); return this.next; } } internal class ModulusOpcode : MathOpcode { internal ModulusOpcode() : base(OpcodeID.Mod, MathOperator.Mod) { } internal override Opcode Eval(ProcessingContext context) { StackFrame argX = context.TopArg; StackFrame argY = context.SecondArg; Value[] values = context.Values; DiagnosticUtility.DebugAssert(argX.Count == argY.Count, ""); for (int x = argX.basePtr, y = argY.basePtr; x <= argX.endPtr; ++x, ++y) { DiagnosticUtility.DebugAssert(values[x].IsType(ValueDataType.Double), ""); DiagnosticUtility.DebugAssert(values[y].IsType(ValueDataType.Double), ""); values[y].Double = values[x].Double % values[y].Double; } context.PopFrame(); return this.next; } } internal class NegateOpcode : MathOpcode { internal NegateOpcode() : base(OpcodeID.Negate, MathOperator.Negate) { } internal override Opcode Eval(ProcessingContext context) { StackFrame frame = context.TopArg; Value[] values = context.Values; for (int i = frame.basePtr; i <= frame.endPtr; ++i) { values[i].Negate(); } 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
- ConfigurationLocation.cs
- DataGridViewUtilities.cs
- DispatcherHooks.cs
- ChtmlTextWriter.cs
- JavascriptCallbackResponseProperty.cs
- securitymgrsite.cs
- CursorConverter.cs
- ToolbarAUtomationPeer.cs
- StrokeCollection2.cs
- HandlerFactoryWrapper.cs
- XmlWrappingReader.cs
- TextRenderer.cs
- SchemaDeclBase.cs
- MatrixTransform3D.cs
- RelatedImageListAttribute.cs
- SafeReadContext.cs
- GcSettings.cs
- SimpleBitVector32.cs
- CatalogPartChrome.cs
- TrimSurroundingWhitespaceAttribute.cs
- CapabilitiesPattern.cs
- DrawingContextDrawingContextWalker.cs
- LockCookie.cs
- AuthenticatingEventArgs.cs
- ToolZone.cs
- PlaceHolder.cs
- StronglyTypedResourceBuilder.cs
- TextOptionsInternal.cs
- FieldBuilder.cs
- EntityDesignerUtils.cs
- EventPropertyMap.cs
- DocumentPaginator.cs
- SpinLock.cs
- DataBinder.cs
- ParameterRetriever.cs
- Peer.cs
- MeshGeometry3D.cs
- ModelPerspective.cs
- OperationCanceledException.cs
- WebPart.cs
- ContainerControl.cs
- InvalidAsynchronousStateException.cs
- ColumnCollection.cs
- CommandHelpers.cs
- BufferedReadStream.cs
- DrawingGroup.cs
- NativeCppClassAttribute.cs
- StorageMappingFragment.cs
- _CacheStreams.cs
- FileDialog.cs
- OverflowException.cs
- StoreContentChangedEventArgs.cs
- KnownAssemblyEntry.cs
- EntityDataSourceDesigner.cs
- DeploymentSection.cs
- ListItemConverter.cs
- DocumentationServerProtocol.cs
- InternalEnumValidatorAttribute.cs
- IResourceProvider.cs
- Add.cs
- ColorPalette.cs
- MediaScriptCommandRoutedEventArgs.cs
- Rule.cs
- OLEDB_Enum.cs
- WorkflowIdleElement.cs
- BuildProvider.cs
- AnnotationComponentChooser.cs
- SystemInformation.cs
- SqlCaseSimplifier.cs
- FileEnumerator.cs
- DriveNotFoundException.cs
- CompiledScopeCriteria.cs
- ForEachAction.cs
- SmtpNetworkElement.cs
- WindowsAuthenticationEventArgs.cs
- RuleSettingsCollection.cs
- ConnectionManagementSection.cs
- AttachedPropertyBrowsableForChildrenAttribute.cs
- WorkflowApplicationUnloadedException.cs
- NativeRecognizer.cs
- XmlSchemaGroup.cs
- BasicDesignerLoader.cs
- MasterPageParser.cs
- Delay.cs
- RequiredFieldValidator.cs
- XmlnsDefinitionAttribute.cs
- FeatureSupport.cs
- TextBounds.cs
- ResourceSet.cs
- Frame.cs
- ImageFormat.cs
- entityreference_tresulttype.cs
- XmlHierarchicalDataSourceView.cs
- ClipboardProcessor.cs
- ProgressBarBrushConverter.cs
- TimerEventSubscription.cs
- Clipboard.cs
- QuaternionValueSerializer.cs
- WindowsGraphicsWrapper.cs
- MailDefinitionBodyFileNameEditor.cs