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
- ContractAdapter.cs
- SmiMetaDataProperty.cs
- EventLogPermissionEntry.cs
- SqlTopReducer.cs
- ServiceActivationException.cs
- EntityDataSourceWizardForm.cs
- VirtualizedItemProviderWrapper.cs
- TreeViewHitTestInfo.cs
- RegisterResponseInfo.cs
- InvalidOleVariantTypeException.cs
- Configuration.cs
- ViewKeyConstraint.cs
- EntitySetBaseCollection.cs
- MatrixCamera.cs
- ReadOnlyCollectionBase.cs
- StringAttributeCollection.cs
- DataListItemCollection.cs
- ThreadSafeList.cs
- RSAPKCS1SignatureFormatter.cs
- Array.cs
- WinHttpWebProxyFinder.cs
- ListViewUpdateEventArgs.cs
- DynamicUpdateCommand.cs
- ThreadStaticAttribute.cs
- BackgroundWorker.cs
- processwaithandle.cs
- FileSystemInfo.cs
- PersistChildrenAttribute.cs
- DbParameterCollection.cs
- ToolboxItemSnapLineBehavior.cs
- SqlParameter.cs
- IResourceProvider.cs
- ReliableChannelListener.cs
- ReadOnlyAttribute.cs
- XPathItem.cs
- PersonalizationProviderHelper.cs
- CommonProperties.cs
- WorkflowRuntimeServicesBehavior.cs
- SplayTreeNode.cs
- AdRotator.cs
- X509SecurityTokenAuthenticator.cs
- DispatcherSynchronizationContext.cs
- OdbcDataReader.cs
- X509Certificate2.cs
- ExtractedStateEntry.cs
- NonDualMessageSecurityOverHttpElement.cs
- RuleElement.cs
- SlotInfo.cs
- EnlistmentState.cs
- NonBatchDirectoryCompiler.cs
- BrowserInteropHelper.cs
- HelpEvent.cs
- RectangleF.cs
- MouseDevice.cs
- CodeExporter.cs
- CornerRadiusConverter.cs
- SystemThemeKey.cs
- CodeMemberEvent.cs
- RecordManager.cs
- WebBrowserContainer.cs
- Rectangle.cs
- UpdateManifestForBrowserApplication.cs
- DataContractFormatAttribute.cs
- ModuleBuilderData.cs
- PathGeometry.cs
- complextypematerializer.cs
- StrongBox.cs
- CodeTypeParameterCollection.cs
- XmlNodeReader.cs
- HopperCache.cs
- RuleAttributes.cs
- TypeDescriptionProviderAttribute.cs
- WinEventWrap.cs
- activationcontext.cs
- HotCommands.cs
- SmtpFailedRecipientException.cs
- OperatingSystem.cs
- Vector3DValueSerializer.cs
- SamlAssertionKeyIdentifierClause.cs
- SystemDropShadowChrome.cs
- ExternalCalls.cs
- EntityViewGenerator.cs
- IISUnsafeMethods.cs
- HttpContextWrapper.cs
- UnsafeNetInfoNativeMethods.cs
- ProcessStartInfo.cs
- DataBoundControl.cs
- TextTrailingWordEllipsis.cs
- HttpWrapper.cs
- ToolStripStatusLabel.cs
- ManualResetEvent.cs
- CookieProtection.cs
- HierarchicalDataTemplate.cs
- DateTimeFormat.cs
- oledbmetadatacolumnnames.cs
- HttpServerUtilityBase.cs
- ExpressionDumper.cs
- _SafeNetHandles.cs
- QilFactory.cs
- ScaleTransform.cs