Code:
/ Dotnetfx_Win7_3.5.1 / Dotnetfx_Win7_3.5.1 / 3.5.1 / DEVDIV / depot / DevDiv / releases / whidbey / NetFXspW7 / 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
- CompilationUnit.cs
- HtmlLink.cs
- FileDialogCustomPlacesCollection.cs
- WsatAdminException.cs
- EntityUtil.cs
- FunctionImportMapping.cs
- ServiceOperationHelpers.cs
- FormattedText.cs
- sitestring.cs
- ToolstripProfessionalRenderer.cs
- CounterCreationDataCollection.cs
- ProofTokenCryptoHandle.cs
- PathParser.cs
- ForwardPositionQuery.cs
- UInt64.cs
- SvcFileManager.cs
- ApplicationException.cs
- ErrorRuntimeConfig.cs
- securitycriticaldataClass.cs
- Repeater.cs
- WindowsTokenRoleProvider.cs
- PeerNearMe.cs
- ICspAsymmetricAlgorithm.cs
- RegistryExceptionHelper.cs
- LayoutTableCell.cs
- COM2DataTypeToManagedDataTypeConverter.cs
- ErrorRuntimeConfig.cs
- DataColumn.cs
- TextSpan.cs
- IntegerValidatorAttribute.cs
- SqlConnectionString.cs
- UserNameSecurityTokenAuthenticator.cs
- FormatterConverter.cs
- HtmlPhoneCallAdapter.cs
- parserscommon.cs
- RelationshipSet.cs
- SystemWebCachingSectionGroup.cs
- SessionParameter.cs
- ListView.cs
- MsmqIntegrationSecurityElement.cs
- HtmlInputButton.cs
- PropertyEmitterBase.cs
- DataColumnMappingCollection.cs
- LocalIdKeyIdentifierClause.cs
- ECDiffieHellmanPublicKey.cs
- _NestedSingleAsyncResult.cs
- RowCache.cs
- DragDropManager.cs
- XmlQueryOutput.cs
- SymLanguageType.cs
- ListChangedEventArgs.cs
- CodeTypeReferenceExpression.cs
- RegexTree.cs
- RegexCharClass.cs
- NamedPipeChannelFactory.cs
- ObjectStateManagerMetadata.cs
- FileStream.cs
- BinaryMethodMessage.cs
- NotFiniteNumberException.cs
- ParseElementCollection.cs
- WindowsPrincipal.cs
- PeerNameRecordCollection.cs
- RepeatInfo.cs
- ValueOfAction.cs
- TextFormatterImp.cs
- _AcceptOverlappedAsyncResult.cs
- infer.cs
- GeometryCombineModeValidation.cs
- PersonalizableAttribute.cs
- DisplayMemberTemplateSelector.cs
- StrokeNodeOperations.cs
- CodeDomLocalizationProvider.cs
- ToggleButton.cs
- TextEndOfParagraph.cs
- TraceRecord.cs
- Object.cs
- CompareInfo.cs
- MemberInfoSerializationHolder.cs
- SafeFileMapViewHandle.cs
- WebPartAddingEventArgs.cs
- Soap.cs
- datacache.cs
- GPPOINT.cs
- metadatamappinghashervisitor.hashsourcebuilder.cs
- ListControlConvertEventArgs.cs
- Hashtable.cs
- DesignTimeVisibleAttribute.cs
- SelectingProviderEventArgs.cs
- PropagatorResult.cs
- ReceiveSecurityHeaderElementManager.cs
- WizardForm.cs
- PinnedBufferMemoryStream.cs
- EncoderReplacementFallback.cs
- MissingFieldException.cs
- DynamicQueryableWrapper.cs
- AnnouncementSendsAsyncResult.cs
- XComponentModel.cs
- OdbcConnectionFactory.cs
- RawStylusInputCustomData.cs
- DataGridViewCellStateChangedEventArgs.cs