Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / fx / src / DataEntity / System / Data / Common / Utils / Boolean / Literal.cs / 1305376 / 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
- DataGridViewRowHeaderCell.cs
- QuaternionAnimationUsingKeyFrames.cs
- SecurityProtocolCorrelationState.cs
- Scene3D.cs
- HuffModule.cs
- FunctionDefinition.cs
- SortedSetDebugView.cs
- FormatStringEditor.cs
- ExpressionEditorAttribute.cs
- HttpListenerContext.cs
- Expressions.cs
- XsdCachingReader.cs
- XdrBuilder.cs
- RNGCryptoServiceProvider.cs
- TypeTypeConverter.cs
- EventWaitHandleSecurity.cs
- XPathNodeList.cs
- GlyphCache.cs
- SignedInfo.cs
- TrackingLocationCollection.cs
- WebPartConnectionsEventArgs.cs
- ViewGenerator.cs
- HwndStylusInputProvider.cs
- WSFederationHttpSecurity.cs
- MetadataCollection.cs
- XmlSchemaSimpleContentExtension.cs
- OdbcConnectionStringbuilder.cs
- WCFBuildProvider.cs
- URLMembershipCondition.cs
- VisualStyleTypesAndProperties.cs
- ToolStripItemRenderEventArgs.cs
- TrustLevel.cs
- ToolStripRenderEventArgs.cs
- DataGridViewCellMouseEventArgs.cs
- State.cs
- PageMediaType.cs
- HeaderCollection.cs
- RepeaterItem.cs
- ProcessProtocolHandler.cs
- OleDbDataReader.cs
- TableLayoutPanelDesigner.cs
- TextTreeFixupNode.cs
- ApplicationCommands.cs
- AssociatedControlConverter.cs
- GridViewAutoFormat.cs
- PolyLineSegment.cs
- __Filters.cs
- ResourceDescriptionAttribute.cs
- DictionaryEntry.cs
- DbParameterCollection.cs
- Expression.DebuggerProxy.cs
- PreviewControlDesigner.cs
- AsyncResult.cs
- ConfigurationSettings.cs
- Compress.cs
- TextRangeBase.cs
- PeerName.cs
- AppearanceEditorPart.cs
- PropertyGridCommands.cs
- CalendarTable.cs
- GregorianCalendarHelper.cs
- SocketPermission.cs
- MessageBox.cs
- AppModelKnownContentFactory.cs
- TransformerInfo.cs
- OdbcException.cs
- PropertyChangedEventArgs.cs
- TypeDescriptionProviderAttribute.cs
- BindableTemplateBuilder.cs
- PaintValueEventArgs.cs
- XmlSchemaGroupRef.cs
- DispatchProxy.cs
- MdImport.cs
- PointIndependentAnimationStorage.cs
- PagesSection.cs
- XmlDataSourceNodeDescriptor.cs
- XmlDataSourceView.cs
- CredentialManagerDialog.cs
- ManualResetEventSlim.cs
- ProfessionalColors.cs
- MarshalByRefObject.cs
- TimeSpan.cs
- Or.cs
- ProvidersHelper.cs
- ObjectDataSourceView.cs
- WindowClosedEventArgs.cs
- ArithmeticException.cs
- XmlILStorageConverter.cs
- JournalEntryListConverter.cs
- MemberRelationshipService.cs
- CompiledXpathExpr.cs
- RegexCharClass.cs
- AssemblyAttributes.cs
- OracleFactory.cs
- BasicExpressionVisitor.cs
- Padding.cs
- CanonicalFontFamilyReference.cs
- DataControlFieldHeaderCell.cs
- TypedColumnHandler.cs
- CacheSection.cs