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
- ClickablePoint.cs
- SqlCacheDependencyDatabaseCollection.cs
- DataGridViewAutoSizeColumnsModeEventArgs.cs
- Sentence.cs
- DependencyPropertyKey.cs
- RelatedView.cs
- ProfilePropertySettingsCollection.cs
- NotificationContext.cs
- TableCellsCollectionEditor.cs
- ToolBarTray.cs
- RuleCache.cs
- Util.cs
- GlyphElement.cs
- IntSecurity.cs
- BitmapInitialize.cs
- Pkcs7Signer.cs
- ConfigXmlComment.cs
- ExpandedWrapper.cs
- WmlCalendarAdapter.cs
- Command.cs
- ClientUtils.cs
- TransferRequestHandler.cs
- CompilerGlobalScopeAttribute.cs
- InstanceCollisionException.cs
- JsonWriter.cs
- ToolStripDropDownClosingEventArgs.cs
- RootBrowserWindowAutomationPeer.cs
- CodeChecksumPragma.cs
- WebServiceClientProxyGenerator.cs
- WindowsImpersonationContext.cs
- XamlBrushSerializer.cs
- HttpApplicationFactory.cs
- URLIdentityPermission.cs
- HttpDictionary.cs
- BitmapEffectvisualstate.cs
- EmissiveMaterial.cs
- PingOptions.cs
- UInt64Storage.cs
- SqlReorderer.cs
- MiniAssembly.cs
- HtmlInputHidden.cs
- DateTimeStorage.cs
- FacetDescription.cs
- BitStream.cs
- SerializationObjectManager.cs
- HttpProxyCredentialType.cs
- TriState.cs
- DesignerAutoFormat.cs
- RC2CryptoServiceProvider.cs
- HttpCachePolicy.cs
- RepeatBehavior.cs
- _Win32.cs
- GenericEnumConverter.cs
- TextDocumentView.cs
- ReleaseInstanceMode.cs
- WebBrowserNavigatingEventHandler.cs
- TextStore.cs
- Input.cs
- RolePrincipal.cs
- ModelItem.cs
- InterleavedZipPartStream.cs
- filewebrequest.cs
- PrinterResolution.cs
- AppModelKnownContentFactory.cs
- TouchesOverProperty.cs
- DbExpressionRules.cs
- SafeTimerHandle.cs
- Events.cs
- ImageCollectionEditor.cs
- DrawingGroup.cs
- DbConnectionOptions.cs
- KeyInterop.cs
- PropertyGridView.cs
- InternalBufferManager.cs
- PropertyDescriptors.cs
- QueryStringConverter.cs
- HiddenField.cs
- AttachedPropertyBrowsableWhenAttributePresentAttribute.cs
- ConfigXmlDocument.cs
- MailWebEventProvider.cs
- IUnknownConstantAttribute.cs
- SqlTriggerContext.cs
- ManagementObject.cs
- WindowsImpersonationContext.cs
- PropertyChangedEventArgs.cs
- BaseConfigurationRecord.cs
- XmlSchemaValidationException.cs
- PathParser.cs
- Int32CAMarshaler.cs
- Number.cs
- CloseCollectionAsyncResult.cs
- TextDecorationCollectionConverter.cs
- BigInt.cs
- SafeProcessHandle.cs
- OpacityConverter.cs
- SwitchElementsCollection.cs
- Focus.cs
- AutoCompleteStringCollection.cs
- TextReader.cs
- ToolboxDataAttribute.cs