AnyState.cs 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. #region --------------- Copyright Dresser Wayne Pignone -------------
  2. /*
  3. * $Log: /Wrk/WayneLibraries/Wrk/StateEngine/AnyState.cs $
  4. *
  5. * 3 08-03-25 14:25 Mattias.larsson
  6. * Added 'new' to FactoryName.
  7. *
  8. * 2 08-03-25 14:14 Mattias.larsson
  9. * Added static members FactoryName and GetInstanceName().
  10. */
  11. #endregion
  12. namespace Wayne.Lib.StateEngine
  13. {
  14. /// <summary>
  15. /// This is used to define the sourcestate as any state, a wildcard,
  16. /// if we want to create a general transition from a unspecified state in a machine.
  17. /// </summary>
  18. public sealed class AnyState : State
  19. {
  20. #region Static Fields
  21. private static string factoryName;
  22. #endregion
  23. #region Static Properties
  24. /// <summary>
  25. /// The factory name of the AnyState.
  26. /// </summary>
  27. public new static string FactoryName
  28. {
  29. get
  30. {
  31. if (factoryName == null)
  32. factoryName = typeof(AnyState).FullName;
  33. return factoryName;
  34. }
  35. }
  36. #endregion
  37. #region Static Methods
  38. /// <summary>
  39. /// Gets the name of this instance in a given configuration, using the supplied parent state instance name.
  40. /// </summary>
  41. /// <param name="parentStateInstanceName"></param>
  42. /// <returns></returns>
  43. public static string GetInstanceName(string parentStateInstanceName)
  44. {
  45. return string.Concat(parentStateInstanceName, ".", typeof(AnyState).Name);
  46. }
  47. #endregion
  48. }
  49. }