Code:
/ Dotnetfx_Vista_SP2 / Dotnetfx_Vista_SP2 / 8.0.50727.4016 / DEVDIV / depot / DevDiv / releases / Orcas / QFE / ndp / fx / src / DataEntity / System / Data / Common / Utils / Boolean / Literal.cs / 2 / Literal.cs
//----------------------------------------------------------------------
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
//
// @owner [....]
// @backupOwner [....]
//---------------------------------------------------------------------
using System;
using System.Collections.Generic;
using System.Text;
using System.Globalization;
using System.Collections.ObjectModel;
using System.Diagnostics;
namespace System.Data.Common.Utils.Boolean
{
///
/// Represents a literal in a normal form expression of the form:
///
/// Term
///
/// or
///
/// !Term
///
///
internal sealed class Literal : NormalFormNode,
IEquatable>
{
private readonly TermExpr _term;
private readonly bool _isTermPositive;
///
/// Initialize a new literal.
///
/// Term
/// Sign of term
internal Literal(TermExpr term, bool isTermPositive)
: base(isTermPositive ? (BoolExpr)term : (BoolExpr)new NotExpr(term))
{
Debug.Assert(null != term);
_term = term;
_isTermPositive = isTermPositive;
}
///
/// Gets literal term.
///
internal TermExpr Term
{
get { return _term; }
}
///
/// Gets sign of term.
///
internal bool IsTermPositive
{
get { return _isTermPositive; }
}
///
/// Creates a negated version of this literal.
///
/// !this
internal Literal MakeNegated()
{
return IdentifierService.Instance.NegateLiteral(this);
}
public override string ToString()
{
return StringUtil.FormatInvariant("{0}{1}",
_isTermPositive ? String.Empty : "!",
_term);
}
public override bool Equals(object obj)
{
Debug.Fail("use typed Equals");
return Equals(obj as Literal);
}
public bool Equals(Literal other)
{
return null != other &&
other._isTermPositive == _isTermPositive &&
other._term.Equals(_term);
}
public override int GetHashCode()
{
return _term.GetHashCode();
}
}
}
// File provided for Reference Use Only by Microsoft Corporation (c) 2007.
//----------------------------------------------------------------------
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
//
// @owner [....]
// @backupOwner [....]
//---------------------------------------------------------------------
using System;
using System.Collections.Generic;
using System.Text;
using System.Globalization;
using System.Collections.ObjectModel;
using System.Diagnostics;
namespace System.Data.Common.Utils.Boolean
{
///
/// Represents a literal in a normal form expression of the form:
///
/// Term
///
/// or
///
/// !Term
///
///
internal sealed class Literal : NormalFormNode,
IEquatable>
{
private readonly TermExpr _term;
private readonly bool _isTermPositive;
///
/// Initialize a new literal.
///
/// Term
/// Sign of term
internal Literal(TermExpr term, bool isTermPositive)
: base(isTermPositive ? (BoolExpr)term : (BoolExpr)new NotExpr(term))
{
Debug.Assert(null != term);
_term = term;
_isTermPositive = isTermPositive;
}
///
/// Gets literal term.
///
internal TermExpr Term
{
get { return _term; }
}
///
/// Gets sign of term.
///
internal bool IsTermPositive
{
get { return _isTermPositive; }
}
///
/// Creates a negated version of this literal.
///
/// !this
internal Literal MakeNegated()
{
return IdentifierService.Instance.NegateLiteral(this);
}
public override string ToString()
{
return StringUtil.FormatInvariant("{0}{1}",
_isTermPositive ? String.Empty : "!",
_term);
}
public override bool Equals(object obj)
{
Debug.Fail("use typed Equals");
return Equals(obj as Literal);
}
public bool Equals(Literal other)
{
return null != other &&
other._isTermPositive == _isTermPositive &&
other._term.Equals(_term);
}
public override int GetHashCode()
{
return _term.GetHashCode();
}
}
}
// 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
- Html32TextWriter.cs
- followingquery.cs
- CallbackDebugBehavior.cs
- DataGridTextBoxColumn.cs
- UniformGrid.cs
- SessionStateModule.cs
- GreenMethods.cs
- NamedServiceModelExtensionCollectionElement.cs
- NetworkInterface.cs
- Pointer.cs
- WinFormsComponentEditor.cs
- FloaterBaseParagraph.cs
- SafeTimerHandle.cs
- ByteStreamGeometryContext.cs
- infer.cs
- DataGridViewRowsRemovedEventArgs.cs
- Events.cs
- WorkflowViewService.cs
- DataGridViewElement.cs
- WebFaultException.cs
- VisualBrush.cs
- LineVisual.cs
- Control.cs
- ProcessHostMapPath.cs
- TrackingMemoryStreamFactory.cs
- ReferenceSchema.cs
- DataBindingExpressionBuilder.cs
- Quaternion.cs
- BinaryFormatter.cs
- thaishape.cs
- CoTaskMemSafeHandle.cs
- DesignerForm.cs
- SpotLight.cs
- EntityCommand.cs
- AudioException.cs
- ErrorFormatter.cs
- DynamicUpdateCommand.cs
- FtpWebResponse.cs
- Matrix3DConverter.cs
- HtmlControl.cs
- XmlNamedNodeMap.cs
- HtmlTextArea.cs
- XmlPreloadedResolver.cs
- ContentPlaceHolder.cs
- SoapException.cs
- AnimationStorage.cs
- ComboBoxRenderer.cs
- path.cs
- AlternationConverter.cs
- Pair.cs
- PartialArray.cs
- ConfigXmlComment.cs
- CodeGen.cs
- TextBounds.cs
- ILGenerator.cs
- ClientSettingsSection.cs
- AdapterDictionary.cs
- WebPartVerbCollection.cs
- SqlCommandSet.cs
- StylesEditorDialog.cs
- UpdateCommand.cs
- OdbcConnectionOpen.cs
- SystemInfo.cs
- TypeDependencyAttribute.cs
- CommonDialog.cs
- ScriptControlManager.cs
- SchemaContext.cs
- dataprotectionpermission.cs
- DocumentPageView.cs
- FileSystemEventArgs.cs
- EntityConnectionStringBuilder.cs
- CrossSiteScriptingValidation.cs
- TypedAsyncResult.cs
- StorageRoot.cs
- ManualResetEvent.cs
- LicenseContext.cs
- XmlDataSourceView.cs
- GeneralTransform.cs
- GregorianCalendarHelper.cs
- DoubleKeyFrameCollection.cs
- ScaleTransform.cs
- CacheAxisQuery.cs
- ParseChildrenAsPropertiesAttribute.cs
- UshortList2.cs
- SimpleLine.cs
- PackagingUtilities.cs
- XsltSettings.cs
- TreeViewDataItemAutomationPeer.cs
- XmlEntityReference.cs
- ArcSegment.cs
- VBCodeProvider.cs
- MultipleViewProviderWrapper.cs
- TypeListConverter.cs
- HttpResponseInternalWrapper.cs
- CompoundFileStorageReference.cs
- EasingFunctionBase.cs
- DecimalStorage.cs
- TextTreeFixupNode.cs
- Timeline.cs
- DbReferenceCollection.cs