state-machine

How to get current state from bbv.Common.StateMachine (now Appccelerate.StateMachine) class?

99封情书 提交于 2019-12-06 19:52:10
问题 bbv.Common.StateMachine class is the best state machine code I have ever seen. But it lacks just one thing: getting current state. This is an order tracking system: fsm = new ActiveStateMachine<States, Events>(); fsm.In(States.OrderCreated) .On(Events.Submitted) .Goto(States.WaitingForApproval); fsm.In(States.WaitingForApproval) .On(Events.Reject) .Goto(States.Rejected); fsm.In(States.WaitingForApproval) .On(Events.Approve) .Goto(States.BeingProcessed); fsm.In(States.BeingProcessed) .On

Transitions in UML state charts: better to use triggers or guards?

落爺英雄遲暮 提交于 2019-12-06 11:48:19
In the design of UML state charts it appears that I can chose to use either triggers or guard logic to achieve transitions between states. So which is better to use? Given the same logic for transition, does a trigger behave any differently than a guard? What are the benefits/drawbacks of one over the other? Are there perhaps differences depending on the particular tool, or does the UML standard strictly define the behaviors of either method of transition? I'm presently using Simulink Stateflow to design a state machine. Those two are different concepts. Trigger is an event occurrence which

Workflow design advice for ASP.Net web application?

痴心易碎 提交于 2019-12-06 10:41:58
问题 My team has been tasked with designing a web application that is workflow driven. I need some advice regarding the design. The workflows need to be dynamic. Meaning, users can define the workflows through some interface and apply those workflows to a given scenario (The definitions will live in a SQL 2008 Database). The scenarios are defined by the business and will never change. So there may be only 2 types of scenarios a workflow can be defined for. The workflows are not necessarily linear.

Rails: Model.human_attribute_name :field should raise an error when translation not found? (Maybe caused by state_machine?)

早过忘川 提交于 2019-12-06 10:37:05
We often stumble over untranslated model attributes in our application. They most often come because an attribute was renamed or something like this. It would be really helpful to have I18n raise an error when Model.human_attribute_name :field doesn't find a translation. Is there a way to achieve this? Update : It seems there's some other problem. here are my I18n settings: I18n.enforce_available_locales = false config.i18n.load_path += Dir[Rails.root.join('config', 'locales', '**', '*.{rb,yml}')] config.i18n.default_locale = 'de-CH' config.i18n.available_locales = ['de', 'de-CH', 'en'] config

How to design a state machine in face of non-blocking I/O?

▼魔方 西西 提交于 2019-12-06 08:48:05
问题 I'm using Qt framework which has by default non-blocking I/O to develop an application navigating through several web pages (online stores) and carrying out different actions on these pages. I'm "mapping" specific web page to a state machine which I use to navigate through this page. This state machine has these transitions; Connect, LogIn, Query, LogOut, Disconnect and these states; Start, Connecting, Connected, LoggingIn, LoggedIn, Querying, QueryDone, LoggingOut, LoggedOut, Disconnecting,

How to define a variant<x,y,z> extracting subtypes of a template parameter

风流意气都作罢 提交于 2019-12-06 06:42:13
问题 I am building a state-machine where state transitions are described as a variant, i.e.: using table = std::variant< /* state event followup-state */ transition<start, success<sock>, connecting>, transition<start, exception, failed>, transition<connecting, success<>, connected>, transition<connecting, exception, failed>, transition<connected, exception, failed> >; and transition being a simple type: template <typename ENTRY_STATE, typename EVENT, typename NEXT_STATE> struct transition { using

How to define a state_machine in a Concern?

99封情书 提交于 2019-12-06 04:50:42
问题 I am trying to factor out some duplicated logic into a concern. Part of the duplicated logic is a state_machine. Simplified, the Database , Site , SftpUser and more contain, amongst others, this: class Database < ActiveRecord::Base # ... state_machine :deploy_state, initial: :halted do state :pending end end I'm attempting to refactor this into a concern: module Deployable extend ActiveSupport::Concern included do state_machine :deploy_state, initial: :halted do state :pending end end end #

How to merge two finite state automata?

故事扮演 提交于 2019-12-06 04:06:18
问题 Say I have two deterministic finite state automata represented by the following transition diagrams: FSA for keyword IF: IF ___ ___ _ / \ I / \ F // \\ >| 0 |----->| 1 |----->||2|| \___/ \___/ \\_// FSA for an ID: [A-Z][A-Z0-9]* ------------ ___ | _ LET | / \ LET // \\<------ >| 0 |----->||1|| \___/ \\_//<------ | NUM | ------------ What algorithm may I use to combine them into a single deterministic finite state automata with three final states, represented by the following transition

Which State Machine execution frameworks for C++ implement UML semantics?

此生再无相见时 提交于 2019-12-06 04:01:47
问题 I'm looking for a framework that provides execution of hierarchical state machines (HSMs). These are the requirements for the framework: Conforms to UML state machine semantics (as much as possible) Supports at least run-to-completion semantics hierarchical states entry and exit actions transition actions guards events with custom parameters Is object-oriented or does at least not prohibit OO designs The target platform is an medium- to large-sized embedded system with an OS. Do you know a

How State machine diagram can be represented as a Behavior for an operation in UML?

余生长醉 提交于 2019-12-06 01:46:28
Behaviors (Method Body)can be state machines or activities - activities are easy to understand, as they are the equivalent of procedural code. I don't understand how a state machine can be used as the behavior for an operation? Could you Please provide a simple example for that? ---Note--- Operation is a specification-only element - imagine it as the method signature in OO programming languages. It has a name and a list of parameters. Behavior is (among other things) what an operation (or another behavioral feature such as a reception) does when invoked - imagine it as the body of the method.