Ejemplo n.º 1
0
        private void PassThrough(IStateConfigurationVisitor visitor, Region region)
        {
            State state = this.GetState(region);

            if (state == null)
            {
                // Typically uninitialized StateConfiguration
                return;
            }

            if (state != State.Wildcard)
            {
#if !STAMA_COMPATIBLE21
                visitor.State(state);
#else
#pragma warning disable 0618
                visitor.State(state.Name);
#pragma warning restore 0618
#endif
                // Are there sub-states to traverse?
                if (state.Regions.Count > 0)
                {
                    visitor.BeginSubStates();

                    bool separatorNecessary = false;
                    foreach (Region subRegion in state.Regions)
                    {
                        // Regions shall be separated by "Next", if more than one region.
                        if (separatorNecessary)
                        {
                            visitor.NextSubState();
                        }
                        else
                        {
                            // For the first item do not emit a separator but
                            // take care of following items.
                            separatorNecessary = true;
                        }

                        // Recurse to subregions
                        this.PassThrough(visitor, subRegion);
                    }

                    visitor.EndSubStates();
                }
            }
            else
            {
                visitor.StateAny();
            }
        }
Ejemplo n.º 2
0
 /// <summary>
 /// Allows to collect the names of the contained <see cref="State"/> instances in a structured way.
 /// </summary>
 /// <param name="visitor">
 /// A <see cref="IStateConfigurationVisitor"/> instance.
 /// </param>
 public void PassThrough(IStateConfigurationVisitor visitor)
 {
     this.PassThrough(visitor, m_stateMachineTemplate.Root);
 }