private protected virtual void InsertInStateList(int index, IReadOnlyPlaceholderNodeState nodeState)
        {
            Debug.Assert(index >= 0 && index <= _StateList.Count);
            Debug.Assert(nodeState.ParentIndex is IReadOnlyBrowsingListNodeIndex);

            _StateList.Insert(index, nodeState);
        }
        private protected virtual void InsertState(int index, IReadOnlyPlaceholderNodeState state)
        {
            Debug.Assert(index >= 0 && index <= _StateList.Count);
            Debug.Assert(state.ParentIndex is IReadOnlyBrowsingExistingBlockNodeIndex);

            _StateList.Insert(index, state);
        }
        /// <summary>
        /// Checks if a state is the child of another. This method returns true if <paramref name="parentState"/> and <paramref name="state"/> are the same.
        /// </summary>
        /// <param name="parentState">The parent state.</param>
        /// <param name="state">The state to check.</param>
        /// <param name="firstIndex">The first index in the chain leading from the parent to the child. Null if they are the same.</param>
        /// <returns>True if <paramref name="parentState"/> is <paramref name="state"/> or a parent; Otherwise, false.</returns>
        public virtual bool IsChildState(IReadOnlyNodeState parentState, IReadOnlyNodeState state, out IReadOnlyIndex firstIndex)
        {
            firstIndex = null;

            while (state != null)
            {
                if (state == parentState)
                {
                    return(true);
                }

                if (state is IReadOnlyPatternState AsPatternState)
                {
                    IReadOnlyBlockState BlockState = AsPatternState.ParentBlockState;
                    Debug.Assert(BlockState.StateList.Count > 0);
                    IReadOnlyPlaceholderNodeState FirstState = BlockState.StateList[0];
                    firstIndex = FirstState.ParentIndex;
                }
                else if (state is IReadOnlySourceState AsSourceState)
                {
                    IReadOnlyBlockState BlockState = AsSourceState.ParentBlockState;
                    Debug.Assert(BlockState.StateList.Count > 0);
                    IReadOnlyPlaceholderNodeState FirstState = BlockState.StateList[0];
                    firstIndex = FirstState.ParentIndex;
                }
                else
                {
                    firstIndex = state.ParentIndex;
                }

                state = state.ParentState;
            }

            return(false);
        }
Ejemplo n.º 4
0
        private protected virtual void MoveState(int index, int direction)
        {
            Debug.Assert(index >= 0 && index < _StateList.Count);
            Debug.Assert(index + direction >= 0 && index + direction < _StateList.Count);

            IReadOnlyPlaceholderNodeState NodeState = _StateList[index];

            _StateList.RemoveAt(index);
            _StateList.Insert(index + direction, NodeState);
        }
Ejemplo n.º 5
0
        /// <summary>
        /// Initializes a newly created state for the node in the inner.
        /// </summary>
        /// <param name="nodeIndex">Index of the node.</param>
        /// <returns>The created node state.</returns>
        private protected virtual IReadOnlyPlaceholderNodeState InitChildState(IReadOnlyBrowsingPlaceholderNodeIndex nodeIndex)
        {
            Debug.Assert(nodeIndex.PropertyName == PropertyName);
            Debug.Assert(ChildState == null);

            IReadOnlyPlaceholderNodeState State = CreateNodeState(nodeIndex);

            SetChildState(State);

            return(State);
        }
Ejemplo n.º 6
0
        private protected virtual void CloneChildren(INode parentNode, IBlock parentBlock)
        {
            for (int i = 0; i < StateList.Count; i++)
            {
                IReadOnlyPlaceholderNodeState ChildState = StateList[i];

                INode ChildNodeClone = ChildState.CloneNode();
                Debug.Assert(ChildNodeClone != null);

                NodeTreeHelperBlockList.InsertIntoBlock(parentBlock, i, ChildNodeClone);
            }
        }
        private protected virtual void SetRoot(IReadOnlyRootNodeIndex rootIndex)
        {
            Debug.Assert(!IsInitialized); // Must be called during initialization

            IReadOnlyPlaceholderNodeState State = CreateRootNodeState(rootIndex);

            RootIndex = rootIndex;
            RootState = State;
            AddState(RootIndex, State);

            // Recursively build all states, starting from the root.
            BuildStateTable(null, null, rootIndex, State);
        }
        /// <summary>
        /// Initializes a newly created state for a node in the inner.
        /// </summary>
        /// <param name="nodeIndex">Index of the node.</param>
        /// <returns>The created node state.</returns>
        private protected virtual IReadOnlyNodeState InitChildState(IReadOnlyBrowsingListNodeIndex nodeIndex)
        {
            Debug.Assert(nodeIndex.PropertyName == PropertyName);

            int Index = ((TIndex)nodeIndex).Index;

            Debug.Assert(Index == StateList.Count);

            IReadOnlyPlaceholderNodeState State = CreateNodeState(nodeIndex);

            InsertInStateList(Index, State);

            return(State);
        }
        /// <inheritdoc/>
        public override void CloneChildren(Node parentNode)
        {
            NodeTreeHelperList.ClearChildNodeList(parentNode, PropertyName);

            for (int i = 0; i < StateList.Count; i++)
            {
                IReadOnlyPlaceholderNodeState ChildState = StateList[i];

                // Clone all children recursively.
                Node ChildNodeClone = ChildState.CloneNode();
                Debug.Assert(ChildNodeClone != null);

                NodeTreeHelperList.InsertIntoList(parentNode, PropertyName, i, ChildNodeClone);
            }
        }
        /// <summary>
        /// Initializes a newly created state for a node in the inner.
        /// </summary>
        /// <param name="existingNodeIndex">Index of the node.</param>
        /// <returns>The created node state.</returns>
        private protected virtual IReadOnlyPlaceholderNodeState InitChildState(IReadOnlyBrowsingExistingBlockNodeIndex existingNodeIndex)
        {
            Debug.Assert(existingNodeIndex.PropertyName == PropertyName);

            int BlockIndex = existingNodeIndex.BlockIndex;
            int Index      = existingNodeIndex.Index;

            Debug.Assert(BlockIndex < BlockStateList.Count);

            IReadOnlyPlaceholderNodeState State        = CreateNodeState(existingNodeIndex);
            IReadOnlyBlockState           CurrentBlock = BlockStateList[BlockIndex];

            ((IReadOnlyBlockState <IReadOnlyInner <IReadOnlyBrowsingChildIndex> >)CurrentBlock).InitNodeState(State);

            return(State);
        }
        public static void ReadOnlyClone()
        {
            ControllerTools.ResetExpectedName();

            Main RootNode = CreateRoot(ValueGuid0, Imperfections.None);

            IReadOnlyRootNodeIndex RootIndex = new ReadOnlyRootNodeIndex(RootNode);

            Assert.That(RootIndex != null);

            ReadOnlyController Controller = ReadOnlyController.Create(RootIndex);

            Assert.That(Controller != null);

            IReadOnlyPlaceholderNodeState RootState = Controller.RootState;

            Assert.That(RootState != null);

            BaseNode.Node ClonedNode = RootState.CloneNode();
            Assert.That(BaseNodeHelper.NodeTreeDiagnostic.IsValid(ClonedNode));

            IReadOnlyRootNodeIndex CloneRootIndex = new ReadOnlyRootNodeIndex(ClonedNode);

            Assert.That(CloneRootIndex != null);

            ReadOnlyController CloneController = ReadOnlyController.Create(CloneRootIndex);

            Assert.That(CloneController != null);

            IReadOnlyPlaceholderNodeState CloneRootState = Controller.RootState;

            Assert.That(CloneRootState != null);

            ReadOnlyNodeStateReadOnlyList AllChildren      = RootState.GetAllChildren();
            ReadOnlyNodeStateReadOnlyList CloneAllChildren = CloneRootState.GetAllChildren();

            Assert.That(AllChildren.Count == CloneAllChildren.Count);
        }
 bool ICollection <IReadOnlyPlaceholderNodeState> .Contains(IReadOnlyPlaceholderNodeState value)
 {
     return(Contains((ILayoutPlaceholderNodeState)value));
 }
 bool ICollection <IReadOnlyPlaceholderNodeState> .Remove(IReadOnlyPlaceholderNodeState item)
 {
     return(Remove((ILayoutPlaceholderNodeState)item));
 }
 void IList <IReadOnlyPlaceholderNodeState> .Insert(int index, IReadOnlyPlaceholderNodeState item)
 {
     Insert(index, (ILayoutPlaceholderNodeState)item);
 }
 void ICollection <IReadOnlyPlaceholderNodeState> .Add(IReadOnlyPlaceholderNodeState item)
 {
     Add((ILayoutPlaceholderNodeState)item);
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="ReadOnlyPlaceholderNodeStateView"/> class.
 /// </summary>
 /// <param name="controllerView">The controller view to which this object belongs.</param>
 /// <param name="state">The child node state.</param>
 public ReadOnlyPlaceholderNodeStateView(IReadOnlyControllerView controllerView, IReadOnlyPlaceholderNodeState state)
     : base(controllerView, state)
 {
 }
 int IList <IReadOnlyPlaceholderNodeState> .IndexOf(IReadOnlyPlaceholderNodeState value)
 {
     return(IndexOf((ILayoutPlaceholderNodeState)value));
 }
 int IReadOnlyPlaceholderNodeStateReadOnlyList.IndexOf(IReadOnlyPlaceholderNodeState value)
 {
     return(IndexOf((IWriteablePlaceholderNodeState)value));
 }
Ejemplo n.º 19
0
        /// <summary>
        /// Initializes the state for a node of the block.
        /// </summary>
        /// <param name="state">The state to initialize.</param>
        public virtual void InitNodeState(IReadOnlyPlaceholderNodeState state)
        {
            Debug.Assert(state != null);

            InsertState(StateList.Count, state);
        }
        public static void ReadOnlyProperties()
        {
            ControllerTools.ResetExpectedName();

            Main RootNode;
            IReadOnlyRootNodeIndex RootIndex0;
            IReadOnlyRootNodeIndex RootIndex1;

            RootNode = CreateRoot(ValueGuid0, Imperfections.None);
            Assert.That(BaseNodeHelper.NodeTreeDiagnostic.IsValid(RootNode));

            RootIndex0 = new ReadOnlyRootNodeIndex(RootNode);
            Assert.That(RootIndex0.Node == RootNode);
            Assert.That(RootIndex0.IsEqual(CompareEqual.New(), RootIndex0));

            RootIndex1 = new ReadOnlyRootNodeIndex(RootNode);
            Assert.That(RootIndex1.Node == RootNode);
            Assert.That(CompareEqual.CoverIsEqual(RootIndex0, RootIndex1));

            ReadOnlyController Controller0 = ReadOnlyController.Create(RootIndex0);

            Assert.That(Controller0.RootIndex == RootIndex0);

            Stats Stats = Controller0.Stats;

            Assert.That(Stats.NodeCount >= 0);
            Assert.That(Stats.PlaceholderNodeCount >= 0);
            Assert.That(Stats.OptionalNodeCount >= 0);
            Assert.That(Stats.AssignedOptionalNodeCount >= 0);
            Assert.That(Stats.ListCount >= 0);
            Assert.That(Stats.BlockListCount >= 0);
            Assert.That(Stats.BlockCount >= 0);

            IReadOnlyPlaceholderNodeState RootState = Controller0.RootState;

            Assert.That(RootState.ParentIndex == RootIndex0);

            Assert.That(Controller0.Contains(RootIndex0));
            Assert.That(Controller0.IndexToState(RootIndex0) == RootState);

            Assert.That(RootState.InnerTable.Count == 8);
            Assert.That(RootState.InnerTable.ContainsKey(nameof(Main.PlaceholderTree)));
            Assert.That(RootState.InnerTable.ContainsKey(nameof(Main.PlaceholderLeaf)));
            Assert.That(RootState.InnerTable.ContainsKey(nameof(Main.UnassignedOptionalLeaf)));
            Assert.That(RootState.InnerTable.ContainsKey(nameof(Main.EmptyOptionalLeaf)));
            Assert.That(RootState.InnerTable.ContainsKey(nameof(Main.AssignedOptionalTree)));
            Assert.That(RootState.InnerTable.ContainsKey(nameof(Main.AssignedOptionalLeaf)));
            Assert.That(RootState.InnerTable.ContainsKey(nameof(Main.LeafBlocks)));
            Assert.That(RootState.InnerTable.ContainsKey(nameof(Main.LeafPath)));

            IReadOnlyPlaceholderInner MainPlaceholderTreeInner = (IReadOnlyPlaceholderInner)RootState.PropertyToInner(nameof(Main.PlaceholderTree));

            Assert.That(MainPlaceholderTreeInner != null);
            if (MainPlaceholderTreeInner != null)
            {
                Assert.That(MainPlaceholderTreeInner.InterfaceType.IsTypeof <Tree>());
                Assert.That(MainPlaceholderTreeInner.ChildState != null);
                Assert.That(MainPlaceholderTreeInner.ChildState?.ParentInner == MainPlaceholderTreeInner);
            }

            IReadOnlyPlaceholderInner MainPlaceholderLeafInner = (IReadOnlyPlaceholderInner)RootState.PropertyToInner(nameof(Main.PlaceholderLeaf));

            Assert.That(MainPlaceholderLeafInner != null);
            if (MainPlaceholderLeafInner != null)
            {
                Assert.That(MainPlaceholderLeafInner.InterfaceType.IsTypeof <Leaf>());
                Assert.That(MainPlaceholderLeafInner.ChildState != null);
                Assert.That(MainPlaceholderLeafInner.ChildState?.ParentInner == MainPlaceholderLeafInner);
            }

            IReadOnlyOptionalInner MainUnassignedOptionalInner = (IReadOnlyOptionalInner)RootState.PropertyToInner(nameof(Main.UnassignedOptionalLeaf));

            Assert.That(MainUnassignedOptionalInner != null);
            if (MainUnassignedOptionalInner != null)
            {
                Assert.That(MainUnassignedOptionalInner.InterfaceType.IsTypeof <Leaf>());
                Assert.That(!MainUnassignedOptionalInner.IsAssigned);
                Assert.That(MainUnassignedOptionalInner.ChildState != null);
                Assert.That(MainUnassignedOptionalInner.ChildState?.ParentInner == MainUnassignedOptionalInner);
            }

            IReadOnlyOptionalInner MainAssignedOptionalTreeInner = (IReadOnlyOptionalInner)RootState.PropertyToInner(nameof(Main.AssignedOptionalTree));

            Assert.That(MainAssignedOptionalTreeInner != null);
            if (MainAssignedOptionalTreeInner != null)
            {
                Assert.That(MainAssignedOptionalTreeInner.InterfaceType.IsTypeof <Tree>());
                Assert.That(MainAssignedOptionalTreeInner.IsAssigned);
            }

            IReadOnlyNodeState AssignedOptionalTreeState = MainAssignedOptionalTreeInner.ChildState;

            Assert.That(AssignedOptionalTreeState != null);
            if (AssignedOptionalTreeState != null)
            {
                Assert.That(AssignedOptionalTreeState.ParentInner == MainAssignedOptionalTreeInner);
                Assert.That(AssignedOptionalTreeState.ParentState == RootState);
            }

            ReadOnlyNodeStateReadOnlyList AssignedOptionalTreeAllChildren = AssignedOptionalTreeState.GetAllChildren();

            Assert.That(AssignedOptionalTreeAllChildren.Count == 2, $"New count: {AssignedOptionalTreeAllChildren.Count}");

            IReadOnlyOptionalInner MainAssignedOptionalLeafInner = (IReadOnlyOptionalInner)RootState.PropertyToInner(nameof(Main.AssignedOptionalLeaf));

            Assert.That(MainAssignedOptionalLeafInner != null);
            if (MainAssignedOptionalLeafInner != null)
            {
                Assert.That(MainAssignedOptionalLeafInner.InterfaceType.IsTypeof <Leaf>());
                Assert.That(MainAssignedOptionalLeafInner.IsAssigned);
                Assert.That(MainAssignedOptionalLeafInner.ChildState != null);
                Assert.That(MainAssignedOptionalLeafInner.ChildState.ParentInner == MainAssignedOptionalLeafInner);
            }

            IReadOnlyBlockListInner MainLeafBlocksInner = (IReadOnlyBlockListInner)RootState.PropertyToInner(nameof(Main.LeafBlocks));

            Assert.That(MainLeafBlocksInner != null);
            if (MainLeafBlocksInner != null)
            {
                Assert.That(!MainLeafBlocksInner.IsNeverEmpty);
                Assert.That(!MainLeafBlocksInner.IsEmpty);
                Assert.That(!MainLeafBlocksInner.IsSingle);
                Assert.That(MainLeafBlocksInner.InterfaceType.IsTypeof <Leaf>());
                Assert.That(MainLeafBlocksInner.BlockType.IsTypeof <BaseNode.IBlock <Leaf> >());
                Assert.That(MainLeafBlocksInner.ItemType.IsTypeof <Leaf>());
                Assert.That(MainLeafBlocksInner.Count == 4);
                Assert.That(MainLeafBlocksInner.BlockStateList != null);
                Assert.That(MainLeafBlocksInner.BlockStateList.Count == 3);
                Assert.That(MainLeafBlocksInner.AllIndexes().Count == MainLeafBlocksInner.Count);
            }

            IReadOnlyBlockState LeafBlock = MainLeafBlocksInner.BlockStateList[0];

            Assert.That(LeafBlock != null);
            if (LeafBlock != null)
            {
                Assert.That(LeafBlock.StateList != null);
                Assert.That(LeafBlock.StateList.Count == 1);
                Assert.That(MainLeafBlocksInner.FirstNodeState == LeafBlock.StateList[0]);
                Assert.That(MainLeafBlocksInner.IndexAt(0, 0) == MainLeafBlocksInner.FirstNodeState.ParentIndex);
                Assert.That(LeafBlock.Comment == "");
            }

            IReadOnlyPlaceholderInner PatternInner = (IReadOnlyPlaceholderInner)LeafBlock.PropertyToInner(nameof(BaseNode.IBlock.ReplicationPattern));

            Assert.That(PatternInner != null);

            IReadOnlyPlaceholderInner SourceInner = (IReadOnlyPlaceholderInner)LeafBlock.PropertyToInner(nameof(BaseNode.IBlock.SourceIdentifier));

            Assert.That(SourceInner != null);

            IReadOnlyPatternState PatternState = LeafBlock.PatternState;

            Assert.That(PatternState != null);
            if (PatternState != null)
            {
                Assert.That(PatternState.ParentInner == PatternInner);
                Assert.That(PatternState.ParentIndex == LeafBlock.PatternIndex);
            }

            IReadOnlySourceState SourceState = LeafBlock.SourceState;

            Assert.That(SourceState != null);
            if (SourceState != null)
            {
                Assert.That(SourceState.ParentInner == SourceInner);
                Assert.That(SourceState.ParentIndex == LeafBlock.SourceIndex);
            }

            Assert.That(MainLeafBlocksInner.FirstNodeState == LeafBlock.StateList[0]);

            IReadOnlyListInner MainLeafPathInner = (IReadOnlyListInner)RootState.PropertyToInner(nameof(Main.LeafPath));

            Assert.That(MainLeafPathInner != null);
            if (MainLeafPathInner != null)
            {
                Assert.That(!MainLeafPathInner.IsNeverEmpty);
                Assert.That(MainLeafPathInner.InterfaceType.IsTypeof <Leaf>());
                Assert.That(MainLeafPathInner.Count == 2);
                Assert.That(MainLeafPathInner.StateList != null);
                Assert.That(MainLeafPathInner.StateList?.Count == 2);
                Assert.That(MainLeafPathInner.FirstNodeState == MainLeafPathInner.StateList[0]);
                Assert.That(MainLeafPathInner.IndexAt(0) == MainLeafPathInner.FirstNodeState.ParentIndex);
                Assert.That(MainLeafPathInner.AllIndexes().Count == MainLeafPathInner.Count);
            }

            ReadOnlyNodeStateReadOnlyList AllChildren = RootState.GetAllChildren();

            Assert.That(AllChildren.Count == 19, $"New count: {AllChildren.Count}");

            IReadOnlyPlaceholderInner PlaceholderInner = (IReadOnlyPlaceholderInner)RootState.InnerTable[nameof(Main.PlaceholderLeaf)];

            Assert.That(PlaceholderInner != null);

            IReadOnlyBrowsingPlaceholderNodeIndex PlaceholderNodeIndex = (IReadOnlyBrowsingPlaceholderNodeIndex)PlaceholderInner.ChildState.ParentIndex;

            Assert.That(PlaceholderNodeIndex != null);
            Assert.That(Controller0.Contains(PlaceholderNodeIndex));

            IReadOnlyOptionalInner UnassignedOptionalInner = (IReadOnlyOptionalInner)RootState.InnerTable[nameof(Main.UnassignedOptionalLeaf)];

            Assert.That(UnassignedOptionalInner != null);

            IReadOnlyBrowsingOptionalNodeIndex UnassignedOptionalNodeIndex = UnassignedOptionalInner.ChildState.ParentIndex;

            Assert.That(UnassignedOptionalNodeIndex != null);
            Assert.That(Controller0.Contains(UnassignedOptionalNodeIndex));
            Assert.That(Controller0.IsAssigned(UnassignedOptionalNodeIndex) == false);

            IReadOnlyOptionalInner AssignedOptionalInner = (IReadOnlyOptionalInner)RootState.InnerTable[nameof(Main.AssignedOptionalLeaf)];

            Assert.That(AssignedOptionalInner != null);

            IReadOnlyBrowsingOptionalNodeIndex AssignedOptionalNodeIndex = AssignedOptionalInner.ChildState.ParentIndex;

            Assert.That(AssignedOptionalNodeIndex != null);
            Assert.That(Controller0.Contains(AssignedOptionalNodeIndex));
            Assert.That(Controller0.IsAssigned(AssignedOptionalNodeIndex) == true);

            int    Min, Max;
            object ReadValue;

            RootState.PropertyToValue(nameof(Main.ValueBoolean), out ReadValue, out Min, out Max);
            bool ReadAsBoolean = ((int)ReadValue) != 0;

            Assert.That(ReadAsBoolean == true);
            Assert.That(Controller0.GetDiscreteValue(RootIndex0, nameof(Main.ValueBoolean), out Min, out Max) == (ReadAsBoolean ? 1 : 0));
            Assert.That(Min == 0);
            Assert.That(Max == 1);

            RootState.PropertyToValue(nameof(Main.ValueEnum), out ReadValue, out Min, out Max);
            BaseNode.CopySemantic ReadAsEnum = (BaseNode.CopySemantic)(int) ReadValue;
            Assert.That(ReadAsEnum == BaseNode.CopySemantic.Value);
            Assert.That(Controller0.GetDiscreteValue(RootIndex0, nameof(Main.ValueEnum), out Min, out Max) == (int)ReadAsEnum);
            Assert.That(Min == 0);
            Assert.That(Max == 2);

            RootState.PropertyToValue(nameof(Main.ValueString), out ReadValue, out Min, out Max);
            string ReadAsString = ReadValue as string;

            Assert.That(ReadAsString == "s");
            Assert.That(Controller0.GetStringValue(RootIndex0, nameof(Main.ValueString)) == ReadAsString);

            RootState.PropertyToValue(nameof(Main.ValueGuid), out ReadValue, out Min, out Max);
            Guid ReadAsGuid = (Guid)ReadValue;

            Assert.That(ReadAsGuid == ValueGuid0);
            Assert.That(Controller0.GetGuidValue(RootIndex0, nameof(Main.ValueGuid)) == ReadAsGuid);

            ReadOnlyController Controller1 = ReadOnlyController.Create(RootIndex0);

            Assert.That(Controller0.IsEqual(CompareEqual.New(), Controller0));

            Assert.That(CompareEqual.CoverIsEqual(Controller0, Controller1));
        }
 bool IReadOnlyPlaceholderNodeStateReadOnlyList.Contains(IReadOnlyPlaceholderNodeState value)
 {
     return(Contains((IWriteablePlaceholderNodeState)value));
 }
 bool IReadOnlyPlaceholderNodeStateReadOnlyList.Contains(IReadOnlyPlaceholderNodeState value)
 {
     return(Contains((ILayoutPlaceholderNodeState)value));
 }
Ejemplo n.º 23
0
        private protected virtual void SetChildState(IReadOnlyPlaceholderNodeState childState)
        {
            Debug.Assert(childState != null);

            ChildState = childState;
        }
Ejemplo n.º 24
0
 int IReadOnlyPlaceholderNodeStateReadOnlyList.IndexOf(IReadOnlyPlaceholderNodeState value)
 {
     return(IndexOf((IFocusPlaceholderNodeState)value));
 }
Ejemplo n.º 25
0
 /// <summary>
 /// Creates a IxxxPlaceholderNodeStateView object.
 /// </summary>
 private protected override ReadOnlyPlaceholderNodeStateView CreatePlaceholderNodeStateView(IReadOnlyPlaceholderNodeState state)
 {
     ControllerTools.AssertNoOverride(this, Type.FromTypeof <WriteableControllerView>());
     return(new WriteablePlaceholderNodeStateView(this, (IWriteablePlaceholderNodeState)state));
 }
        /// <summary>
        /// Inserts a new node in a block.
        /// </summary>
        /// <param name="nodeIndex">Index of the node to insert.</param>
        /// <param name="index">Position of the inserted node in the block.</param>
        /// <param name="childState">Node state.</param>
        public virtual void Insert(IWriteableBrowsingBlockNodeIndex nodeIndex, int index, IReadOnlyPlaceholderNodeState childState)
        {
            Debug.Assert(index >= 0 && index <= StateList.Count);

            InsertState(index, childState);
        }
Ejemplo n.º 27
0
 private protected virtual void SetChildState(IReadOnlyPlaceholderNodeState childState)
 {
     ChildState = childState;
 }
 /// <summary>
 /// Initializes the state for a node of the block.
 /// </summary>
 /// <param name="state">The state to initialize.</param>
 public virtual void InitNodeState(IReadOnlyPlaceholderNodeState state)
 {
     InsertState(StateList.Count, state);
 }
Ejemplo n.º 29
0
 /// <summary>
 /// Creates a IxxxPlaceholderNodeStateView object.
 /// </summary>
 private protected virtual IReadOnlyPlaceholderNodeStateView CreatePlaceholderNodeStateView(IReadOnlyPlaceholderNodeState state)
 {
     ControllerTools.AssertNoOverride(this, typeof(ReadOnlyControllerView));
     return(new ReadOnlyPlaceholderNodeStateView(this, state));
 }
Ejemplo n.º 30
0
 void ICollection <IReadOnlyPlaceholderNodeState> .Add(IReadOnlyPlaceholderNodeState item)
 {
     Add((IWriteablePlaceholderNodeState)item);
 }