AnyState.cs 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  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. using System;
  13. namespace Wayne.Lib.StateEngine
  14. {
  15. /// <summary>
  16. /// This is used to define the sourcestate as any state, a wildcard,
  17. /// if we want to create a general transition from a unspecified state in a machine.
  18. /// </summary>
  19. public sealed class AnyState : State
  20. {
  21. #region Static Fields
  22. private static string factoryName;
  23. #endregion
  24. #region Static Properties
  25. /// <summary>
  26. /// The factory name of the AnyState.
  27. /// </summary>
  28. public new static string FactoryName
  29. {
  30. get
  31. {
  32. if (factoryName == null)
  33. factoryName = typeof(AnyState).FullName;
  34. return factoryName;
  35. }
  36. }
  37. #endregion
  38. #region Static Methods
  39. /// <summary>
  40. /// Gets the name of this instance in a given configuration, using the supplied parent state instance name.
  41. /// </summary>
  42. /// <param name="parentStateInstanceName"></param>
  43. /// <returns></returns>
  44. public static string GetInstanceName(string parentStateInstanceName)
  45. {
  46. return string.Concat(parentStateInstanceName, ".", typeof(AnyState).Name);
  47. }
  48. #endregion
  49. }
  50. }