private protected virtual void InitInnerTable(IReadOnlyInnerReadOnlyDictionary <string> innerTable) { Debug.Assert(innerTable != null); Debug.Assert(InnerTable == null); InnerTable = innerTable; }
/// <summary> /// Initializes the block state. /// </summary> public virtual void InitBlockState() { PatternIndex = CreateExistingPatternIndex(); PatternState = CreatePatternState(PatternIndex); IReadOnlyInnerReadOnlyDictionary <string> PatternEmptyInnerTable = CreateInnerTable().ToReadOnly(); Dictionary <string, ValuePropertyType> PatternValuePropertyTypeTable = new Dictionary <string, ValuePropertyType>(); PatternValuePropertyTypeTable.Add(nameof(IPattern.Text), ValuePropertyType.String); ((IReadOnlyPatternState <IInner>)PatternState).Init(PatternInner, PatternEmptyInnerTable, PatternValuePropertyTypeTable); Debug.Assert(PatternState.ToString() != null); // For code coverage. SourceIndex = CreateExistingSourceIndex(); SourceState = CreateSourceState(SourceIndex); IReadOnlyInnerReadOnlyDictionary <string> SourceEmptyInnerTable = CreateInnerTable().ToReadOnly(); Dictionary <string, ValuePropertyType> SourceValuePropertyTypeTable = new Dictionary <string, ValuePropertyType>(); SourceValuePropertyTypeTable.Add(nameof(IIdentifier.Text), ValuePropertyType.String); ((IReadOnlySourceState <IInner>)SourceState).Init(SourceInner, SourceEmptyInnerTable, SourceValuePropertyTypeTable); Debug.Assert(SourceState.ToString() != null); // For code coverage. }
/// <summary> /// Initializes a newly created state. /// </summary> /// <param name="parentInner">Inner containing this state.</param> /// <param name="innerTable">Table for all inners in this state.</param> /// <param name="valuePropertyTable">Table of children that are not nodes.</param> public virtual void Init(IReadOnlyInner <IReadOnlyBrowsingChildIndex> parentInner, IReadOnlyInnerReadOnlyDictionary <string> innerTable, IReadOnlyDictionary <string, ValuePropertyType> valuePropertyTable) { Debug.Assert(innerTable != null); Debug.Assert(valuePropertyTable != null); Debug.Assert(!IsInitialized); Debug.Assert(ParentInner == null); Debug.Assert(InnerTable == null); Debug.Assert(ValuePropertyTypeTable == null); InitParentInner(parentInner); if (parentInner != null) // The root node doesn't have a parent inner. { InitParentState(ParentInner.Owner); } InitInnerTable(innerTable); Dictionary <string, ValuePropertyType> Table = new Dictionary <string, ValuePropertyType>(); foreach (KeyValuePair <string, ValuePropertyType> Entry in valuePropertyTable) { Table.Add(Entry.Key, Entry.Value); } ValuePropertyTypeTable = Table; IsInitialized = true; CheckInvariant(); }