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
- ParameterCollectionEditor.cs
- SerializationBinder.cs
- ScriptDescriptor.cs
- ChtmlTextWriter.cs
- SmtpSpecifiedPickupDirectoryElement.cs
- ZipArchive.cs
- SRDisplayNameAttribute.cs
- ConnectionStringSettings.cs
- CapabilitiesSection.cs
- SqlDataSourceStatusEventArgs.cs
- MinMaxParagraphWidth.cs
- RolePrincipal.cs
- LicFileLicenseProvider.cs
- SingleAnimationBase.cs
- KeyGestureValueSerializer.cs
- WindowsFormsHost.cs
- PerformanceCounterNameAttribute.cs
- AuthorizationRule.cs
- DataProtection.cs
- GroupQuery.cs
- SqlFileStream.cs
- DispatcherObject.cs
- TraceData.cs
- MatrixAnimationUsingPath.cs
- WindowsRebar.cs
- AutoResizedEvent.cs
- MemberRestriction.cs
- QuerySubExprEliminator.cs
- TypeSystemHelpers.cs
- DataGridViewComboBoxCell.cs
- Thumb.cs
- WebPartConnectionsCloseVerb.cs
- ToolStripDropTargetManager.cs
- TableLayoutPanelCellPosition.cs
- AssemblyResourceLoader.cs
- TrustVersion.cs
- AnimationException.cs
- ReferenceService.cs
- LiteralSubsegment.cs
- TextEditorTables.cs
- Enum.cs
- MenuEventArgs.cs
- TextModifier.cs
- XsdDataContractImporter.cs
- DataContractSerializer.cs
- XmlSchemaSubstitutionGroup.cs
- Debug.cs
- UnmanagedBitmapWrapper.cs
- IntSecurity.cs
- PrimitiveOperationFormatter.cs
- DataGridViewUtilities.cs
- BitmapMetadata.cs
- PieceNameHelper.cs
- EntityDataSourceWrapper.cs
- MobileCategoryAttribute.cs
- UnsafePeerToPeerMethods.cs
- GPStream.cs
- TemplateBaseAction.cs
- WebConfigurationManager.cs
- Queue.cs
- TextRangeAdaptor.cs
- EncodingNLS.cs
- DropShadowBitmapEffect.cs
- SoapHelper.cs
- ObjectTypeMapping.cs
- HandleCollector.cs
- CommonProperties.cs
- NavigationPropertySingletonExpression.cs
- cookie.cs
- WebResourceAttribute.cs
- RuntimeConfigurationRecord.cs
- InternalConfigConfigurationFactory.cs
- SystemIPv4InterfaceProperties.cs
- WebPartHeaderCloseVerb.cs
- InputLangChangeRequestEvent.cs
- _NegotiateClient.cs
- XmlDocumentFieldSchema.cs
- CompiledAction.cs
- BindingOperations.cs
- ProviderSettings.cs
- AuthorizationRule.cs
- FlowDocumentPage.cs
- Paragraph.cs
- ChannelDispatcher.cs
- UserControlParser.cs
- CodeTypeConstructor.cs
- CollectionCodeDomSerializer.cs
- CollectionBuilder.cs
- SelectionPatternIdentifiers.cs
- TokenBasedSet.cs
- ADMembershipProvider.cs
- IMembershipProvider.cs
- BasicCellRelation.cs
- PenLineJoinValidation.cs
- SignatureResourcePool.cs
- HttpResponseHeader.cs
- TreeNode.cs
- WebPartDescription.cs
- EventDescriptor.cs
- CodeTypeParameter.cs