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(TermExprterm, bool isTermPositive) : base(isTermPositive ? (BoolExpr )term : (BoolExpr )new NotExpr (term)) { Debug.Assert(null != term); _term = term; _isTermPositive = isTermPositive; } /// /// Gets literal term. /// internal TermExprTerm { get { return _term; } } /// /// Gets sign of term. /// internal bool IsTermPositive { get { return _isTermPositive; } } ////// Creates a negated version of this literal. /// ///!this internal LiteralMakeNegated() { 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(TermExprterm, bool isTermPositive) : base(isTermPositive ? (BoolExpr )term : (BoolExpr )new NotExpr (term)) { Debug.Assert(null != term); _term = term; _isTermPositive = isTermPositive; } /// /// Gets literal term. /// internal TermExprTerm { get { return _term; } } /// /// Gets sign of term. /// internal bool IsTermPositive { get { return _isTermPositive; } } ////// Creates a negated version of this literal. /// ///!this internal LiteralMakeNegated() { 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
- TypeBuilder.cs
- DependencyObjectPropertyDescriptor.cs
- MenuItemStyleCollection.cs
- FontNamesConverter.cs
- Errors.cs
- VisualStyleElement.cs
- WriteFileContext.cs
- TranslateTransform3D.cs
- AlternateViewCollection.cs
- MessageSmuggler.cs
- HttpBufferlessInputStream.cs
- MembershipUser.cs
- DataConnectionHelper.cs
- EventLogException.cs
- FunctionDefinition.cs
- StateWorkerRequest.cs
- PhysicalFontFamily.cs
- MetadataUtilsSmi.cs
- FormView.cs
- WrapperEqualityComparer.cs
- CredentialCache.cs
- FixedPage.cs
- ErrorHandlerModule.cs
- SurrogateSelector.cs
- MetafileHeader.cs
- DataRowChangeEvent.cs
- DropSource.cs
- ListViewDeleteEventArgs.cs
- PersonalizablePropertyEntry.cs
- TreeViewItemAutomationPeer.cs
- RoutedEventValueSerializer.cs
- AppSettingsReader.cs
- ClosableStream.cs
- ProxyWebPart.cs
- ResponseStream.cs
- EnumBuilder.cs
- ListDictionaryInternal.cs
- WSHttpBindingElement.cs
- ConvertEvent.cs
- TaskHelper.cs
- StateInitializationDesigner.cs
- ExtendedPropertyDescriptor.cs
- ChineseLunisolarCalendar.cs
- PointCollectionConverter.cs
- TextEffect.cs
- BinaryWriter.cs
- UrlPropertyAttribute.cs
- StylusEventArgs.cs
- XmlNode.cs
- HttpRequestCacheValidator.cs
- ColorDialog.cs
- SecurityUniqueId.cs
- Knowncolors.cs
- DataTableReader.cs
- HebrewCalendar.cs
- PersistenceTypeAttribute.cs
- log.cs
- AutomationEvent.cs
- WorkflowApplication.cs
- SiteIdentityPermission.cs
- RequestCache.cs
- XmlExpressionDumper.cs
- CustomCategoryAttribute.cs
- DefaultClaimSet.cs
- DataGridTextColumn.cs
- SafeBitVector32.cs
- ProtocolElement.cs
- RequestQueue.cs
- documentation.cs
- ViewStateException.cs
- StrongTypingException.cs
- Schema.cs
- OracleDateTime.cs
- WmlTextBoxAdapter.cs
- ExpressionHelper.cs
- LinearQuaternionKeyFrame.cs
- TextMetrics.cs
- KernelTypeValidation.cs
- MetadataArtifactLoaderCompositeResource.cs
- GetReadStreamResult.cs
- Rijndael.cs
- ExtendedPropertyCollection.cs
- CheckBoxStandardAdapter.cs
- PartialCachingAttribute.cs
- ThreadStateException.cs
- ToolStripRendererSwitcher.cs
- EtwProvider.cs
- ProgressBar.cs
- BatchWriter.cs
- NativeMethods.cs
- Translator.cs
- DataGridViewControlCollection.cs
- cache.cs
- Polyline.cs
- TextRangeSerialization.cs
- XmlFileEditor.cs
- HttpProcessUtility.cs
- ConnectionPoint.cs
- TextModifier.cs
- GeneralTransform3D.cs