Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / fx / src / Xml / System / Xml / XPath / Internal / BooleanExpr.cs / 1305376 / 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
- Column.cs
- CalendarBlackoutDatesCollection.cs
- TextRange.cs
- XPathAncestorQuery.cs
- embossbitmapeffect.cs
- BitmapEffectrendercontext.cs
- OutOfProcStateClientManager.cs
- EmptyReadOnlyDictionaryInternal.cs
- KnownBoxes.cs
- SiteMapDataSource.cs
- Floater.cs
- XmlAnyElementAttribute.cs
- PropertyNames.cs
- SoapSchemaExporter.cs
- SystemColors.cs
- Relationship.cs
- DocumentGridPage.cs
- DataGridViewCellParsingEventArgs.cs
- BufferedGraphicsContext.cs
- ContractsBCL.cs
- InsufficientMemoryException.cs
- TripleDES.cs
- PopupEventArgs.cs
- OutputCacheSection.cs
- DefaultHttpHandler.cs
- TraceEventCache.cs
- TextSearch.cs
- TransformerInfoCollection.cs
- SmiContextFactory.cs
- ToolboxDataAttribute.cs
- InstanceView.cs
- FormatConvertedBitmap.cs
- ChannelBinding.cs
- QueryStringParameter.cs
- ListViewInsertionMark.cs
- GridViewSelectEventArgs.cs
- FixedSOMTableCell.cs
- PenThreadWorker.cs
- CollectionContainer.cs
- Pkcs7Signer.cs
- XmlObjectSerializerReadContextComplexJson.cs
- DataControlCommands.cs
- GridItemPattern.cs
- Line.cs
- CfgParser.cs
- NamespaceCollection.cs
- SymbolPair.cs
- ErasingStroke.cs
- JoinElimination.cs
- DataRowComparer.cs
- SortedDictionary.cs
- Brushes.cs
- UnicastIPAddressInformationCollection.cs
- EntityModelSchemaGenerator.cs
- EDesignUtil.cs
- ValueCollectionParameterReader.cs
- ClrPerspective.cs
- metadatamappinghashervisitor.cs
- UnicastIPAddressInformationCollection.cs
- ProfilePropertySettings.cs
- CompressStream.cs
- MouseButtonEventArgs.cs
- WhitespaceRuleReader.cs
- KeyGesture.cs
- InputScope.cs
- ThreadNeutralSemaphore.cs
- PeerTransportSecurityElement.cs
- WindowsHyperlink.cs
- RequestSecurityTokenForRemoteTokenFactory.cs
- RuntimeVariablesExpression.cs
- InputScopeConverter.cs
- EntityDataSourceEntityTypeFilterItem.cs
- LogSwitch.cs
- OneOfScalarConst.cs
- nulltextcontainer.cs
- RtType.cs
- LocatorPartList.cs
- ClientType.cs
- NativeMethods.cs
- VersionedStreamOwner.cs
- XmlTextAttribute.cs
- __FastResourceComparer.cs
- AspNetPartialTrustHelpers.cs
- XamlToRtfWriter.cs
- AppendHelper.cs
- CurrentChangingEventManager.cs
- ScriptingRoleServiceSection.cs
- DataSourceXmlTextReader.cs
- MailAddressCollection.cs
- SrgsToken.cs
- HttpResponseHeader.cs
- KnownTypeAttribute.cs
- ClipboardData.cs
- ConfigXmlCDataSection.cs
- BitmapEffectInput.cs
- SafeUserTokenHandle.cs
- ObjectDataSourceMethodEventArgs.cs
- AppSecurityManager.cs
- ProxyGenerator.cs
- DiagnosticTraceSource.cs