#region Header



#endregion Header

using System;
using System.Collections;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Text;
using NGin.Core.Logging;

namespace NGin.Core.States.RHFSM
{
    /// <summary>
    /// The root element of a state tree within a <see cref="RHFSM.Machine"/>.
    /// </summary>
    /// <remarks>A class only used by the <see cref="RHFSM.Machine"/> for initialization of the state tree.</remarks>
    internal class MachineRoot : State
    {
        #region Fields

        #region Public Constant/Read-Only Fields

        public const string MACHINE_ROOT_NAME = "root";

        #endregion Public Constant/Read-Only Fields

        #endregion Fields

        #region Constructors

        #region Public Constructors

        /// <summary>
        /// Creates an instance of the root state element.
        /// </summary>
        /// <param name="machine">The machine owning the root element.</param>
        public MachineRoot( IMachine machine, ILogManager logManager )
            : base(MachineRoot.MACHINE_ROOT_NAME, null, null, logManager )
        {
            this.Machine = machine;
            this.subStatesList.Add( MachineRoot.MACHINE_ROOT_NAME, this );
        }

        //public void ClearSubStates()
        //{
        //    lock ( this.subStatesLock )
        //    {
        //        this.subStates.Clear();
        //        this.subStates.Add( MachineRoot.MACHINE_ROOT_NAME, this );
        //    }
        //}

        #endregion Public Constructors

        #endregion Constructors

        #region Properties

        #region Public Properties

        /// <summary>
        /// Gets the machine that owns this root element.
        /// </summary>
        /// <value>The <see cref="RHFSM.Machine"/>.</value>
        public IMachine Machine
        {
            get;
            private set;
        }

        #endregion Public Properties

        #endregion Properties
    }
}