/// <summary> /// Initializes a new instance of the <see cref="PseudoState"/> class. /// </summary> /// <param name="kind">The kind or type of Pseudo state.</param> /// <param name="context">The associated state owning this pseudo state.</param> /// <exception cref="ArgumentNullException"><paramref name="context"/> is a <see langword="null"/> reference.</exception> public PseudoState(PseudoStateKind kind, IState context) { if (context == null) { throw new ArgumentNullException("context"); } this.kind = kind; this.state = context; }
/// <summary> /// Initializes a new instance of the <see cref="PseudoState"/> class. /// </summary> /// <param name="kind">The kind or type of Pseudo state.</param> /// <param name="context">The associated state machine to this pseudo state.</param> /// <exception cref="ArgumentNullException"><paramref name="context"/> is a <see langword="null"/> reference.</exception> /// <exception cref="ArgumentException">Is thrown when the <paramref name="kind"/> is not of type Entry or Exit point.</exception> public PseudoState(PseudoStateKind kind, IStateMachine context) { if (context == null) { throw new ArgumentNullException("context"); } if (kind != PseudoStateKind.EntryPoint || kind != PseudoStateKind.ExitPoint) { throw new ArgumentException("Kind of pseudo state must be of type EntryPoint or ExitPoint."); } this.kind = kind; this.statemachine = context; }
/// <summary> /// Creates a new pseudo state as a child of a region. /// </summary> /// <param name="region">The parent region.</param> /// <param name="name">The name of the new pseudo state.</param> /// <param name="kind">The kind of the new pseudo state.</param> /// <returns>The newly created pseudo state.</returns> public PseudoState(string name, Region <TInstance> region, PseudoStateKind kind = PseudoStateKind.Initial) : base(name, region) { this.Kind = kind; }
/// <summary> /// Creates a new pseudo state as a child of a state. /// </summary> /// <typeparam name="TInstance">The type of the state machine instance.</typeparam> /// <param name="state">The parent state.</param> /// <param name="name">The name of the new pseudo state.</param> /// <param name="kind">The kind of the new pseudo state.</param> /// <returns>The newly created pseudo state.</returns> /// <remarks>The newly created pseduo state will be created in the default region of the parent state. The default region will be created as required.</remarks> public static PseudoState <TInstance> CreatePseudoState <TInstance>(this State <TInstance> state, string name, PseudoStateKind kind = PseudoStateKind.Initial) where TInstance : IInstance <TInstance> { return(new PseudoState <TInstance>(name, state, kind)); }