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
- GacUtil.cs
- DataContractSerializerSection.cs
- SuppressIldasmAttribute.cs
- MonthChangedEventArgs.cs
- ContainsSearchOperator.cs
- SafeNativeMethods.cs
- XmlTextWriter.cs
- JournalEntryListConverter.cs
- AffineTransform3D.cs
- _ShellExpression.cs
- PathFigure.cs
- Quaternion.cs
- DataGridViewRowHeightInfoPushedEventArgs.cs
- BezierSegment.cs
- WebMessageBodyStyleHelper.cs
- Win32Interop.cs
- AppSettings.cs
- ModelEditingScope.cs
- RectangleF.cs
- AxisAngleRotation3D.cs
- EnvelopedPkcs7.cs
- TraceUtils.cs
- DataAdapter.cs
- SettingsProperty.cs
- UnaryQueryOperator.cs
- CodeTypeReferenceExpression.cs
- Pts.cs
- BoolExpressionVisitors.cs
- ImageDrawing.cs
- RevocationPoint.cs
- HelpInfo.cs
- WebPartDisplayMode.cs
- TimeSpanFormat.cs
- GenerateTemporaryTargetAssembly.cs
- FreezableCollection.cs
- ToolStripPanelDesigner.cs
- Unit.cs
- Keyboard.cs
- StoreItemCollection.Loader.cs
- TextEditorSpelling.cs
- ToolStripDesignerAvailabilityAttribute.cs
- WindowsGraphics2.cs
- VerticalAlignConverter.cs
- HandlerBase.cs
- XhtmlBasicLiteralTextAdapter.cs
- ManualResetEvent.cs
- Listen.cs
- RequestResizeEvent.cs
- IndexerNameAttribute.cs
- FormsAuthenticationUserCollection.cs
- EncodingDataItem.cs
- PanelStyle.cs
- TextEditorCharacters.cs
- ProcessModelInfo.cs
- SQLInt64Storage.cs
- DbProviderFactories.cs
- SQLBoolean.cs
- ConstrainedDataObject.cs
- MaskDescriptors.cs
- NamespaceInfo.cs
- _UncName.cs
- ReadOnlyTernaryTree.cs
- AtlasWeb.Designer.cs
- TypeSystem.cs
- PersonalizablePropertyEntry.cs
- StructuredTypeEmitter.cs
- DSASignatureFormatter.cs
- httpapplicationstate.cs
- DocumentApplicationJournalEntry.cs
- Update.cs
- DesignerAutoFormatStyle.cs
- DoubleAnimationBase.cs
- Int64Storage.cs
- ExecutionProperties.cs
- FunctionParameter.cs
- ElementFactory.cs
- StylusPointPropertyInfoDefaults.cs
- CriticalExceptions.cs
- DataGridViewSelectedRowCollection.cs
- SequentialOutput.cs
- Bookmark.cs
- AutomationIdentifier.cs
- GACMembershipCondition.cs
- WebControlAdapter.cs
- Point3DAnimation.cs
- CheckBox.cs
- DataGridViewLinkColumn.cs
- DeviceContext.cs
- PolicyStatement.cs
- DataSetMappper.cs
- HtmlInputRadioButton.cs
- WizardStepBase.cs
- messageonlyhwndwrapper.cs
- XmlAttribute.cs
- NumberSubstitution.cs
- DWriteFactory.cs
- UIServiceHelper.cs
- MarkupExtensionReturnTypeAttribute.cs
- PerfCounterSection.cs
- GetCryptoTransformRequest.cs