Code:
/ DotNET / DotNET / 8.0 / untmp / 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.
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- CodeDelegateInvokeExpression.cs
- GeometryModel3D.cs
- SBCSCodePageEncoding.cs
- Registry.cs
- LogStore.cs
- DataFormats.cs
- ZipPackagePart.cs
- UInt32Converter.cs
- BezierSegment.cs
- TreeNodeCollection.cs
- TypeDelegator.cs
- RadialGradientBrush.cs
- FormsAuthenticationUserCollection.cs
- DataGridViewButtonColumn.cs
- RawStylusInputCustomDataList.cs
- Helpers.cs
- SharedUtils.cs
- CutCopyPasteHelper.cs
- UniqueIdentifierService.cs
- activationcontext.cs
- SearchForVirtualItemEventArgs.cs
- TimeSpanMinutesConverter.cs
- RC2.cs
- AuthenticationException.cs
- DelegateCompletionCallbackWrapper.cs
- SystemResourceHost.cs
- EntityDescriptor.cs
- SystemColors.cs
- BindingMemberInfo.cs
- Restrictions.cs
- DoubleSumAggregationOperator.cs
- DeferrableContent.cs
- X509RawDataKeyIdentifierClause.cs
- ButtonBase.cs
- ServiceModelConfigurationElementCollection.cs
- TransformProviderWrapper.cs
- FileSystemWatcher.cs
- XsltLibrary.cs
- TypeFieldSchema.cs
- SystemTcpConnection.cs
- ErrorWebPart.cs
- TreeViewHitTestInfo.cs
- Accessible.cs
- LeafCellTreeNode.cs
- ContentElement.cs
- GenericUriParser.cs
- SqlInfoMessageEvent.cs
- PtsHelper.cs
- LogExtentCollection.cs
- MembershipSection.cs
- AssociationTypeEmitter.cs
- GridErrorDlg.cs
- PathGeometry.cs
- ComboBoxAutomationPeer.cs
- TableLayoutPanelDesigner.cs
- SliderAutomationPeer.cs
- GroupBox.cs
- invalidudtexception.cs
- BinaryNegotiation.cs
- GridViewRowPresenter.cs
- HttpEncoder.cs
- PeerNameResolver.cs
- MetadataCache.cs
- ClipboardData.cs
- LocationUpdates.cs
- DeferrableContentConverter.cs
- DrawingServices.cs
- DnsElement.cs
- RTLAwareMessageBox.cs
- AsyncParams.cs
- EmissiveMaterial.cs
- SecurityPolicySection.cs
- NoneExcludedImageIndexConverter.cs
- TreeViewItem.cs
- CurrencyManager.cs
- MobileTemplatedControlDesigner.cs
- dataprotectionpermission.cs
- FixedTextSelectionProcessor.cs
- DBDataPermission.cs
- UInt16.cs
- TextModifierScope.cs
- EdmFunction.cs
- KeySpline.cs
- ResourceManager.cs
- Calendar.cs
- CommandCollectionEditor.cs
- DynamicRendererThreadManager.cs
- PrimaryKeyTypeConverter.cs
- SoapRpcMethodAttribute.cs
- BitmapEffectRenderDataResource.cs
- TypeExtensionConverter.cs
- PermissionSetEnumerator.cs
- filewebresponse.cs
- EventArgs.cs
- ToolBarButton.cs
- XhtmlBasicValidatorAdapter.cs
- ActivityScheduledQuery.cs
- EncryptedPackageFilter.cs
- TemplatePartAttribute.cs
- FormViewPagerRow.cs