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
- Logging.cs
- HttpCapabilitiesSectionHandler.cs
- XamlStyleSerializer.cs
- ByteAnimation.cs
- CompatibleIComparer.cs
- ColumnCollection.cs
- SystemTcpStatistics.cs
- SubtreeProcessor.cs
- FrameworkReadOnlyPropertyMetadata.cs
- GlobalizationAssembly.cs
- unsafenativemethodsother.cs
- RoleService.cs
- SystemNetworkInterface.cs
- DesignerToolboxInfo.cs
- Authorization.cs
- ToolStripItemCollection.cs
- SqlInternalConnectionTds.cs
- PrintPageEvent.cs
- SystemNetworkInterface.cs
- BufferBuilder.cs
- SqlProviderUtilities.cs
- Rotation3D.cs
- MasterPageParser.cs
- CodeExporter.cs
- XPathParser.cs
- ExtensibleClassFactory.cs
- MultiPageTextView.cs
- PasswordDeriveBytes.cs
- TextHidden.cs
- StatusBar.cs
- ExpressionVisitor.cs
- State.cs
- DrawingCollection.cs
- SplitterEvent.cs
- GraphicsPath.cs
- SelectQueryOperator.cs
- StrongName.cs
- XmlAutoDetectWriter.cs
- InvokePattern.cs
- SettingsSection.cs
- BulletChrome.cs
- IPEndPoint.cs
- TextAdaptor.cs
- RootBuilder.cs
- XmlSchemaComplexType.cs
- SafeArrayTypeMismatchException.cs
- TrustSection.cs
- ConnectionInterfaceCollection.cs
- CatalogZoneAutoFormat.cs
- Vector3DKeyFrameCollection.cs
- EntityClassGenerator.cs
- BezierSegment.cs
- ToolStripCodeDomSerializer.cs
- XsltSettings.cs
- FixedStringLookup.cs
- TTSEvent.cs
- RegexCaptureCollection.cs
- FieldBuilder.cs
- DataGridSortCommandEventArgs.cs
- FontDriver.cs
- ParentControlDesigner.cs
- EndpointAddressMessageFilterTable.cs
- HTMLTextWriter.cs
- ParserExtension.cs
- OciLobLocator.cs
- HtmlControlPersistable.cs
- Flowchart.cs
- BitmapImage.cs
- TitleStyle.cs
- WebPartExportVerb.cs
- ArgIterator.cs
- CommentEmitter.cs
- EmbeddedMailObjectsCollection.cs
- EntitySqlQueryCacheKey.cs
- TemplateNameScope.cs
- ToolBarOverflowPanel.cs
- LineServicesCallbacks.cs
- BaseUriHelper.cs
- EntityViewGenerationAttribute.cs
- JumpItem.cs
- CompilerParameters.cs
- HijriCalendar.cs
- RouteTable.cs
- XmlCDATASection.cs
- DbFunctionCommandTree.cs
- JsonXmlDataContract.cs
- EngineSiteSapi.cs
- ForwardPositionQuery.cs
- ScrollViewerAutomationPeer.cs
- ObjectConverter.cs
- UIElement.cs
- HttpChannelBindingToken.cs
- QueryCursorEventArgs.cs
- EditingScopeUndoUnit.cs
- ServicePointManager.cs
- FormattedText.cs
- SingleSelectRootGridEntry.cs
- RootBrowserWindow.cs
- List.cs
- Fonts.cs