Code:
/ Net / Net / 3.5.50727.3053 / DEVDIV / depot / DevDiv / releases / whidbey / netfxsp / ndp / fx / src / Xml / System / Xml / XPath / Internal / BooleanExpr.cs / 1 / BooleanExpr.cs
//------------------------------------------------------------------------------ //// Copyright (c) Microsoft Corporation. All rights reserved. // //[....] //----------------------------------------------------------------------------- namespace MS.Internal.Xml.XPath { using System; using System.Xml; using System.Xml.XPath; using System.Xml.Xsl; using System.Diagnostics; using System.Globalization; internal sealed class BooleanExpr : ValueQuery { private Query opnd1; private Query opnd2; private bool isOr; public BooleanExpr(Operator.Op op, Query opnd1, Query opnd2) { Debug.Assert(op == Operator.Op.AND || op == Operator.Op.OR); Debug.Assert(opnd1 != null && opnd2 != null); if (opnd1.StaticType != XPathResultType.Boolean) { opnd1 = new BooleanFunctions(Function.FunctionType.FuncBoolean, opnd1); } if (opnd2.StaticType != XPathResultType.Boolean) { opnd2 = new BooleanFunctions(Function.FunctionType.FuncBoolean, opnd2); } this.opnd1 = opnd1; this.opnd2 = opnd2; isOr = (op == Operator.Op.OR); } private BooleanExpr(BooleanExpr other) : base(other) { this.opnd1 = Clone(other.opnd1); this.opnd2 = Clone(other.opnd2); this.isOr = other.isOr; } public override void SetXsltContext(XsltContext context){ opnd1.SetXsltContext(context); opnd2.SetXsltContext(context); } public override object Evaluate(XPathNodeIterator nodeIterator) { object n1 = opnd1.Evaluate(nodeIterator); if (((bool) n1) == isOr) { return n1; } return opnd2.Evaluate(nodeIterator); } public override XPathNodeIterator Clone() { return new BooleanExpr(this); } public override XPathResultType StaticType { get { return XPathResultType.Boolean; } } public override void PrintQuery(XmlWriter w) { w.WriteStartElement(this.GetType().Name); w.WriteAttributeString("op", (isOr ? Operator.Op.OR : Operator.Op.AND).ToString()); opnd1.PrintQuery(w); opnd2.PrintQuery(w); w.WriteEndElement(); } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. //------------------------------------------------------------------------------ //// Copyright (c) Microsoft Corporation. All rights reserved. // //[....] //----------------------------------------------------------------------------- namespace MS.Internal.Xml.XPath { using System; using System.Xml; using System.Xml.XPath; using System.Xml.Xsl; using System.Diagnostics; using System.Globalization; internal sealed class BooleanExpr : ValueQuery { private Query opnd1; private Query opnd2; private bool isOr; public BooleanExpr(Operator.Op op, Query opnd1, Query opnd2) { Debug.Assert(op == Operator.Op.AND || op == Operator.Op.OR); Debug.Assert(opnd1 != null && opnd2 != null); if (opnd1.StaticType != XPathResultType.Boolean) { opnd1 = new BooleanFunctions(Function.FunctionType.FuncBoolean, opnd1); } if (opnd2.StaticType != XPathResultType.Boolean) { opnd2 = new BooleanFunctions(Function.FunctionType.FuncBoolean, opnd2); } this.opnd1 = opnd1; this.opnd2 = opnd2; isOr = (op == Operator.Op.OR); } private BooleanExpr(BooleanExpr other) : base(other) { this.opnd1 = Clone(other.opnd1); this.opnd2 = Clone(other.opnd2); this.isOr = other.isOr; } public override void SetXsltContext(XsltContext context){ opnd1.SetXsltContext(context); opnd2.SetXsltContext(context); } public override object Evaluate(XPathNodeIterator nodeIterator) { object n1 = opnd1.Evaluate(nodeIterator); if (((bool) n1) == isOr) { return n1; } return opnd2.Evaluate(nodeIterator); } public override XPathNodeIterator Clone() { return new BooleanExpr(this); } public override XPathResultType StaticType { get { return XPathResultType.Boolean; } } public override void PrintQuery(XmlWriter w) { w.WriteStartElement(this.GetType().Name); w.WriteAttributeString("op", (isOr ? Operator.Op.OR : Operator.Op.AND).ToString()); opnd1.PrintQuery(w); opnd2.PrintQuery(w); w.WriteEndElement(); } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007.
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- ImageList.cs
- EntityDataSourceSelectedEventArgs.cs
- LayoutSettings.cs
- Ray3DHitTestResult.cs
- SerializationException.cs
- ObjectAnimationBase.cs
- Point3D.cs
- StreamResourceInfo.cs
- Error.cs
- MetadataException.cs
- BindingSource.cs
- ComponentSerializationService.cs
- BoundPropertyEntry.cs
- UserControl.cs
- XmlNodeList.cs
- wgx_render.cs
- GraphicsContainer.cs
- AlternateView.cs
- ChannelCacheDefaults.cs
- ConfigurationSectionGroupCollection.cs
- AnonymousIdentificationModule.cs
- MailAddressCollection.cs
- Stream.cs
- DatatypeImplementation.cs
- PostBackOptions.cs
- SwitchLevelAttribute.cs
- NativeMethods.cs
- ManifestSignedXml.cs
- CommentEmitter.cs
- OleDbTransaction.cs
- ImageMetadata.cs
- UnsafeNativeMethods.cs
- WindowsTokenRoleProvider.cs
- FunctionImportElement.cs
- Walker.cs
- CodeCommentStatement.cs
- ProfileService.cs
- QilScopedVisitor.cs
- ValidationHelper.cs
- BehaviorEditorPart.cs
- TableItemPattern.cs
- InputManager.cs
- OutOfProcStateClientManager.cs
- ToolStripItemRenderEventArgs.cs
- Debugger.cs
- SoapFormatter.cs
- SchemaExporter.cs
- FacetChecker.cs
- ReadOnlyObservableCollection.cs
- DataRelation.cs
- TextRange.cs
- SqlDataSourceRefreshSchemaForm.cs
- WebServicesSection.cs
- ResXDataNode.cs
- glyphs.cs
- ClonableStack.cs
- SectionInput.cs
- OleTxTransaction.cs
- MultipleViewProviderWrapper.cs
- VectorCollectionConverter.cs
- WindowsIdentity.cs
- PocoEntityKeyStrategy.cs
- xmlformatgeneratorstatics.cs
- SystemResources.cs
- LinkClickEvent.cs
- WrappedOptions.cs
- PolygonHotSpot.cs
- StylusCollection.cs
- ResourceDictionary.cs
- ProfileModule.cs
- SchemaComplexType.cs
- ControlValuePropertyAttribute.cs
- ResourceWriter.cs
- Comparer.cs
- SessionEndedEventArgs.cs
- SqlInternalConnection.cs
- XmlSchema.cs
- ObjectDataSource.cs
- ContractCodeDomInfo.cs
- LastQueryOperator.cs
- Size3DConverter.cs
- SqlVersion.cs
- ExecutionEngineException.cs
- GroupLabel.cs
- BindingMAnagerBase.cs
- BStrWrapper.cs
- XmlSchemaException.cs
- ClientBuildManager.cs
- DropSource.cs
- VarInfo.cs
- _Events.cs
- SafeProcessHandle.cs
- HtmlElementCollection.cs
- PersistStreamTypeWrapper.cs
- CorrelationKey.cs
- datacache.cs
- ExpressionBuilderContext.cs
- DataGridViewCellConverter.cs
- ContainerVisual.cs
- ButtonBaseAutomationPeer.cs