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
- Propagator.cs
- StreamAsIStream.cs
- DrawingDrawingContext.cs
- DocumentStatusResources.cs
- SweepDirectionValidation.cs
- SchemaDeclBase.cs
- ConnectionManagementElement.cs
- HttpWriter.cs
- OdbcParameterCollection.cs
- SliderAutomationPeer.cs
- HttpModuleActionCollection.cs
- DataSpaceManager.cs
- SubtreeProcessor.cs
- CookieParameter.cs
- LookupNode.cs
- AsynchronousChannel.cs
- ModelItemDictionary.cs
- SqlGenericUtil.cs
- ItemsPanelTemplate.cs
- StylusPoint.cs
- ContainerUIElement3D.cs
- UniqueContractNameValidationBehavior.cs
- DbParameterCollectionHelper.cs
- _SSPISessionCache.cs
- TranslateTransform.cs
- DataGridRelationshipRow.cs
- LineSegment.cs
- ControlLocalizer.cs
- MaskDescriptor.cs
- SecurityHelper.cs
- ExternalException.cs
- DispatcherExceptionEventArgs.cs
- FocusManager.cs
- TransformerInfoCollection.cs
- OrderedDictionaryStateHelper.cs
- AutomationPropertyInfo.cs
- control.ime.cs
- StyleConverter.cs
- SmiEventSink_DeferedProcessing.cs
- SHA384CryptoServiceProvider.cs
- FunctionDescription.cs
- TextDecorationCollection.cs
- EventRoute.cs
- TryExpression.cs
- RoleServiceManager.cs
- AutomationProperties.cs
- RbTree.cs
- TaskFileService.cs
- SharedPersonalizationStateInfo.cs
- RoutedEventValueSerializer.cs
- Item.cs
- SmiMetaData.cs
- BuildProvider.cs
- BinHexEncoding.cs
- AssertFilter.cs
- XmlBinaryReader.cs
- SoapSchemaMember.cs
- Context.cs
- SafeFileMappingHandle.cs
- LinearGradientBrush.cs
- OdbcUtils.cs
- WindowsTooltip.cs
- TextSimpleMarkerProperties.cs
- WebFaultClientMessageInspector.cs
- ZipIOModeEnforcingStream.cs
- TreeNodeCollection.cs
- DataListCommandEventArgs.cs
- TableHeaderCell.cs
- SemanticResultKey.cs
- Assert.cs
- OleDbCommand.cs
- SystemResourceKey.cs
- DomainUpDown.cs
- TextServicesCompartmentContext.cs
- DoubleKeyFrameCollection.cs
- DoubleLinkListEnumerator.cs
- NameTable.cs
- SslStream.cs
- cookie.cs
- PrimitiveXmlSerializers.cs
- ServiceAppDomainAssociationProvider.cs
- TagMapInfo.cs
- BaseResourcesBuildProvider.cs
- ExtensionDataReader.cs
- AudioLevelUpdatedEventArgs.cs
- SvcMapFile.cs
- TriggerCollection.cs
- XmlSerializationReader.cs
- CollectionConverter.cs
- XsltOutput.cs
- ShutDownListener.cs
- SiteIdentityPermission.cs
- SqlWebEventProvider.cs
- FreezableOperations.cs
- LinkClickEvent.cs
- DBSchemaTable.cs
- IdentityModelDictionary.cs
- _Semaphore.cs
- OrCondition.cs
- CodeNamespaceImport.cs