/// <summary> /// Replaces a node. /// </summary> /// <param name="operation">Details of the operation performed.</param> public virtual void Replace(IWriteableReplaceOperation operation) { int BlockIndex = operation.BlockIndex; Debug.Assert(BlockIndex >= 0 && BlockIndex < BlockStateList.Count); IWriteableBlockState BlockState = (IWriteableBlockState)BlockStateList[BlockIndex]; int Index = operation.Index; Debug.Assert(Index >= 0 && Index < BlockState.StateList.Count); IBlock ChildBlock = BlockState.ChildBlock; Node ParentNode = Owner.Node; IWriteableNodeState OldChildState = (IWriteableNodeState)BlockState.StateList[Index]; Node OldNode = OldChildState.Node; IWriteableBrowsingBlockNodeIndex OldBrowsingIndex = (IWriteableBrowsingBlockNodeIndex)OldChildState.ParentIndex; BlockState.Remove(OldBrowsingIndex, Index); NodeTreeHelperBlockList.ReplaceInBlock(ChildBlock, Index, operation.NewNode); IWriteableBrowsingExistingBlockNodeIndex NewBrowsingIndex = CreateBrowsingNodeIndex(operation.NewNode, BlockIndex, Index); IWriteablePlaceholderNodeState NewChildState = (IWriteablePlaceholderNodeState)CreateNodeState(NewBrowsingIndex); BlockState.Insert(NewBrowsingIndex, Index, NewChildState); operation.Update(OldBrowsingIndex, NewBrowsingIndex, OldNode, NewChildState); }
/// <summary> /// Update the operation with details. /// </summary> /// <param name="childState">State removed.</param> public virtual void Update(IWriteablePlaceholderNodeState childState) { Debug.Assert(childState != null); RemovedState = childState; RemovedNode = childState.Node; }
/// <summary> /// Handler called every time a state is removed from the controller. /// </summary> /// <param name="operation">Details of the operation performed.</param> private protected virtual void OnStateRemoved(WriteableRemoveNodeOperation operation) { IWriteablePlaceholderNodeState RemovedState = operation.RemovedState; Debug.Assert(RemovedState != null); Debug.Assert(!StateViewTable.ContainsKey(RemovedState)); }
/// <summary> /// Inserts a new node in a list. /// </summary> /// <param name="operation">Details of the operation performed.</param> public virtual void Insert(WriteableInsertNodeOperation operation) { int InsertionIndex = operation.Index; Debug.Assert(InsertionIndex >= 0 && InsertionIndex <= StateList.Count); Node ParentNode = Owner.Node; Node Node = operation.Node; NodeTreeHelperList.InsertIntoList(ParentNode, PropertyName, InsertionIndex, Node); IWriteableBrowsingListNodeIndex BrowsingIndex = CreateBrowsingNodeIndex(Node, InsertionIndex); IWriteablePlaceholderNodeState ChildState = (IWriteablePlaceholderNodeState)CreateNodeState(BrowsingIndex); InsertInStateList(InsertionIndex, ChildState); operation.Update(BrowsingIndex, ChildState); while (++InsertionIndex < StateList.Count) { IWriteablePlaceholderNodeState State = (IWriteablePlaceholderNodeState)StateList[InsertionIndex]; IWriteableBrowsingListNodeIndex NodeIndex = State.ParentIndex as IWriteableBrowsingListNodeIndex; Debug.Assert(NodeIndex != null); Debug.Assert(NodeIndex.Index == InsertionIndex - 1); NodeIndex.MoveUp(); } }
/// <summary> /// Removes a node from a list or block list. /// </summary> /// <param name="operation">Details of the operation performed.</param> public virtual void Remove(WriteableRemoveNodeOperation operation) { int RemoveIndex = operation.Index; Debug.Assert(RemoveIndex >= 0 && RemoveIndex < StateList.Count); IWriteablePlaceholderNodeState OldChildState = (IWriteablePlaceholderNodeState)StateList[RemoveIndex]; RemoveFromStateList(RemoveIndex); Node ParentNode = Owner.Node; NodeTreeHelperList.RemoveFromList(ParentNode, PropertyName, RemoveIndex); while (RemoveIndex < StateList.Count) { IWriteablePlaceholderNodeState State = (IWriteablePlaceholderNodeState)StateList[RemoveIndex]; IWriteableBrowsingListNodeIndex NodeIndex = State.ParentIndex as IWriteableBrowsingListNodeIndex; Debug.Assert(NodeIndex != null); Debug.Assert(NodeIndex.Index == RemoveIndex + 1); NodeIndex.MoveDown(); RemoveIndex++; } operation.Update(OldChildState); }
/// <summary> /// Replaces a node. /// </summary> /// <param name="operation">Details of the operation performed.</param> public virtual void Replace(IWriteableReplaceOperation operation) { Debug.Assert(operation != null); int Index = operation.Index; Debug.Assert(Index >= 0 && Index < StateList.Count); INode ParentNode = Owner.Node; IWriteableNodeState OldChildState = StateList[Index]; INode OldNode = OldChildState.Node; IWriteableBrowsingListNodeIndex OldBrowsingIndex = (IWriteableBrowsingListNodeIndex)OldChildState.ParentIndex; RemoveFromStateList(Index); NodeTreeHelperList.ReplaceNode(ParentNode, PropertyName, Index, operation.NewNode); IWriteableBrowsingListNodeIndex NewBrowsingIndex = CreateBrowsingNodeIndex(operation.NewNode, Index); IWriteablePlaceholderNodeState NewChildState = (IWriteablePlaceholderNodeState)CreateNodeState(NewBrowsingIndex); InsertInStateList(Index, NewChildState); operation.Update(OldBrowsingIndex, NewBrowsingIndex, OldNode, NewChildState); }
/// <summary> /// Update the operation with details. /// </summary> /// <param name="childState">State removed.</param> public virtual void Update(IWriteablePlaceholderNodeState childState) { Contract.RequireNotNull(childState, out IWriteablePlaceholderNodeState ChildState); RemovedState = ChildState; RemovedNode = ChildState.Node; }
/// <summary> /// Update the operation with details. /// </summary> /// <param name="browsingIndex">Index of the state after it's inserted.</param> /// <param name="childState">State inserted.</param> public virtual void Update(IWriteableBrowsingCollectionNodeIndex browsingIndex, IWriteablePlaceholderNodeState childState) { Debug.Assert(browsingIndex != null); Debug.Assert(childState != null); BrowsingIndex = browsingIndex; ChildState = childState; }
/// <summary> /// Update the operation with details. /// </summary> /// <param name="browsingIndex">Index of the state after it's inserted.</param> /// <param name="childState">State inserted.</param> public virtual void Update(IWriteableBrowsingCollectionNodeIndex browsingIndex, IWriteablePlaceholderNodeState childState) { Contract.RequireNotNull(browsingIndex, out IWriteableBrowsingCollectionNodeIndex BrowsingIndex); Contract.RequireNotNull(childState, out IWriteablePlaceholderNodeState ChildState); this.BrowsingIndex = BrowsingIndex; this.ChildState = ChildState; }
/// <summary> /// Merges two blocks at the given index. /// </summary> /// <param name="operation">Details of the operation performed.</param> public virtual void MergeBlocks(IWriteableMergeBlocksOperation operation) { Debug.Assert(operation != null); int MergeBlockIndex = operation.BlockIndex; Debug.Assert(MergeBlockIndex > 0 && MergeBlockIndex < BlockStateList.Count); IWriteableBlockState FirstBlockState = BlockStateList[MergeBlockIndex - 1]; IWriteableBlockState SecondBlockState = BlockStateList[MergeBlockIndex]; int MergeIndex = FirstBlockState.StateList.Count; Debug.Assert(MergeIndex > 0); NodeTreeHelperBlockList.MergeBlocks(Owner.Node, PropertyName, MergeBlockIndex, out IBlock mergedBlock); Debug.Assert(FirstBlockState.ChildBlock == mergedBlock); RemoveFromBlockStateList(MergeBlockIndex - 1); operation.Update(FirstBlockState, MergeIndex); int i; for (i = 0; i < MergeIndex; i++) { IWriteablePlaceholderNodeState State = FirstBlockState.StateList[0]; IWriteableBrowsingExistingBlockNodeIndex ChildNodeIndex = State.ParentIndex as IWriteableBrowsingExistingBlockNodeIndex; Debug.Assert(ChildNodeIndex != null); FirstBlockState.Remove(ChildNodeIndex, 0); SecondBlockState.Insert(ChildNodeIndex, i, State); } for (; i < SecondBlockState.StateList.Count; i++) { IWriteablePlaceholderNodeState State = SecondBlockState.StateList[i]; IWriteableBrowsingExistingBlockNodeIndex ChildNodeIndex = State.ParentIndex as IWriteableBrowsingExistingBlockNodeIndex; Debug.Assert(ChildNodeIndex != null); ChildNodeIndex.MoveBlockDown(); for (int j = 0; j < MergeIndex; j++) { ChildNodeIndex.MoveUp(); } } for (i = MergeBlockIndex; i < BlockStateList.Count; i++) { foreach (IWriteablePlaceholderNodeState State in BlockStateList[i].StateList) { IWriteableBrowsingExistingBlockNodeIndex ChildNodeIndex = State.ParentIndex as IWriteableBrowsingExistingBlockNodeIndex; Debug.Assert(ChildNodeIndex != null); ChildNodeIndex.MoveBlockDown(); } } }
/// <summary> /// Handler called every time a state is moved in the controller. /// </summary> /// <param name="operation">Details of the operation performed.</param> private protected virtual void OnStateMoved(WriteableMoveNodeOperation operation) { Debug.Assert(!operation.IsNested); IWriteablePlaceholderNodeState State = operation.State; Debug.Assert(State != null); Debug.Assert(StateViewTable.ContainsKey(State)); }
/// <summary> /// Update the operation with details. /// </summary> /// <param name="browsingIndex">Index of the state after it's inserted.</param> /// <param name="blockState">Block state inserted.</param> /// <param name="childState">State inserted.</param> public virtual void Update(IWriteableBrowsingExistingBlockNodeIndex browsingIndex, IWriteableBlockState blockState, IWriteablePlaceholderNodeState childState) { Debug.Assert(browsingIndex != null); Debug.Assert(blockState != null); Debug.Assert(childState != null); BrowsingIndex = browsingIndex; BlockState = blockState; ChildState = childState; }
/// <summary> /// Update the operation with details. /// </summary> /// <param name="browsingIndex">Index of the state after it's inserted.</param> /// <param name="blockState">Block state inserted.</param> /// <param name="childState">State inserted.</param> public virtual void Update(IWriteableBrowsingExistingBlockNodeIndex browsingIndex, IWriteableBlockState blockState, IWriteablePlaceholderNodeState childState) { Contract.RequireNotNull(browsingIndex, out IWriteableBrowsingExistingBlockNodeIndex BrowsingIndex); Contract.RequireNotNull(blockState, out IWriteableBlockState BlockState); Contract.RequireNotNull(childState, out IWriteablePlaceholderNodeState ChildState); this.BrowsingIndex = BrowsingIndex; this.BlockState = BlockState; this.ChildState = ChildState; }
/// <summary> /// Inserts a new block with one node in a block list. /// </summary> /// <param name="operation">Details of the operation performed.</param> public virtual void InsertNewBlock(IWriteableInsertBlockOperation operation) { Debug.Assert(operation != null); int BlockIndex = operation.BlockIndex; Debug.Assert(BlockIndex >= 0 && BlockIndex <= BlockStateList.Count); IBlock NewBlock = operation.Block; Debug.Assert(NewBlock != null); INode NewNode = operation.Node; Debug.Assert(NewBlock != null); INode ParentNode = Owner.Node; NodeTreeHelperBlockList.InsertIntoBlockList(ParentNode, PropertyName, BlockIndex, NewBlock); NodeTreeHelperBlockList.InsertIntoBlock(NewBlock, 0, NewNode); IWriteableBrowsingNewBlockNodeIndex BrowsingNewBlockIndex = CreateNewBlockNodeIndex(NewNode, BlockIndex); IWriteableBrowsingExistingBlockNodeIndex BrowsingExistingBlockIndex = (IWriteableBrowsingExistingBlockNodeIndex)BrowsingNewBlockIndex.ToExistingBlockIndex(); IWriteableBlockState BlockState = (IWriteableBlockState)CreateBlockState(BrowsingNewBlockIndex, NewBlock); InsertInBlockStateList(BlockIndex, BlockState); IWriteablePlaceholderNodeState ChildState = (IWriteablePlaceholderNodeState)CreateNodeState(BrowsingExistingBlockIndex); BlockState.Insert(BrowsingExistingBlockIndex, 0, ChildState); operation.Update(BrowsingExistingBlockIndex, BlockState, ChildState); while (++BlockIndex < BlockStateList.Count) { IWriteableBlockState NextBlockState = BlockStateList[BlockIndex]; foreach (IWriteablePlaceholderNodeState State in NextBlockState.StateList) { IWriteableBrowsingExistingBlockNodeIndex NodeIndex = State.ParentIndex as IWriteableBrowsingExistingBlockNodeIndex; Debug.Assert(NodeIndex != null); Debug.Assert(NodeIndex.BlockIndex == BlockIndex - 1); NodeIndex.MoveBlockUp(); } } }
/// <summary> /// Replaces a node. /// </summary> /// <param name="operation">Details of the operation performed.</param> public virtual void Replace(IWriteableReplaceOperation operation) { Node ParentNode = Owner.Node; IWriteableBrowsingPlaceholderNodeIndex OldBrowsingIndex = (IWriteableBrowsingPlaceholderNodeIndex)ChildState.ParentIndex; IWriteablePlaceholderNodeState OldChildState = (IWriteablePlaceholderNodeState)ChildState; Node OldNode = OldChildState.Node; NodeTreeHelperChild.SetChildNode(ParentNode, PropertyName, operation.NewNode); IWriteableBrowsingPlaceholderNodeIndex NewBrowsingIndex = CreateBrowsingNodeIndex(operation.NewNode); IWriteablePlaceholderNodeState NewChildState = (IWriteablePlaceholderNodeState)CreateNodeState(NewBrowsingIndex); SetChildState(NewChildState); operation.Update(OldBrowsingIndex, NewBrowsingIndex, OldNode, NewChildState); }
/// <summary> /// Handler called every time a block state is inserted in the controller. /// </summary> /// <param name="operation">Details of the operation performed.</param> private protected virtual void OnBlockStateInserted(IWriteableInsertBlockOperation operation) { IWriteableBlockState BlockState = operation.BlockState; Debug.Assert(BlockState != null); Debug.Assert(BlockStateViewTable.ContainsKey(BlockState)); Debug.Assert(StateViewTable.ContainsKey(BlockState.PatternState)); Debug.Assert(StateViewTable.ContainsKey(BlockState.SourceState)); Debug.Assert(BlockState.StateList.Count == 1); IWriteablePlaceholderNodeState ChildState = operation.ChildState; Debug.Assert(ChildState == BlockState.StateList[0]); Debug.Assert(ChildState.ParentIndex == operation.BrowsingIndex); Debug.Assert(StateViewTable.ContainsKey(ChildState)); }
private protected virtual void ExecuteInsertNewNode(WriteableInsertNodeOperation operation) { Node ParentNode = operation.ParentNode; string PropertyName = operation.PropertyName; IWriteableCollectionInner <IWriteableBrowsingCollectionNodeIndex> Inner = GetInner(ParentNode, PropertyName) as IWriteableCollectionInner <IWriteableBrowsingCollectionNodeIndex>; Inner.Insert(operation); IWriteableBrowsingCollectionNodeIndex BrowsingIndex = operation.BrowsingIndex; IWriteablePlaceholderNodeState ChildState = operation.ChildState; AddState(BrowsingIndex, ChildState); Stats.PlaceholderNodeCount++; BuildStateTable(Inner, null, BrowsingIndex, ChildState); Debug.Assert(Contains(BrowsingIndex)); NotifyStateInserted(operation); }
/// <summary> /// Inserts a new node in a block list. /// </summary> /// <param name="operation">Details of the operation performed.</param> public virtual void Insert(IWriteableInsertNodeOperation operation) { Debug.Assert(operation != null); int BlockIndex = operation.BlockIndex; Debug.Assert(BlockIndex >= 0 && BlockIndex < BlockStateList.Count); IWriteableBlockState BlockState = BlockStateList[BlockIndex]; int Index = operation.Index; Debug.Assert(Index >= 0 && Index <= BlockState.StateList.Count); INode ParentNode = Owner.Node; IBlock ChildBlock = BlockState.ChildBlock; INode Node = operation.Node; NodeTreeHelperBlockList.InsertIntoBlock(ChildBlock, Index, Node); IWriteableBrowsingBlockNodeIndex BrowsingBlockIndex = CreateBrowsingNodeIndex(Node, BlockIndex, Index); IWriteablePlaceholderNodeState ChildState = (IWriteablePlaceholderNodeState)CreateNodeState(BrowsingBlockIndex); BlockState.Insert(BrowsingBlockIndex, Index, ChildState); operation.Update(BrowsingBlockIndex, ChildState); while (++Index < BlockState.StateList.Count) { IWriteablePlaceholderNodeState State = BlockState.StateList[Index]; IWriteableBrowsingExistingBlockNodeIndex NodeIndex = State.ParentIndex as IWriteableBrowsingExistingBlockNodeIndex; Debug.Assert(NodeIndex != null); Debug.Assert(NodeIndex.BlockIndex == BrowsingBlockIndex.BlockIndex); Debug.Assert(NodeIndex.Index == Index - 1); NodeIndex.MoveUp(); } }
private protected virtual void Expand(IWriteableNodeIndex expandedIndex, WriteableOperationList operationList) { IWriteablePlaceholderNodeState State = StateTable[expandedIndex] as IWriteablePlaceholderNodeState; State = FindBestExpandReduceState(State); Debug.Assert(State != null); WriteableInnerReadOnlyDictionary <string> InnerTable = State.InnerTable; foreach (string Key in InnerTable.Keys) { IWriteableInner Value = (IWriteableInner)InnerTable[Key]; if (Value is IWriteableOptionalInner <IWriteableBrowsingOptionalNodeIndex> AsOptionalInner) { ExpandOptional(AsOptionalInner, operationList); } else if (Value is IWriteableBlockListInner <IWriteableBrowsingBlockNodeIndex> AsBlockListInner) { ExpandBlockList(AsBlockListInner, operationList); } } }
private protected virtual void ExecuteInsertNewBlock(IWriteableInsertBlockOperation operation) { Node ParentNode = operation.ParentNode; string PropertyName = operation.PropertyName; IWriteableBlockListInner <IWriteableBrowsingBlockNodeIndex> Inner = GetInner(ParentNode, PropertyName) as IWriteableBlockListInner <IWriteableBrowsingBlockNodeIndex>; Inner.InsertNewBlock(operation); IWriteableBrowsingExistingBlockNodeIndex BrowsingIndex = operation.BrowsingIndex; IWriteableBlockState BlockState = operation.BlockState; IWriteablePlaceholderNodeState ChildState = operation.ChildState; Debug.Assert(BlockState.StateList.Count == 1); Debug.Assert(BlockState.StateList[0] == ChildState); ((IWriteableBlockState <IWriteableInner <IWriteableBrowsingChildIndex> >)BlockState).InitBlockState(); Stats.BlockCount++; IWriteableBrowsingPatternIndex PatternIndex = BlockState.PatternIndex; IWriteablePatternState PatternState = BlockState.PatternState; AddState(PatternIndex, PatternState); Stats.PlaceholderNodeCount++; IWriteableBrowsingSourceIndex SourceIndex = BlockState.SourceIndex; IWriteableSourceState SourceState = BlockState.SourceState; AddState(SourceIndex, SourceState); Stats.PlaceholderNodeCount++; AddState(BrowsingIndex, ChildState); Stats.PlaceholderNodeCount++; BuildStateTable(Inner, null, BrowsingIndex, ChildState); Debug.Assert(Contains(BrowsingIndex)); NotifyBlockStateInserted(operation); }
/// <summary> /// Initializes a new instance of the <see cref="WriteablePlaceholderNodeStateView"/> class. /// </summary> /// <param name="controllerView">The controller view to which this object belongs.</param> /// <param name="state">The child node state.</param> public WriteablePlaceholderNodeStateView(IWriteableControllerView controllerView, IWriteablePlaceholderNodeState state) : base(controllerView, state) { }
int IWriteablePlaceholderNodeStateReadOnlyList.IndexOf(IWriteablePlaceholderNodeState value) { return(IndexOf((IFocusPlaceholderNodeState)value)); }
void IList <IWriteablePlaceholderNodeState> .Insert(int index, IWriteablePlaceholderNodeState item) { Insert(index, (ILayoutPlaceholderNodeState)item); }
int IList <IWriteablePlaceholderNodeState> .IndexOf(IWriteablePlaceholderNodeState value) { return(IndexOf((ILayoutPlaceholderNodeState)value)); }
bool ICollection <IWriteablePlaceholderNodeState> .Remove(IWriteablePlaceholderNodeState item) { return(Remove((ILayoutPlaceholderNodeState)item)); }
bool ICollection <IWriteablePlaceholderNodeState> .Contains(IWriteablePlaceholderNodeState value) { return(Contains((ILayoutPlaceholderNodeState)value)); }
void ICollection <IWriteablePlaceholderNodeState> .Add(IWriteablePlaceholderNodeState item) { Add((ILayoutPlaceholderNodeState)item); }
private protected virtual void Remove(IWriteableRemoveBlockOperation blockOperation, WriteableRemoveNodeOperation nodeOperation, int blockIndex, int index) { Debug.Assert(blockIndex >= 0 && blockIndex < BlockStateList.Count); IWriteableBlockState BlockState = (IWriteableBlockState)BlockStateList[blockIndex]; Debug.Assert(index >= 0 && index < BlockState.StateList.Count); IBlock ChildBlock = BlockState.ChildBlock; Node ParentNode = Owner.Node; int i; IWriteablePlaceholderNodeState OldChildState = (IWriteablePlaceholderNodeState)BlockState.StateList[index]; Node RemovedNode = OldChildState.Node; BlockState.Remove((IWriteableBrowsingBlockNodeIndex)OldChildState.ParentIndex, index); NodeTreeHelperBlockList.RemoveFromBlock(ParentNode, PropertyName, blockIndex, index, out bool IsBlockRemoved); if (IsBlockRemoved) { Debug.Assert(blockOperation != null); RemoveFromBlockStateList(blockIndex); blockOperation.Update(BlockState, OldChildState); for (i = blockIndex; i < BlockStateList.Count; i++) { IWriteableBlockState NextBlockState = (IWriteableBlockState)BlockStateList[i]; foreach (IWriteablePlaceholderNodeState State in NextBlockState.StateList) { IWriteableBrowsingExistingBlockNodeIndex NodeIndex = State.ParentIndex as IWriteableBrowsingExistingBlockNodeIndex; Debug.Assert(NodeIndex != null); Debug.Assert(NodeIndex.BlockIndex == i + 1); NodeIndex.MoveBlockDown(); } } } else { Debug.Assert(nodeOperation != null); nodeOperation.Update(OldChildState); } i = index; while (i < BlockState.StateList.Count) { IWriteablePlaceholderNodeState State = (IWriteablePlaceholderNodeState)BlockState.StateList[i]; IWriteableBrowsingExistingBlockNodeIndex NodeIndex = State.ParentIndex as IWriteableBrowsingExistingBlockNodeIndex; Debug.Assert(NodeIndex != null); Debug.Assert(NodeIndex.BlockIndex == blockIndex); Debug.Assert(NodeIndex.Index == i + 1); NodeIndex.MoveDown(); i++; } }
/// <summary> /// Splits a block in two at the given index. /// </summary> /// <param name="operation">Details of the operation performed.</param> public virtual void SplitBlock(WriteableSplitBlockOperation operation) { int SplitBlockIndex = operation.BlockIndex; Debug.Assert(SplitBlockIndex >= 0 && SplitBlockIndex < BlockStateList.Count); int SplitIndex = operation.Index; Debug.Assert(SplitIndex > 0); IWriteableBlockState BlockState = (IWriteableBlockState)BlockStateList[SplitBlockIndex]; Debug.Assert(SplitIndex < BlockState.StateList.Count); IBlock NewBlock = operation.NewBlock; Debug.Assert(NewBlock != null); NodeTreeHelperBlockList.SplitBlock(Owner.Node, PropertyName, SplitBlockIndex, SplitIndex, NewBlock); NodeTreeHelperBlockList.GetChildNode(NewBlock, 0, out Node NewBlockFirstNode); IWriteableBrowsingNewBlockNodeIndex NewBlockIndex = CreateNewBlockNodeIndex(NewBlockFirstNode, SplitBlockIndex); IWriteableBlockState NewBlockState = (IWriteableBlockState)CreateBlockState(NewBlockIndex, NewBlock); ((IWriteableBlockState <IWriteableInner <IWriteableBrowsingChildIndex> >)NewBlockState).InitBlockState(); InsertInBlockStateList(NewBlockIndex.BlockIndex, NewBlockState); for (int i = 0; i < SplitIndex; i++) { IWriteablePlaceholderNodeState State = (IWriteablePlaceholderNodeState)BlockState.StateList[0]; IWriteableBrowsingExistingBlockNodeIndex ChildNodeIndex = State.ParentIndex as IWriteableBrowsingExistingBlockNodeIndex; Debug.Assert(ChildNodeIndex != null); BlockState.Remove(ChildNodeIndex, 0); NewBlockState.Insert(ChildNodeIndex, i, State); } operation.Update(NewBlockState); for (int i = 0; i < BlockState.StateList.Count; i++) { IWriteablePlaceholderNodeState State = (IWriteablePlaceholderNodeState)BlockState.StateList[i]; IWriteableBrowsingExistingBlockNodeIndex ChildNodeIndex = State.ParentIndex as IWriteableBrowsingExistingBlockNodeIndex; Debug.Assert(ChildNodeIndex != null); ChildNodeIndex.MoveBlockUp(); for (int j = 0; j < SplitIndex; j++) { ChildNodeIndex.MoveDown(); } } for (int i = SplitBlockIndex + 2; i < BlockStateList.Count; i++) { foreach (IWriteablePlaceholderNodeState State in BlockStateList[i].StateList) { IWriteableBrowsingExistingBlockNodeIndex ChildNodeIndex = State.ParentIndex as IWriteableBrowsingExistingBlockNodeIndex; Debug.Assert(ChildNodeIndex != null); ChildNodeIndex.MoveBlockUp(); } } }
/// <summary> /// Update the operation with details. /// </summary> /// <param name="state">State moved.</param> public virtual void Update(IWriteablePlaceholderNodeState state) { Debug.Assert(state != null); State = state; }