Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Structure transition labels #86

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

codesoap
Copy link
Contributor

Inspired by the discussion at #80 I have come up with a new suggestion for visualizing the different types of "self transitions". I'm using Graphviz ability to process HTML-like labels: https://graphviz.org/doc/info/shapes.html#html

The different types of transitions are now grouped and presented with a heading, which describes their type.

Exmaple

var (
	triggerEncounterProblem = "EncounterProblem"
	triggerPunchDesk        = "PunchDesk"
	triggerCry              = "Cry"
	triggerResolveProblems  = "ResolveProblems"
	stateHappy              = "Happy"
	stateUnhappy            = "Unhappy"
)
mood := stateless.NewStateMachine(stateHappy)
mood.Configure(stateHappy).
	Permit(triggerEncounterProblem, stateUnhappy)
mood.Configure(stateUnhappy).
	Permit(triggerResolveProblems, stateHappy).
	PermitReentry(triggerEncounterProblem).
	Ignore(triggerPunchDesk).
	Ignore(triggerCry)

Is rendered this way:
mood_demo

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant