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
- XsltException.cs
- AppDomainProtocolHandler.cs
- UnionExpr.cs
- StateWorkerRequest.cs
- PermissionAttributes.cs
- ScrollableControlDesigner.cs
- ToolboxItemAttribute.cs
- DataServiceBehavior.cs
- SqlCacheDependency.cs
- SqlGenericUtil.cs
- ComponentEvent.cs
- ImagingCache.cs
- GuidTagList.cs
- CultureInfoConverter.cs
- InitialServerConnectionReader.cs
- UpdateManifestForBrowserApplication.cs
- BaseTemplateCodeDomTreeGenerator.cs
- CheckoutException.cs
- SignatureToken.cs
- IconHelper.cs
- Stroke2.cs
- RuntimeConfig.cs
- EUCJPEncoding.cs
- ResXDataNode.cs
- FontCollection.cs
- ItemsPresenter.cs
- KnownTypes.cs
- CompiledScopeCriteria.cs
- ISFClipboardData.cs
- DataBindingExpressionBuilder.cs
- IProvider.cs
- HelpProvider.cs
- SizeIndependentAnimationStorage.cs
- TemplateControl.cs
- WebUtil.cs
- DataError.cs
- TextRange.cs
- Stack.cs
- SharedPersonalizationStateInfo.cs
- FileCodeGroup.cs
- MTConfigUtil.cs
- MappingSource.cs
- ClickablePoint.cs
- XmlSchemaSimpleTypeRestriction.cs
- ExpandableObjectConverter.cs
- BitVec.cs
- ParsedAttributeCollection.cs
- HttpStaticObjectsCollectionWrapper.cs
- CryptoKeySecurity.cs
- TextServicesDisplayAttributePropertyRanges.cs
- Camera.cs
- xdrvalidator.cs
- SoapFault.cs
- GridViewUpdatedEventArgs.cs
- HttpDebugHandler.cs
- PasswordBox.cs
- WebPartVerb.cs
- AssemblyInfo.cs
- storepermissionattribute.cs
- PrincipalPermissionMode.cs
- log.cs
- IndexedEnumerable.cs
- SortAction.cs
- ConfigurationHandlersInstallComponent.cs
- unsafenativemethodstextservices.cs
- CorrelationService.cs
- RootBrowserWindow.cs
- CollectionView.cs
- DataGridViewCellStateChangedEventArgs.cs
- DataGridView.cs
- ToolStripDropDownItemDesigner.cs
- XmlHelper.cs
- TextRenderingModeValidation.cs
- RenderDataDrawingContext.cs
- EqualityArray.cs
- TimeSpanSecondsConverter.cs
- TabPanel.cs
- OpenFileDialog.cs
- BasicHttpMessageSecurityElement.cs
- SqlFactory.cs
- SortedList.cs
- DbParameterHelper.cs
- DataGridViewRowHeightInfoPushedEventArgs.cs
- CookieProtection.cs
- ListMarkerSourceInfo.cs
- DataServicePagingProviderWrapper.cs
- InkCanvasSelectionAdorner.cs
- InputDevice.cs
- InfoCardKeyedHashAlgorithm.cs
- ProcessModelSection.cs
- OleDbMetaDataFactory.cs
- WebPartTransformerAttribute.cs
- XmlNamespaceManager.cs
- XmlSubtreeReader.cs
- EventManager.cs
- ExpressionsCollectionEditor.cs
- XDRSchema.cs
- UriScheme.cs
- RectAnimationBase.cs
- TextServicesCompartmentEventSink.cs