Code:
/ DotNET / DotNET / 8.0 / untmp / WIN_WINDOWS / lh_tools_devdiv_wpf / Windows / wcp / Speech / Src / Internal / SrgsCompiler / OneOf.cs / 1 / OneOf.cs
//------------------------------------------------------------------ //// Copyright (c) Microsoft Corporation. All rights reserved. // //----------------------------------------------------------------- #region Using directives using System; using System.Speech.Internal.SrgsParser; #endregion namespace System.Speech.Internal.SrgsCompiler { internal class OneOf : ParseElementCollection, IOneOf { //******************************************************************* // // Constructors // //******************************************************************* #region Constructors ////// Process the 'one-of' element. /// /// /// public OneOf (Rule rule, Backend backend) : base (backend, rule) { // Create a start and end start. _startState = _backend.CreateNewState (rule); _endState = _backend.CreateNewState (rule); //Add before the start state an epsilon arc _startArc = _backend.EpsilonTransition (1.0f); _startArc.End = _startState; //Add after the end state an epsilon arc _endArc = _backend.EpsilonTransition (1.0f); _endArc.Start = _endState; } #endregion //******************************************************************** // // Internal Method // //******************************************************************* #region Internal Method ////// Process the '/one-of' element. /// Connects all the arsc into an exit enf point. /// /// Verify OneOf contains at least one child 'item'. /// /// void IElement.PostParse (IElement parentElement) { if (_startArc.End.OutArcs.IsEmpty) { XmlParser.ThrowSrgsException (SRID.EmptyOneOf); } // Remove the extraneous arc and state if possible at the start and end _startArc = TrimStart (_startArc, _backend); _endArc = TrimEnd (_endArc, _backend); // Connect the one-of to the parrent base.PostParse ((ParseElementCollection) parentElement); } #endregion //******************************************************************** // // Protected Method // //******************************************************************** #region Protected Method ////// Adds a new arc to the one-of /// /// /// internal override void AddArc (Arc start, Arc end) { start = TrimStart (start, _backend); end = TrimEnd (end, _backend); State endStartState = end.Start; State startEndState = start.End; // Connect the previous arc with the 'start' set the intertion point if (start.IsEpsilonTransition & start.IsPropertylessTransition && startEndState != null && startEndState.InArcs.IsEmpty) { System.Diagnostics.Debug.Assert (start.End == startEndState); start.End = null; _backend.MoveOutputTransitionsAndDeleteState (startEndState, _startState); } else { start.Start = _startState; } // Connect with the epsilon transition at the end if (end.IsEpsilonTransition & end.IsPropertylessTransition && endStartState != null && endStartState.OutArcs.IsEmpty) { System.Diagnostics.Debug.Assert (end.Start == endStartState); end.Start = null; _backend.MoveInputTransitionsAndDeleteState (endStartState, _endState); } else { end.End = _endState; } } #endregion //******************************************************************* // // Protected Method // //******************************************************************** #region Protected Method private State _startState; private State _endState; #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
- Event.cs
- StaticResourceExtension.cs
- ApplicationServiceManager.cs
- FlowLayout.cs
- PropertyDescriptors.cs
- XmlSchemaSubstitutionGroup.cs
- TableRowGroup.cs
- ObjectNotFoundException.cs
- SimpleTypesSurrogate.cs
- ObjectSet.cs
- CrossAppDomainChannel.cs
- FreezableDefaultValueFactory.cs
- DependencyStoreSurrogate.cs
- xmlfixedPageInfo.cs
- SafeCertificateStore.cs
- AutoCompleteStringCollection.cs
- UnionCodeGroup.cs
- SettingsSection.cs
- FaultImportOptions.cs
- ListViewItemMouseHoverEvent.cs
- SafeEventLogReadHandle.cs
- HideDisabledControlAdapter.cs
- Rect3D.cs
- SHA512Managed.cs
- CqlLexer.cs
- TextRangeEditTables.cs
- KerberosRequestorSecurityTokenAuthenticator.cs
- TypeUnloadedException.cs
- ResXResourceReader.cs
- XPathParser.cs
- ZipIOExtraFieldElement.cs
- ASCIIEncoding.cs
- SqlDataSourceParameterParser.cs
- HtmlInputFile.cs
- MemoryRecordBuffer.cs
- wgx_commands.cs
- UnsafeNativeMethods.cs
- ObjectHelper.cs
- TabControl.cs
- DataViewManager.cs
- ApplicationSettingsBase.cs
- FormatControl.cs
- HtmlTernaryTree.cs
- BitmapEffectCollection.cs
- WmlControlAdapter.cs
- MonitoringDescriptionAttribute.cs
- WindowVisualStateTracker.cs
- XMLUtil.cs
- UserControlBuildProvider.cs
- SqlDataReaderSmi.cs
- ClonableStack.cs
- _ReceiveMessageOverlappedAsyncResult.cs
- CryptoProvider.cs
- ellipse.cs
- ToolStripDropDownButton.cs
- ViewGenResults.cs
- OdbcReferenceCollection.cs
- PassportAuthenticationModule.cs
- ZipIOExtraField.cs
- bindurihelper.cs
- DesignerDataTableBase.cs
- SafeRegistryKey.cs
- ChtmlTextWriter.cs
- MetroSerializationManager.cs
- CopyOnWriteList.cs
- DrawingGroupDrawingContext.cs
- CustomErrorsSection.cs
- NoneExcludedImageIndexConverter.cs
- RelatedView.cs
- WmpBitmapDecoder.cs
- COM2TypeInfoProcessor.cs
- Rectangle.cs
- WinHttpWebProxyFinder.cs
- CryptoKeySecurity.cs
- CancellationScope.cs
- RequestTimeoutManager.cs
- XmlException.cs
- DocumentViewerHelper.cs
- DesignerAdapterUtil.cs
- DataGridViewComboBoxCell.cs
- DataKeyCollection.cs
- _NestedSingleAsyncResult.cs
- StringCollection.cs
- CachedTypeface.cs
- PropagatorResult.cs
- AutomationPeer.cs
- StateFinalizationActivity.cs
- Operand.cs
- ValidationErrorEventArgs.cs
- DrawItemEvent.cs
- ListBindingHelper.cs
- ExportOptions.cs
- StrokeDescriptor.cs
- BuiltInExpr.cs
- VirtualizingPanel.cs
- ParagraphVisual.cs
- SqlDependencyListener.cs
- AutoScrollExpandMessageFilter.cs
- CryptoApi.cs
- TogglePattern.cs