Code:
/ Dotnetfx_Vista_SP2 / Dotnetfx_Vista_SP2 / 8.0.50727.4016 / WIN_WINDOWS / lh_tools_devdiv_wpf / Windows / wcp / Speech / Src / Internal / GrammarBuilding / RuleElement.cs / 1 / RuleElement.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 RuleElement : BuilderElements { //******************************************************************* // // Constructors // //******************************************************************* #region Constructors ////// /// /// internal RuleElement (string name) { _name = name; } ////// /// /// /// internal RuleElement (GrammarBuilderBase builder, string name) : this (name) { Add (builder); } #endregion //******************************************************************** // // Public Methods // //******************************************************************* #region Public Methods /// TODOC <_include file='doc\SpeechAudioFormatInfo.uex' path='docs/doc[@for="SpeechAudioFormatInfo.Equals"]/*' /> public override bool Equals (object obj) { RuleElement refObj = obj as RuleElement; if (refObj == null) { return false; } if (!base.Equals (obj)) { return false; } return _name == refObj._name; } /// 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 ////// /// ///internal override GrammarBuilderBase Clone () { RuleElement rule = new RuleElement (_name); rule.CloneItems (this); return rule; } /// /// /// /// /// /// /// ///internal override IElement CreateElement (IElementFactory elementFactory, IElement parent, IRule rule, IdentifierCollection ruleIds) { if (_rule == null) { IGrammar grammar = elementFactory.Grammar; // Create the rule _ruleName = ruleIds.CreateNewIdentifier (Name); _rule = grammar.CreateRule (_ruleName, RulePublic.False, RuleDynamic.NotSet, false); // Create the children elements CreateChildrenElements (elementFactory, _rule, ruleIds); _rule.PostParse (grammar); } return _rule; } /// /// /// ///internal override int CalcCount (BuilderElements parent) { // clear any existing value _rule = null; return base.CalcCount (parent); } #endregion //******************************************************************* // // Internal Properties // //******************************************************************** #region Internal Properties override internal string DebugSummary { get { return _name + "=" + base.DebugSummary; } } internal string Name { get { return _name; } } internal string RuleName { get { return _ruleName; } } #endregion //******************************************************************* // // Private Fields // //******************************************************************* #region Private Fields /// /// /// private readonly string _name; private string _ruleName; private IRule _rule; #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 RuleElement : BuilderElements { //******************************************************************* // // Constructors // //******************************************************************* #region Constructors ////// /// /// internal RuleElement (string name) { _name = name; } ////// /// /// /// internal RuleElement (GrammarBuilderBase builder, string name) : this (name) { Add (builder); } #endregion //******************************************************************** // // Public Methods // //******************************************************************* #region Public Methods /// TODOC <_include file='doc\SpeechAudioFormatInfo.uex' path='docs/doc[@for="SpeechAudioFormatInfo.Equals"]/*' /> public override bool Equals (object obj) { RuleElement refObj = obj as RuleElement; if (refObj == null) { return false; } if (!base.Equals (obj)) { return false; } return _name == refObj._name; } /// 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 ////// /// ///internal override GrammarBuilderBase Clone () { RuleElement rule = new RuleElement (_name); rule.CloneItems (this); return rule; } /// /// /// /// /// /// /// ///internal override IElement CreateElement (IElementFactory elementFactory, IElement parent, IRule rule, IdentifierCollection ruleIds) { if (_rule == null) { IGrammar grammar = elementFactory.Grammar; // Create the rule _ruleName = ruleIds.CreateNewIdentifier (Name); _rule = grammar.CreateRule (_ruleName, RulePublic.False, RuleDynamic.NotSet, false); // Create the children elements CreateChildrenElements (elementFactory, _rule, ruleIds); _rule.PostParse (grammar); } return _rule; } /// /// /// ///internal override int CalcCount (BuilderElements parent) { // clear any existing value _rule = null; return base.CalcCount (parent); } #endregion //******************************************************************* // // Internal Properties // //******************************************************************** #region Internal Properties override internal string DebugSummary { get { return _name + "=" + base.DebugSummary; } } internal string Name { get { return _name; } } internal string RuleName { get { return _ruleName; } } #endregion //******************************************************************* // // Private Fields // //******************************************************************* #region Private Fields /// /// /// private readonly string _name; private string _ruleName; private IRule _rule; #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
- Size3DConverter.cs
- AssemblyName.cs
- DateTime.cs
- Roles.cs
- ThemeableAttribute.cs
- RemoteWebConfigurationHost.cs
- UserControlBuildProvider.cs
- WindowsToolbar.cs
- NativeMethods.cs
- WebPartUserCapability.cs
- StreamGeometry.cs
- WebPartTracker.cs
- CallId.cs
- TemplateFactory.cs
- ClockController.cs
- CleanUpVirtualizedItemEventArgs.cs
- DataSourceXmlClassAttribute.cs
- SingleAnimation.cs
- EventLogPermissionEntryCollection.cs
- XmlTypeMapping.cs
- SecurityKeyType.cs
- AnimationClock.cs
- TypefaceCollection.cs
- BigIntegerStorage.cs
- shaperfactory.cs
- ActivatableWorkflowsQueryResult.cs
- PeerDefaultCustomResolverClient.cs
- EditorAttributeInfo.cs
- ReferentialConstraint.cs
- PreservationFileWriter.cs
- Int32Converter.cs
- MetafileHeaderWmf.cs
- DependencyPropertyChangedEventArgs.cs
- SqlBuffer.cs
- State.cs
- Stroke.cs
- NativeMethods.cs
- PointLightBase.cs
- AuthenticationException.cs
- NameValueFileSectionHandler.cs
- DataTableMappingCollection.cs
- LineServicesRun.cs
- StringKeyFrameCollection.cs
- StrongNameIdentityPermission.cs
- DefaultIfEmptyQueryOperator.cs
- XmlSchemaInfo.cs
- KnownTypes.cs
- BehaviorEditorPart.cs
- MobileControlsSectionHandler.cs
- EntityContainerAssociationSetEnd.cs
- ForeignKeyConstraint.cs
- MaskedTextBox.cs
- HMACMD5.cs
- FixedStringLookup.cs
- DesignerSerializationOptionsAttribute.cs
- GridViewColumnHeaderAutomationPeer.cs
- EdgeProfileValidation.cs
- RealizationDrawingContextWalker.cs
- Hashtable.cs
- NullRuntimeConfig.cs
- DateTimePickerDesigner.cs
- JsonWriterDelegator.cs
- DiagnosticsElement.cs
- _StreamFramer.cs
- ECDiffieHellmanCngPublicKey.cs
- Attachment.cs
- CommandField.cs
- EmptyCollection.cs
- ErrorHandlerModule.cs
- WebPartCatalogAddVerb.cs
- Message.cs
- FontNamesConverter.cs
- SiteIdentityPermission.cs
- AssemblyAttributesGoHere.cs
- AutomationPatternInfo.cs
- AspCompat.cs
- OdbcConnectionStringbuilder.cs
- DesignerSerializationVisibilityAttribute.cs
- WebHttpBinding.cs
- TextOutput.cs
- OciEnlistContext.cs
- UnitySerializationHolder.cs
- RotationValidation.cs
- DirectoryNotFoundException.cs
- XmlILOptimizerVisitor.cs
- Encoding.cs
- TextEditorThreadLocalStore.cs
- SqlExpander.cs
- TransformerInfo.cs
- BamlStream.cs
- ApplicationManager.cs
- CommandManager.cs
- StylusPointPropertyInfoDefaults.cs
- autovalidator.cs
- WindowsAuthenticationModule.cs
- CacheMemory.cs
- FormViewCommandEventArgs.cs
- WindowsSolidBrush.cs
- DataGridViewColumnStateChangedEventArgs.cs
- ConfigXmlDocument.cs