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

Add docstring to transition #1079

Merged
merged 2 commits into from
Feb 27, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions src/equations.jl
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,21 @@ function Base.:(==)(transition1::Transition, transition2::Transition)
transition1.synchronize == transition2.synchronize &&
transition1.priority == transition2.priority
end

"""
transition(from, to, cond; immediate::Bool = true, reset::Bool = true, synchronize::Bool = false, priority::Int = 1)

Create a transition from state `from` to state `to` that is enabled when transitioncondition `cond` evaluates to `true`.

# Arguments:
- `from`: The source state of the transition.
- `to`: The target state of the transition.
- `cond`: A transition condition that evaluates to a Bool, such as `ticksInState() >= 2`.
- `immediate`: If `true`, the transition will fire at the same tick as it becomes true, if `false`, the actions of the state are evaluated first, and the transition fires during the next tick.
- `reset`: If true, the destination state `to` is reset to its initial condition when the transition fires.
- `synchronize`: If true, the transition will only fire if all sub-state machines in the source state are in their final (terminal) state. A final state is one that has no outgoing transitions.
- `priority`: If a state has more than one outgoing transition, all outgoing transitions must have a unique priority. The transitions are evaluated in priority order, i.e., the transition with priority 1 is evaluated first.
"""
function transition(from, to, cond;
immediate::Bool = true, reset::Bool = true, synchronize::Bool = false,
priority::Int = 1)
Expand Down
Loading