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 / 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
- CodeExpressionCollection.cs
- ISO2022Encoding.cs
- FilterQuery.cs
- ZipFileInfoCollection.cs
- SqlCaseSimplifier.cs
- ResourceReader.cs
- BulletChrome.cs
- BuildResult.cs
- PickBranch.cs
- SystemKeyConverter.cs
- RIPEMD160Managed.cs
- ExecutionContext.cs
- Exceptions.cs
- CriticalExceptions.cs
- FixedSchema.cs
- TabPageDesigner.cs
- CodeDirectoryCompiler.cs
- IndexedEnumerable.cs
- HttpMethodConstraint.cs
- arabicshape.cs
- ClientFormsIdentity.cs
- TypeLibraryHelper.cs
- OdbcErrorCollection.cs
- PointLight.cs
- ServerValidateEventArgs.cs
- RtfControls.cs
- ServiceSecurityAuditElement.cs
- TempFiles.cs
- RecognizeCompletedEventArgs.cs
- StrongNameSignatureInformation.cs
- WebScriptServiceHostFactory.cs
- ItemsChangedEventArgs.cs
- PageAsyncTask.cs
- Trace.cs
- MissingMethodException.cs
- XsltQilFactory.cs
- StrokeNodeEnumerator.cs
- ObjectComplexPropertyMapping.cs
- path.cs
- FormsAuthenticationUserCollection.cs
- StaticDataManager.cs
- ControlValuePropertyAttribute.cs
- FileNameEditor.cs
- SecuritySessionSecurityTokenAuthenticator.cs
- CriticalFinalizerObject.cs
- MenuItemAutomationPeer.cs
- ServiceManagerHandle.cs
- GreenMethods.cs
- PropertyGridEditorPart.cs
- ContextBase.cs
- FixedPageStructure.cs
- AccessDataSource.cs
- ReferencedType.cs
- ParseElement.cs
- WsdlEndpointConversionContext.cs
- ApplicationServicesHostFactory.cs
- Compilation.cs
- AttributeProviderAttribute.cs
- CalloutQueueItem.cs
- RoutedPropertyChangedEventArgs.cs
- ReadOnlyDictionary.cs
- TextDecorationCollection.cs
- XmlArrayItemAttributes.cs
- GraphicsContainer.cs
- FormatConvertedBitmap.cs
- BrushConverter.cs
- ConfigurationValidatorAttribute.cs
- _HelperAsyncResults.cs
- ChangeTracker.cs
- FontEditor.cs
- BuilderInfo.cs
- ScriptBehaviorDescriptor.cs
- CompositeTypefaceMetrics.cs
- IntegerValidator.cs
- HwndHostAutomationPeer.cs
- FolderLevelBuildProviderCollection.cs
- TextRenderer.cs
- SymbolType.cs
- SqlGenericUtil.cs
- StatusBar.cs
- AtlasWeb.Designer.cs
- MemberAccessException.cs
- PropertyDescriptorCollection.cs
- _NegoStream.cs
- FtpWebRequest.cs
- WindowsRebar.cs
- MappingSource.cs
- StateWorkerRequest.cs
- PathGeometry.cs
- ScrollChangedEventArgs.cs
- WebPartConnectVerb.cs
- __ComObject.cs
- InheritedPropertyDescriptor.cs
- ScriptingProfileServiceSection.cs
- DateTimeOffsetAdapter.cs
- VirtualStackFrame.cs
- EntityDataSourceUtil.cs
- GeometryCollection.cs
- FirstMatchCodeGroup.cs
- GridViewItemAutomationPeer.cs