Exemplo n.º 1
0
        private void AddChildStates(IReadOnlyNodeStateList stateList, IReadOnlyNodeState state)
        {
            stateList.Add(state);

            foreach (KeyValuePair <string, IReadOnlyInner> Entry in state.InnerTable)
            {
                AddChildInner(stateList, Entry.Value);
            }
        }
Exemplo n.º 2
0
        private void AddChildInner(IReadOnlyNodeStateList stateList, IReadOnlyInner inner)
        {
            bool IsHandled = false;

            switch (inner)
            {
            case IReadOnlyPlaceholderInner AsPlaceholderInner:
                AddChildStates(stateList, AsPlaceholderInner.ChildState);
                IsHandled = true;
                break;

            case IReadOnlyOptionalInner AsOptionalInner:
                if (AsOptionalInner.IsAssigned)
                {
                    AddChildStates(stateList, AsOptionalInner.ChildState);
                }
                IsHandled = true;
                break;

            case IReadOnlyListInner AsListInner:
                foreach (IReadOnlyNodeState ChildState in AsListInner.StateList)
                {
                    AddChildStates(stateList, ChildState);
                }
                IsHandled = true;
                break;

            case IReadOnlyBlockListInner AsBlockListInner:
                foreach (IReadOnlyBlockState Block in AsBlockListInner.BlockStateList)
                {
                    stateList.Add(Block.PatternState);
                    stateList.Add(Block.SourceState);

                    foreach (IReadOnlyNodeState ChildState in Block.StateList)
                    {
                        AddChildStates(stateList, ChildState);
                    }
                }
                IsHandled = true;
                break;
            }

            Debug.Assert(IsHandled);
        }