github.com/Aoi-hosizora/ahlib@v1.5.1-0.20230404072829-241b93cf91c7/xstatus/xstatus_fsm.go (about)

     1  package xstatus
     2  
     3  // FsmStatus represents a status value for a demo finite status machine. Actually this is a dummy type.
     4  type FsmStatus uint64
     5  
     6  const (
     7  	FsmNone  FsmStatus = iota // None
     8  	FsmState                  // State
     9  	FsmFinal                  // Final
    10  
    11  	FsmTagA FsmStatus = iota + 98 // Tag a, start from 101
    12  	FsmTagB                       // Tag b
    13  	FsmTagC                       // Tag c
    14  	FsmTagD                       // Tag d
    15  	FsmTagE                       // Tag e
    16  	FsmTagF                       // Tag f
    17  	FsmTagG                       // Tag g
    18  )
    19  
    20  func (f FsmStatus) String() string {
    21  	switch f {
    22  	case FsmNone:
    23  		return "fsm-none"
    24  	case FsmState:
    25  		return "fsm-state"
    26  	case FsmFinal:
    27  		return "fsm-final"
    28  	case FsmTagA:
    29  		return "fsm-tag-a"
    30  	case FsmTagB:
    31  		return "fsm-tag-b"
    32  	case FsmTagC:
    33  		return "fsm-tag-c"
    34  	case FsmTagD:
    35  		return "fsm-tag-d"
    36  	case FsmTagE:
    37  		return "fsm-tag-e"
    38  	case FsmTagF:
    39  		return "fsm-tag-f"
    40  	case FsmTagG:
    41  		return "fsm-tag-g"
    42  	default:
    43  		return "fsm-?"
    44  	}
    45  }