You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

state.go 1.1 kB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. package statelang
  2. type State interface {
  3. Name() string
  4. SetName(name string)
  5. Comment() string
  6. SetComment(comment string)
  7. Type() string
  8. SetType(typeName string)
  9. Next() string
  10. SetNext(next string)
  11. StateMachine() StateMachine
  12. SetStateMachine(machine StateMachine)
  13. }
  14. type BaseState struct {
  15. name string `alias:"Name"`
  16. comment string `alias:"Comment"`
  17. typeName string `alias:"Type"`
  18. next string `alias:"Next"`
  19. stateMachine StateMachine
  20. }
  21. func (b *BaseState) Name() string {
  22. return b.name
  23. }
  24. func (b *BaseState) SetName(name string) {
  25. b.name = name
  26. }
  27. func (b *BaseState) Comment() string {
  28. return b.comment
  29. }
  30. func (b *BaseState) SetComment(comment string) {
  31. b.comment = comment
  32. }
  33. func (b *BaseState) Type() string {
  34. return b.typeName
  35. }
  36. func (b *BaseState) SetType(typeName string) {
  37. b.typeName = typeName
  38. }
  39. func (b *BaseState) Next() string {
  40. return b.next
  41. }
  42. func (b *BaseState) SetNext(next string) {
  43. b.next = next
  44. }
  45. func (b *BaseState) StateMachine() StateMachine {
  46. return b.stateMachine
  47. }
  48. func (b *BaseState) SetStateMachine(machine StateMachine) {
  49. b.stateMachine = machine
  50. }