Code:
/ Dotnetfx_Vista_SP2 / Dotnetfx_Vista_SP2 / 8.0.50727.4016 / WIN_WINDOWS / lh_tools_devdiv_wpf / Windows / wcp / Speech / Src / Internal / GrammarBuilding / SemanticKeyElement.cs / 1 / SemanticKeyElement.cs
//------------------------------------------------------------------ //// Copyright (c) Microsoft Corporation. All rights reserved. // //----------------------------------------------------------------- using System.Collections.Generic; using System.Speech.Recognition; using System.Speech.Internal.SrgsParser; using System.Text; namespace System.Speech.Internal.GrammarBuilding { ////// /// internal sealed class SemanticKeyElement : BuilderElements { //******************************************************************* // // Constructors // //******************************************************************* #region Constructors ////// /// /// internal SemanticKeyElement (string semanticKey) { _semanticKey = semanticKey; RuleElement rule = new RuleElement (semanticKey); _ruleRef = new RuleRefElement (rule, _semanticKey); Items.Add (rule); Items.Add (_ruleRef); } #endregion //******************************************************************** // // Public Methods // //******************************************************************* #region Public Methods /// TODOC <_include file='doc\SpeechAudioFormatInfo.uex' path='docs/doc[@for="SpeechAudioFormatInfo.Equals"]/*' /> public override bool Equals (object obj) { SemanticKeyElement refObj = obj as SemanticKeyElement; if (refObj == null) { return false; } if (!base.Equals (obj)) { return false; } // No need to check for the equality on _ruleRef. The children are in the Items, not the underlying rule return _semanticKey == refObj._semanticKey; } /// TODOC <_include file='doc\SpeechAudioFormatInfo.uex' path='docs/doc[@for="SpeechAudioFormatInfo.GetHashCode"]/*' /> public override int GetHashCode () { return base.GetHashCode (); } #endregion //******************************************************************** // // Internal Methods // //******************************************************************** #region Internal Methods ////// /// /// new internal void Add (string phrase) { _ruleRef.Add (new GrammarBuilderPhrase (phrase)); } ////// /// /// new internal void Add (GrammarBuilder builder) { foreach (GrammarBuilderBase item in builder.InternalBuilder.Items) { _ruleRef.Add (item); } } ////// /// ///internal override GrammarBuilderBase Clone () { SemanticKeyElement semanticKeyElement = new SemanticKeyElement (_semanticKey); semanticKeyElement._ruleRef.CloneItems (_ruleRef); return semanticKeyElement; } /// /// /// /// /// /// /// ///internal override IElement CreateElement (IElementFactory elementFactory, IElement parent, IRule rule, IdentifierCollection ruleIds) { // Create the rule associated with this key _ruleRef.Rule.CreateElement (elementFactory, parent, rule, ruleIds); // Create the ruleRef IElement ruleRef = _ruleRef.CreateElement (elementFactory, parent, rule, ruleIds); return ruleRef; } #endregion //******************************************************************* // // Internal Properties // //******************************************************************** #region Internal Properties override internal string DebugSummary { get { return _ruleRef.Rule.DebugSummary; } } #endregion //******************************************************************* // // Private Fields // //******************************************************************* #region Private Fields /// /// /// private readonly string _semanticKey; private readonly RuleRefElement _ruleRef; #endregion } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. //------------------------------------------------------------------ //// Copyright (c) Microsoft Corporation. All rights reserved. // //----------------------------------------------------------------- using System.Collections.Generic; using System.Speech.Recognition; using System.Speech.Internal.SrgsParser; using System.Text; namespace System.Speech.Internal.GrammarBuilding { ////// /// internal sealed class SemanticKeyElement : BuilderElements { //******************************************************************* // // Constructors // //******************************************************************* #region Constructors ////// /// /// internal SemanticKeyElement (string semanticKey) { _semanticKey = semanticKey; RuleElement rule = new RuleElement (semanticKey); _ruleRef = new RuleRefElement (rule, _semanticKey); Items.Add (rule); Items.Add (_ruleRef); } #endregion //******************************************************************** // // Public Methods // //******************************************************************* #region Public Methods /// TODOC <_include file='doc\SpeechAudioFormatInfo.uex' path='docs/doc[@for="SpeechAudioFormatInfo.Equals"]/*' /> public override bool Equals (object obj) { SemanticKeyElement refObj = obj as SemanticKeyElement; if (refObj == null) { return false; } if (!base.Equals (obj)) { return false; } // No need to check for the equality on _ruleRef. The children are in the Items, not the underlying rule return _semanticKey == refObj._semanticKey; } /// TODOC <_include file='doc\SpeechAudioFormatInfo.uex' path='docs/doc[@for="SpeechAudioFormatInfo.GetHashCode"]/*' /> public override int GetHashCode () { return base.GetHashCode (); } #endregion //******************************************************************** // // Internal Methods // //******************************************************************** #region Internal Methods ////// /// /// new internal void Add (string phrase) { _ruleRef.Add (new GrammarBuilderPhrase (phrase)); } ////// /// /// new internal void Add (GrammarBuilder builder) { foreach (GrammarBuilderBase item in builder.InternalBuilder.Items) { _ruleRef.Add (item); } } ////// /// ///internal override GrammarBuilderBase Clone () { SemanticKeyElement semanticKeyElement = new SemanticKeyElement (_semanticKey); semanticKeyElement._ruleRef.CloneItems (_ruleRef); return semanticKeyElement; } /// /// /// /// /// /// /// ///internal override IElement CreateElement (IElementFactory elementFactory, IElement parent, IRule rule, IdentifierCollection ruleIds) { // Create the rule associated with this key _ruleRef.Rule.CreateElement (elementFactory, parent, rule, ruleIds); // Create the ruleRef IElement ruleRef = _ruleRef.CreateElement (elementFactory, parent, rule, ruleIds); return ruleRef; } #endregion //******************************************************************* // // Internal Properties // //******************************************************************** #region Internal Properties override internal string DebugSummary { get { return _ruleRef.Rule.DebugSummary; } } #endregion //******************************************************************* // // Private Fields // //******************************************************************* #region Private Fields /// /// /// private readonly string _semanticKey; private readonly RuleRefElement _ruleRef; #endregion } } // 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
- hresults.cs
- GlobalAllocSafeHandle.cs
- FlowDocumentReader.cs
- DataSetFieldSchema.cs
- WebRequestModuleElementCollection.cs
- UInt32Converter.cs
- Win32.cs
- SqlException.cs
- EventProvider.cs
- DataBoundControlAdapter.cs
- QilInvoke.cs
- KeyGesture.cs
- GPPOINT.cs
- LockCookie.cs
- ColumnBinding.cs
- DataGridViewTextBoxColumn.cs
- QueryCorrelationInitializer.cs
- FixedSOMSemanticBox.cs
- Visual3DCollection.cs
- MD5CryptoServiceProvider.cs
- IndentTextWriter.cs
- TextStore.cs
- SelectionProviderWrapper.cs
- DataSourceCollectionBase.cs
- SQLDecimal.cs
- ProfileManager.cs
- DeploymentExceptionMapper.cs
- StreamUpgradeProvider.cs
- Parser.cs
- FileDialogCustomPlaces.cs
- MenuItemCollection.cs
- ConnectionPoint.cs
- ConvertEvent.cs
- WindowsAuthenticationEventArgs.cs
- UnSafeCharBuffer.cs
- PackageDigitalSignatureManager.cs
- DrawingBrush.cs
- XMLUtil.cs
- XamlClipboardData.cs
- PropertyOverridesTypeEditor.cs
- HostedElements.cs
- ContextMenuService.cs
- VirtualPath.cs
- PipelineModuleStepContainer.cs
- IgnoreFileBuildProvider.cs
- ComboBoxRenderer.cs
- PlanCompilerUtil.cs
- ValidatorCompatibilityHelper.cs
- IndependentAnimationStorage.cs
- IdleTimeoutMonitor.cs
- PageAsyncTask.cs
- ExtractorMetadata.cs
- RelationshipSet.cs
- RIPEMD160Managed.cs
- PersonalizationEntry.cs
- SmiEventSink_Default.cs
- XMLUtil.cs
- OdbcUtils.cs
- MimeTypePropertyAttribute.cs
- RowTypePropertyElement.cs
- DelegatedStream.cs
- DataKeyArray.cs
- XmlSchemaCollection.cs
- WebResponse.cs
- ConnectionPoint.cs
- CollectionViewGroup.cs
- Size3DValueSerializer.cs
- AgileSafeNativeMemoryHandle.cs
- CalculatedColumn.cs
- SchemaEntity.cs
- XmlSignificantWhitespace.cs
- httpserverutility.cs
- SemanticBasicElement.cs
- DataGridViewTopRowAccessibleObject.cs
- ObjectViewFactory.cs
- MetadataItem.cs
- QuotedPrintableStream.cs
- EntitySetDataBindingList.cs
- ValueUnavailableException.cs
- PerformanceCounterLib.cs
- OdbcInfoMessageEvent.cs
- WindowsStatusBar.cs
- ByteStream.cs
- HttpClientCertificate.cs
- UserNameSecurityTokenParameters.cs
- SessionStateContainer.cs
- TimeSpanValidatorAttribute.cs
- ErrorRuntimeConfig.cs
- UserControl.cs
- HttpHandlersSection.cs
- InvalidPrinterException.cs
- Version.cs
- MetadataItemEmitter.cs
- RecoverInstanceLocksCommand.cs
- FormatterConverter.cs
- StrokeDescriptor.cs
- SessionStateUtil.cs
- ValidatorCompatibilityHelper.cs
- OrderedDictionaryStateHelper.cs
- SEHException.cs