Code:
/ Dotnetfx_Vista_SP2 / Dotnetfx_Vista_SP2 / 8.0.50727.4016 / DEVDIV / depot / DevDiv / releases / whidbey / NetFxQFE / 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
- WebPartManagerInternals.cs
- CqlWriter.cs
- CacheEntry.cs
- ErasingStroke.cs
- InteropTrackingRecord.cs
- XmlReflectionMember.cs
- TableRowGroup.cs
- DrawItemEvent.cs
- InternalRelationshipCollection.cs
- HtmlButton.cs
- WebRequest.cs
- ListBindableAttribute.cs
- UnsafeNetInfoNativeMethods.cs
- ToolboxCategoryItems.cs
- VersionedStream.cs
- BufferModesCollection.cs
- ChineseLunisolarCalendar.cs
- Attachment.cs
- Point3DAnimation.cs
- OleDbFactory.cs
- Line.cs
- entityreference_tresulttype.cs
- MasterPage.cs
- TextBoxAutomationPeer.cs
- VisualBasicSettingsHandler.cs
- XmlSchemaSimpleTypeList.cs
- FontConverter.cs
- RelationalExpressions.cs
- X509Extension.cs
- ServiceOperation.cs
- NameValueFileSectionHandler.cs
- XPathNodeIterator.cs
- XmlTextEncoder.cs
- FileCodeGroup.cs
- ByteConverter.cs
- ChildChangedEventArgs.cs
- AnnotationComponentManager.cs
- XmlHierarchyData.cs
- NativeMethodsOther.cs
- CodeAttachEventStatement.cs
- IconBitmapDecoder.cs
- EpmContentDeSerializerBase.cs
- FileDialog_Vista_Interop.cs
- StringBuilder.cs
- ApplicationId.cs
- ComplexBindingPropertiesAttribute.cs
- CustomPopupPlacement.cs
- WebServiceMethodData.cs
- CompatibleIComparer.cs
- TextRenderer.cs
- WorkflowDispatchContext.cs
- QueryStatement.cs
- CategoryAttribute.cs
- ComponentFactoryHelpers.cs
- DetailsViewUpdateEventArgs.cs
- CodeMemberMethod.cs
- Deflater.cs
- WindowAutomationPeer.cs
- ToolStripItemRenderEventArgs.cs
- LicenseException.cs
- HttpHeaderCollection.cs
- ExceptionHandlersDesigner.cs
- StorageMappingFragment.cs
- StaticResourceExtension.cs
- PolicyAssertionCollection.cs
- CompressedStack.cs
- ScrollBarRenderer.cs
- adornercollection.cs
- SqlClientWrapperSmiStream.cs
- BypassElementCollection.cs
- BufferedReadStream.cs
- remotingproxy.cs
- SafeNativeMethods.cs
- BaseCollection.cs
- SocketException.cs
- HashHelpers.cs
- Size3D.cs
- WorkflowQueue.cs
- DefaultSerializationProviderAttribute.cs
- _Semaphore.cs
- InternalsVisibleToAttribute.cs
- Assert.cs
- ServicePointManagerElement.cs
- ContactManager.cs
- ToolStripItemImageRenderEventArgs.cs
- TypefaceCollection.cs
- DateTimeHelper.cs
- CircleHotSpot.cs
- ObjectSet.cs
- Rss20FeedFormatter.cs
- shaperfactoryquerycachekey.cs
- followingsibling.cs
- StagingAreaInputItem.cs
- EventLogPermissionEntryCollection.cs
- CalendarTable.cs
- ProfileGroupSettings.cs
- LicFileLicenseProvider.cs
- VBIdentifierName.cs
- TextTreeRootTextBlock.cs
- SynchronousChannelMergeEnumerator.cs