Code:
/ DotNET / DotNET / 8.0 / untmp / 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.
Link Menu

This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- WebServiceEnumData.cs
- ValidationManager.cs
- DeclaredTypeElementCollection.cs
- RoleGroupCollection.cs
- WriteableBitmap.cs
- StreamWithDictionary.cs
- TdsParserStateObject.cs
- SecurityContext.cs
- TextBoxView.cs
- SQLBinary.cs
- ProfileElement.cs
- XmlSequenceWriter.cs
- TimelineCollection.cs
- PerfCounterSection.cs
- ErasingStroke.cs
- TraceSection.cs
- HTMLTagNameToTypeMapper.cs
- PersonalizationProvider.cs
- HTTPNotFoundHandler.cs
- ProxyHelper.cs
- NaturalLanguageHyphenator.cs
- SafeThreadHandle.cs
- ContentControl.cs
- COM2Properties.cs
- ToolStripHighContrastRenderer.cs
- TextParaLineResult.cs
- WebPartsPersonalizationAuthorization.cs
- JoinTreeSlot.cs
- ClientConfigPaths.cs
- BinaryReader.cs
- CodeCommentStatementCollection.cs
- StringAnimationUsingKeyFrames.cs
- InternalUserCancelledException.cs
- ActiveXHelper.cs
- TextTreeNode.cs
- DbFunctionCommandTree.cs
- StatusBarDrawItemEvent.cs
- ParentUndoUnit.cs
- ScriptManagerProxy.cs
- VisualStyleTypesAndProperties.cs
- TCEAdapterGenerator.cs
- ConfigXmlWhitespace.cs
- DiscoveryClientProtocol.cs
- CalendarDataBindingHandler.cs
- ItemMap.cs
- RijndaelCryptoServiceProvider.cs
- TreeChangeInfo.cs
- CalendarTable.cs
- SiteMapSection.cs
- Bidi.cs
- Rotation3D.cs
- SizeF.cs
- PermissionAttributes.cs
- Configuration.cs
- RIPEMD160Managed.cs
- MetadataCacheItem.cs
- WindowsEditBoxRange.cs
- ConnectionStringEditor.cs
- SortedList.cs
- Column.cs
- ServiceModelReg.cs
- Rfc2898DeriveBytes.cs
- ProfilePropertySettingsCollection.cs
- PropertyGridCommands.cs
- ThreadStateException.cs
- followingquery.cs
- StoreItemCollection.cs
- MarshalDirectiveException.cs
- RotateTransform3D.cs
- RSAPKCS1KeyExchangeDeformatter.cs
- StyleBamlTreeBuilder.cs
- ControlEvent.cs
- SqlTypeConverter.cs
- PropertyChangeTracker.cs
- FileSecurity.cs
- GB18030Encoding.cs
- elementinformation.cs
- HMACSHA384.cs
- WorkflowServiceNamespace.cs
- DbLambda.cs
- HttpWriter.cs
- ThicknessAnimationBase.cs
- StreamGeometryContext.cs
- GlyphRunDrawing.cs
- DataObjectAttribute.cs
- CodeChecksumPragma.cs
- DbSourceCommand.cs
- MasterPageCodeDomTreeGenerator.cs
- FormatControl.cs
- EntitySetDataBindingList.cs
- PersistChildrenAttribute.cs
- MessageDirection.cs
- PageMediaType.cs
- UnsafeNativeMethodsTablet.cs
- ColumnMap.cs
- SynchronizingStream.cs
- MatrixValueSerializer.cs
- EasingKeyFrames.cs
- WebPartConnectionsConfigureVerb.cs
- BufferedGraphicsManager.cs