Code:
/ Dotnetfx_Vista_SP2 / Dotnetfx_Vista_SP2 / 8.0.50727.4016 / WIN_WINDOWS / lh_tools_devdiv_wpf / Windows / wcp / Speech / Src / Internal / GrammarBuilding / GrammarBuilderPhrase.cs / 1 / GrammarBuilderPhrase.cs
//------------------------------------------------------------------ //// Copyright (c) Microsoft Corporation. All rights reserved. // //----------------------------------------------------------------- using System.Diagnostics; using System.Speech.Internal.SrgsCompiler; using System.Speech.Internal.SrgsParser; using System.Speech.Recognition; namespace System.Speech.Internal.GrammarBuilding { #if VSCOMPILE [DebuggerDisplay ("{DebugSummary}")] #endif internal sealed class GrammarBuilderPhrase : GrammarBuilderBase { //******************************************************************* // // Constructors // //******************************************************************* #region Constructors ////// /// /// internal GrammarBuilderPhrase (string phrase) : this (phrase, false, SubsetMatchingMode.OrderedSubset) { } ////// /// /// /// internal GrammarBuilderPhrase (string phrase, SubsetMatchingMode subsetMatchingCriteria) : this (phrase, true, subsetMatchingCriteria) { } ////// /// /// /// /// private GrammarBuilderPhrase (string phrase, bool subsetMatching, SubsetMatchingMode subsetMatchingCriteria) { _phrase = string.Copy (phrase); _subsetMatching = subsetMatching; switch (subsetMatchingCriteria) { case SubsetMatchingMode.OrderedSubset: _matchMode = MatchMode.OrderedSubset; break; case SubsetMatchingMode.OrderedSubsetContentRequired: _matchMode = MatchMode.OrderedSubsetContentRequired; break; case SubsetMatchingMode.Subsequence: _matchMode = MatchMode.Subsequence; break; case SubsetMatchingMode.SubsequenceContentRequired: _matchMode = MatchMode.SubsequenceContentRequired; break; } } ////// /// /// /// /// private GrammarBuilderPhrase (string phrase, bool subsetMatching, MatchMode matchMode) { _phrase = string.Copy (phrase); _subsetMatching = subsetMatching; _matchMode = matchMode; } #endregion //******************************************************************** // // Public Methods // //******************************************************************* #region Public Methods /// TODOC <_include file='doc\SpeechAudioFormatInfo.uex' path='docs/doc[@for="SpeechAudioFormatInfo.Equals"]/*' /> public override bool Equals (object obj) { GrammarBuilderPhrase refObj = obj as GrammarBuilderPhrase; if (refObj == null) { return false; } return _phrase == refObj._phrase && _matchMode == refObj._matchMode && _subsetMatching == refObj._subsetMatching; } /// TODOC <_include file='doc\SpeechAudioFormatInfo.uex' path='docs/doc[@for="SpeechAudioFormatInfo.GetHashCode"]/*' /> public override int GetHashCode () { return _phrase.GetHashCode (); } #endregion //******************************************************************** // // Internal Methods // //******************************************************************** #region Internal Methods ////// /// ///internal override GrammarBuilderBase Clone () { return new GrammarBuilderPhrase (_phrase, _subsetMatching, _matchMode); } /// /// /// /// /// /// /// ///internal override IElement CreateElement (IElementFactory elementFactory, IElement parent, IRule rule, IdentifierCollection ruleIds) { return CreatePhraseElement (elementFactory, parent); } #endregion //******************************************************************* // // Internal Properties // //******************************************************************** #region Internal Properties override internal string DebugSummary { get { return "‘" + _phrase + "’"; } } #endregion //******************************************************************* // // Private Methods // //******************************************************************* #region Private Methods /// /// /// /// /// ///private IElement CreatePhraseElement (IElementFactory elementFactory, IElement parent) { if (_subsetMatching) { // Create and return the ISubset representing the current phrase return elementFactory.CreateSubset (parent, _phrase, _matchMode); } else { if (elementFactory is SrgsElementCompilerFactory) { XmlParser.ParseText (parent, _phrase, null, null, -1f, new CreateTokenCallback (elementFactory.CreateToken)); } else { // Create and return the IElementText representing the current phrase return elementFactory.CreateText (parent, _phrase); } } return null; } #endregion //******************************************************************* // // Private Fields // //******************************************************************** #region Private Fields private readonly string _phrase; private readonly bool _subsetMatching; private readonly MatchMode _matchMode; #endregion } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. //------------------------------------------------------------------ // // Copyright (c) Microsoft Corporation. All rights reserved. // //----------------------------------------------------------------- using System.Diagnostics; using System.Speech.Internal.SrgsCompiler; using System.Speech.Internal.SrgsParser; using System.Speech.Recognition; namespace System.Speech.Internal.GrammarBuilding { #if VSCOMPILE [DebuggerDisplay ("{DebugSummary}")] #endif internal sealed class GrammarBuilderPhrase : GrammarBuilderBase { //******************************************************************* // // Constructors // //******************************************************************* #region Constructors ////// /// /// internal GrammarBuilderPhrase (string phrase) : this (phrase, false, SubsetMatchingMode.OrderedSubset) { } ////// /// /// /// internal GrammarBuilderPhrase (string phrase, SubsetMatchingMode subsetMatchingCriteria) : this (phrase, true, subsetMatchingCriteria) { } ////// /// /// /// /// private GrammarBuilderPhrase (string phrase, bool subsetMatching, SubsetMatchingMode subsetMatchingCriteria) { _phrase = string.Copy (phrase); _subsetMatching = subsetMatching; switch (subsetMatchingCriteria) { case SubsetMatchingMode.OrderedSubset: _matchMode = MatchMode.OrderedSubset; break; case SubsetMatchingMode.OrderedSubsetContentRequired: _matchMode = MatchMode.OrderedSubsetContentRequired; break; case SubsetMatchingMode.Subsequence: _matchMode = MatchMode.Subsequence; break; case SubsetMatchingMode.SubsequenceContentRequired: _matchMode = MatchMode.SubsequenceContentRequired; break; } } ////// /// /// /// /// private GrammarBuilderPhrase (string phrase, bool subsetMatching, MatchMode matchMode) { _phrase = string.Copy (phrase); _subsetMatching = subsetMatching; _matchMode = matchMode; } #endregion //******************************************************************** // // Public Methods // //******************************************************************* #region Public Methods /// TODOC <_include file='doc\SpeechAudioFormatInfo.uex' path='docs/doc[@for="SpeechAudioFormatInfo.Equals"]/*' /> public override bool Equals (object obj) { GrammarBuilderPhrase refObj = obj as GrammarBuilderPhrase; if (refObj == null) { return false; } return _phrase == refObj._phrase && _matchMode == refObj._matchMode && _subsetMatching == refObj._subsetMatching; } /// TODOC <_include file='doc\SpeechAudioFormatInfo.uex' path='docs/doc[@for="SpeechAudioFormatInfo.GetHashCode"]/*' /> public override int GetHashCode () { return _phrase.GetHashCode (); } #endregion //******************************************************************** // // Internal Methods // //******************************************************************** #region Internal Methods ////// /// ///internal override GrammarBuilderBase Clone () { return new GrammarBuilderPhrase (_phrase, _subsetMatching, _matchMode); } /// /// /// /// /// /// /// ///internal override IElement CreateElement (IElementFactory elementFactory, IElement parent, IRule rule, IdentifierCollection ruleIds) { return CreatePhraseElement (elementFactory, parent); } #endregion //******************************************************************* // // Internal Properties // //******************************************************************** #region Internal Properties override internal string DebugSummary { get { return "‘" + _phrase + "’"; } } #endregion //******************************************************************* // // Private Methods // //******************************************************************* #region Private Methods /// /// /// /// /// ///private IElement CreatePhraseElement (IElementFactory elementFactory, IElement parent) { if (_subsetMatching) { // Create and return the ISubset representing the current phrase return elementFactory.CreateSubset (parent, _phrase, _matchMode); } else { if (elementFactory is SrgsElementCompilerFactory) { XmlParser.ParseText (parent, _phrase, null, null, -1f, new CreateTokenCallback (elementFactory.CreateToken)); } else { // Create and return the IElementText representing the current phrase return elementFactory.CreateText (parent, _phrase); } } return null; } #endregion //******************************************************************* // // Private Fields // //******************************************************************** #region Private Fields private readonly string _phrase; private readonly bool _subsetMatching; private readonly MatchMode _matchMode; #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
- Camera.cs
- AttributeEmitter.cs
- XsdBuildProvider.cs
- XmlTextReaderImplHelpers.cs
- SqlProfileProvider.cs
- Semaphore.cs
- Literal.cs
- RadioButtonAutomationPeer.cs
- DelimitedListTraceListener.cs
- SystemInformation.cs
- ListItemConverter.cs
- SafeThemeHandle.cs
- SQLDateTimeStorage.cs
- URLIdentityPermission.cs
- EntityKey.cs
- ComPersistableTypeElementCollection.cs
- SerializationFieldInfo.cs
- WindowsFormsHelpers.cs
- indexingfiltermarshaler.cs
- QueryReaderSettings.cs
- DataSourceComponent.cs
- CategoryValueConverter.cs
- Path.cs
- WebPartUtil.cs
- DataGridViewEditingControlShowingEventArgs.cs
- StylusPointDescription.cs
- UpdateManifestForBrowserApplication.cs
- LicenseException.cs
- ListItemParagraph.cs
- HttpCachePolicyElement.cs
- SQLRoleProvider.cs
- PresentationAppDomainManager.cs
- ObjectQueryState.cs
- DocumentScope.cs
- CellTreeNode.cs
- TypeDescriptionProviderAttribute.cs
- WebPartVerbCollection.cs
- Size3DValueSerializer.cs
- ChangeTracker.cs
- XmlSchemaGroupRef.cs
- CipherData.cs
- UITypeEditor.cs
- counter.cs
- ComboBoxHelper.cs
- NativeMethodsOther.cs
- FigureParaClient.cs
- FlowDocumentPaginator.cs
- GraphicsContext.cs
- BaseDataBoundControl.cs
- PaintValueEventArgs.cs
- TargetInvocationException.cs
- ObjectTag.cs
- NavigatorOutput.cs
- UserNamePasswordValidator.cs
- ScrollItemPattern.cs
- Win32PrintDialog.cs
- UnsafeNativeMethods.cs
- Deserializer.cs
- ConvertTextFrag.cs
- XamlTreeBuilder.cs
- EncryptedXml.cs
- PropertyPath.cs
- FormViewDeleteEventArgs.cs
- AuthStoreRoleProvider.cs
- FileSecurity.cs
- ConcurrentStack.cs
- SpeechRecognitionEngine.cs
- DiagnosticTrace.cs
- WorkflowDesignerColors.cs
- XmlQualifiedName.cs
- IconBitmapDecoder.cs
- ObjectStateEntryBaseUpdatableDataRecord.cs
- TableCellAutomationPeer.cs
- SerializerProvider.cs
- RectangleConverter.cs
- ExpandCollapsePattern.cs
- OleDbCommand.cs
- Solver.cs
- DBSqlParser.cs
- IndexOutOfRangeException.cs
- GenericEnumerator.cs
- CodeAttributeDeclarationCollection.cs
- Rfc4050KeyFormatter.cs
- SplitContainerDesigner.cs
- DoubleAnimationUsingKeyFrames.cs
- SystemUnicastIPAddressInformation.cs
- TriggerAction.cs
- TileBrush.cs
- HitTestDrawingContextWalker.cs
- HostingEnvironmentException.cs
- XslTransform.cs
- CapabilitiesState.cs
- UserControlBuildProvider.cs
- BookmarkScopeManager.cs
- WindowsUpDown.cs
- QueryResponse.cs
- ListenerElementsCollection.cs
- RawStylusInputCustomDataList.cs
- Int32RectConverter.cs
- CompilerCollection.cs