Code:
/ DotNET / DotNET / 8.0 / untmp / whidbey / REDBITS / 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.
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- FileSystemEnumerable.cs
- MappedMetaModel.cs
- basevalidator.cs
- DecoderBestFitFallback.cs
- StoryFragments.cs
- PointAnimationClockResource.cs
- XmlCDATASection.cs
- DictionaryKeyPropertyAttribute.cs
- WebPartDeleteVerb.cs
- CollectionView.cs
- Matrix.cs
- JavascriptCallbackBehaviorAttribute.cs
- CommandTreeTypeHelper.cs
- Region.cs
- CallTemplateAction.cs
- InstanceDataCollection.cs
- ActiveXContainer.cs
- COM2ExtendedTypeConverter.cs
- OdbcRowUpdatingEvent.cs
- XmlWrappingWriter.cs
- TableRowGroup.cs
- ExpressionBuilderCollection.cs
- ListViewInsertionMark.cs
- XmlCompatibilityReader.cs
- XmlSchemaAny.cs
- DataGridView.cs
- EventDescriptorCollection.cs
- CompositionDesigner.cs
- OleDragDropHandler.cs
- FlowDecisionDesigner.xaml.cs
- NamespaceMapping.cs
- HtmlInputRadioButton.cs
- FormViewUpdatedEventArgs.cs
- SimpleTextLine.cs
- BulletedListEventArgs.cs
- SqlCharStream.cs
- DataGridViewCellStateChangedEventArgs.cs
- WebPartEditorApplyVerb.cs
- DataGridViewComboBoxEditingControl.cs
- TraceSource.cs
- XmlQueryCardinality.cs
- PropertiesTab.cs
- MediaContext.cs
- CollectionViewGroup.cs
- DateTimeFormatInfo.cs
- XDeferredAxisSource.cs
- ImplicitInputBrush.cs
- uribuilder.cs
- Converter.cs
- SingleAnimation.cs
- SimpleBitVector32.cs
- BuildManagerHost.cs
- XPathNavigator.cs
- PersonalizationStateQuery.cs
- ToggleButtonAutomationPeer.cs
- _ListenerAsyncResult.cs
- SiteMapDataSource.cs
- ResizeBehavior.cs
- XPathArrayIterator.cs
- SqlUserDefinedTypeAttribute.cs
- EntityFrameworkVersions.cs
- NetMsmqSecurityElement.cs
- JsonDeserializer.cs
- CopyCodeAction.cs
- ParameterBinding.cs
- XmlUtilWriter.cs
- StateMachineWorkflowInstance.cs
- XmlSchema.cs
- VectorKeyFrameCollection.cs
- MatchingStyle.cs
- RepeatInfo.cs
- BamlTreeMap.cs
- DateTimePicker.cs
- TagPrefixCollection.cs
- UnsafeNativeMethods.cs
- FixedDocumentPaginator.cs
- OdbcCommandBuilder.cs
- QueryAsyncResult.cs
- odbcmetadatacollectionnames.cs
- WebPartConnectionsCancelVerb.cs
- SignatureToken.cs
- SQLGuid.cs
- StructuredTypeInfo.cs
- PeerCollaborationPermission.cs
- Perspective.cs
- MenuEventArgs.cs
- FormView.cs
- DataServiceHostFactory.cs
- PointAnimationBase.cs
- PropertyDescriptorCollection.cs
- InvalidPropValue.cs
- Path.cs
- HttpContext.cs
- MultipleViewProviderWrapper.cs
- BehaviorEditorPart.cs
- SoapDocumentMethodAttribute.cs
- DXD.cs
- x509utils.cs
- precedingquery.cs
- CodeIdentifiers.cs