Code:
/ Dotnetfx_Win7_3.5.1 / Dotnetfx_Win7_3.5.1 / 3.5.1 / 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
- EventLogPermissionAttribute.cs
- HtmlPhoneCallAdapter.cs
- MessageEnumerator.cs
- ButtonBaseAutomationPeer.cs
- ObjectAnimationUsingKeyFrames.cs
- ContextProperty.cs
- Exception.cs
- GroupItem.cs
- TransformedBitmap.cs
- QilUnary.cs
- ManagedIStream.cs
- NamespaceQuery.cs
- TargetParameterCountException.cs
- ControlIdConverter.cs
- CriticalHandle.cs
- HttpRequest.cs
- ColorPalette.cs
- TypeUtil.cs
- SamlConditions.cs
- SQLByte.cs
- WindowsServiceElement.cs
- XmlTypeMapping.cs
- SqlCacheDependencyDatabase.cs
- Asn1Utilities.cs
- NamespaceInfo.cs
- Control.cs
- SystemThemeKey.cs
- AttachedPropertyBrowsableForTypeAttribute.cs
- ServiceDescriptions.cs
- XmlCDATASection.cs
- DeviceContext2.cs
- ComponentEditorPage.cs
- RetrieveVirtualItemEventArgs.cs
- ChildDocumentBlock.cs
- FormViewUpdateEventArgs.cs
- Matrix3DConverter.cs
- CharacterString.cs
- DataGridTemplateColumn.cs
- CultureSpecificStringDictionary.cs
- TextBoxAutomationPeer.cs
- RowToParametersTransformer.cs
- ProfileInfo.cs
- BitStack.cs
- LogReserveAndAppendState.cs
- SqlClientPermission.cs
- Effect.cs
- EventLogPermissionEntryCollection.cs
- EntityRecordInfo.cs
- ChangeProcessor.cs
- PropertyMappingExceptionEventArgs.cs
- ObjectViewQueryResultData.cs
- StreamWriter.cs
- ZoneMembershipCondition.cs
- Exceptions.cs
- SystemTcpConnection.cs
- QilInvoke.cs
- Section.cs
- FtpWebRequest.cs
- AtomParser.cs
- BitStream.cs
- ServiceHostFactory.cs
- ExportOptions.cs
- HighlightVisual.cs
- UnsafeNativeMethods.cs
- IncrementalHitTester.cs
- SafeMILHandleMemoryPressure.cs
- RoamingStoreFile.cs
- SHA1Managed.cs
- RangeValidator.cs
- InputGestureCollection.cs
- CharacterBufferReference.cs
- WindowsScrollBar.cs
- Pen.cs
- StopStoryboard.cs
- CodeDomLocalizationProvider.cs
- ContractMethodInfo.cs
- NumericUpDownAcceleration.cs
- SchemaImporter.cs
- FileNameEditor.cs
- Transform3D.cs
- Crc32Helper.cs
- SuspendDesigner.cs
- SiteMapDataSource.cs
- MULTI_QI.cs
- DefaultAssemblyResolver.cs
- ResetableIterator.cs
- TypeRefElement.cs
- ProvidePropertyAttribute.cs
- TransformConverter.cs
- OptimalBreakSession.cs
- StoreContentChangedEventArgs.cs
- HtmlTitle.cs
- SqlXml.cs
- PasswordRecovery.cs
- GlyphsSerializer.cs
- DBConnectionString.cs
- XPathEmptyIterator.cs
- Socket.cs
- Visual3DCollection.cs
- AspNetRouteServiceHttpHandler.cs