Code:
/ Net / Net / 3.5.50727.3053 / DEVDIV / depot / DevDiv / releases / Orcas / SP / 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
- InputProcessorProfiles.cs
- SqlCrossApplyToCrossJoin.cs
- XamlTypeMapper.cs
- assemblycache.cs
- ListViewDeletedEventArgs.cs
- XmlHierarchicalEnumerable.cs
- SynchronizationHandlesCodeDomSerializer.cs
- WebPartTracker.cs
- XmlValueConverter.cs
- AppDomainResourcePerfCounters.cs
- ISessionStateStore.cs
- AccessDataSourceView.cs
- SqlAliaser.cs
- SHA512Managed.cs
- ClientBuildManagerCallback.cs
- ProfileBuildProvider.cs
- WinFormsComponentEditor.cs
- CookielessHelper.cs
- LazyTextWriterCreator.cs
- DesignerPerfEventProvider.cs
- NativeCppClassAttribute.cs
- EncoderReplacementFallback.cs
- ImageMetadata.cs
- arc.cs
- HitTestResult.cs
- Comparer.cs
- OdbcRowUpdatingEvent.cs
- LicenseManager.cs
- SerializerProvider.cs
- NumberSubstitution.cs
- TextDpi.cs
- SessionSwitchEventArgs.cs
- RegionInfo.cs
- TextEditorMouse.cs
- DataContext.cs
- ListDictionaryInternal.cs
- ArraySortHelper.cs
- RecognitionEventArgs.cs
- DbConnectionPoolGroupProviderInfo.cs
- DependencyObjectType.cs
- DataGridViewCellMouseEventArgs.cs
- ConnectionPoolManager.cs
- ArcSegment.cs
- BuildProvider.cs
- CollectionContainer.cs
- RSAPKCS1KeyExchangeDeformatter.cs
- EventMap.cs
- StronglyTypedResourceBuilder.cs
- PointKeyFrameCollection.cs
- NumberAction.cs
- ContentElement.cs
- HandleCollector.cs
- StackBuilderSink.cs
- SiteIdentityPermission.cs
- ListViewItem.cs
- SQLDecimal.cs
- WebPartVerbsEventArgs.cs
- DiffuseMaterial.cs
- TextStore.cs
- JournalNavigationScope.cs
- SourceFileBuildProvider.cs
- FullTextLine.cs
- DelegateHelpers.Generated.cs
- CapiSymmetricAlgorithm.cs
- Geometry3D.cs
- ExpandSegmentCollection.cs
- HttpInputStream.cs
- OutputCacheProfile.cs
- GcHandle.cs
- EdmPropertyAttribute.cs
- HighContrastHelper.cs
- CommandValueSerializer.cs
- XmlChildNodes.cs
- BindingCompleteEventArgs.cs
- MemberProjectionIndex.cs
- HtmlControlPersistable.cs
- EventLogger.cs
- UrlPropertyAttribute.cs
- CallbackValidator.cs
- SemaphoreSecurity.cs
- XsltConvert.cs
- FlowDocumentReader.cs
- Walker.cs
- Int16KeyFrameCollection.cs
- mactripleDES.cs
- ScriptRegistrationManager.cs
- EventHandlerList.cs
- ContentPlaceHolder.cs
- VolatileEnlistmentState.cs
- SolidBrush.cs
- QueryContinueDragEvent.cs
- Visual.cs
- UInt32Converter.cs
- SoapReflectionImporter.cs
- _Semaphore.cs
- DataTableNewRowEvent.cs
- PackageRelationship.cs
- SimpleExpression.cs
- SafeMILHandle.cs
- TextCharacters.cs