state-machine

Statemachine that transitions to target state and fires transitions and states between?

主宰稳场 提交于 2019-12-11 10:18:33
问题 I recently used the Stateless state machine. I can define the rules for transitions etc. like this: stateMachine.Configure(State.Unknown) .Permit(Trigger.StartApplication, State.Initialized) .OnEntry(this.DoBeforeTransition) .OnExit(this.DoAfterTransition); stateMachine.Configure(State.Initialized) .Permit(Trigger.CheckSomething, State.SomethingChecked) .OnEntry(this.DoBeforeTransition) .OnExit(this.DoAfterTransition); and then you are able to fire a trigger to change the state. However, you

State Machine Gem + Rails 4: undefined method `state_machine' for #<Class:0x007faffc93fd60>

我只是一个虾纸丫 提交于 2019-12-11 10:07:08
问题 I have installed the gem gem 'state_machine', :require => 'state_machine/core' I've bundled. I've migrated a column state type string to the relevant Table. My model looks like this belongs_to :user belongs_to :patient validates :patient_id, uniqueness: {scope: [:email]} state_machine :initial => :unseen do event :look do transition :unseen => :seen end end When I ran rails c Table.all I got the below error in reference to the model page where I referenced state_machine undefined method

Enterprise Architect: Refering to An Instantiated Class's Attribute in a State Transition

时光毁灭记忆、已成空白 提交于 2019-12-11 07:59:33
问题 In Enterprise Architect, I have a class defined with an attribute which is an enum. Is it possible to create a transition in a state machine based on a test of that enum's value? How? I find the only way to create transitions with triggers or signals very limited. My intent is to export the state machine to a requirements document. Although, I would think this should work with simulation. 回答1: A trigger is what causes a token to flow along a state transition. Take for example this state

What are patterns/types of task queues? Can the multi-level task queue exist in form of a N-tree?

穿精又带淫゛_ 提交于 2019-12-11 06:42:59
问题 I still didn't discovered a widely accepted pattern for following situation: In the database, a three-level deep series of tasks exists. Main task: gather data for user X; report data; Sub-task: ensure that all data is fetched and is correct; report success or errors Minimal task: get a piece of data from network, match it against some template (described by both levels above); report I/O errors or template matching errors. Currently I am only sure to have a comparator object that checks

Spring Statemachine Forks

时间秒杀一切 提交于 2019-12-11 05:26:36
问题 I have made good progress with the state machines upto now. My most recent problem arised when I wanted to use a fork, (I'm using UML). The fork didn't work as it is supossed to and I think its because of the persistance. I persist my machine in redis. refer below image. This is my top level machine where Manage-commands is a Sub machine Reference And the top region is as it is. Now say I persisted some state in redis, from the below region, and next an ONLINE event comes, then the machine

Is it possible to use cancan in a model?

一曲冷凌霜 提交于 2019-12-11 05:12:55
问题 I have a model with a statemachine and i want to limit different states/events/transitions to different users. How can i access current user and ability in this model? 回答1: You can define abilities in cancan against any methods provided by the model. State machine transitions are themselves methods provided by the model, so just set up your abilities as you would for any other methods. For example, given a simple model: class Order < ActiveRecord::Base state_machine :initial => :new do event

Using GOTO for a FSM in C

我的梦境 提交于 2019-12-11 04:03:09
问题 I am creating a finite state machine in C. I learned FSM from the hardware point of view (HDL language). So I'm used a switch with one case per state. I also like to apply the Separation of Concerns concept when programing. I mean I'd like to get this flow: Calculate the next state depending on the current state and input flags Validate this next state (if the user request a transition that is not allowed) Process the next state when it is allowed As a start I implemented 3 functions: static

Spring Statemachine Factory -stays in memory

纵饮孤独 提交于 2019-12-11 01:33:49
问题 I have used Spring state-machine in quite a complex scenario. I will explain my problem with the simplest part of the SM. Refer below image. This is my main state machine The state circled in red points to the following sub-machine So, as you can see, I have 3 actions. sendBasicTemplate, timeoutLogAction and processBasicTemplateReply. I will provide the related code segments and my configuration below. What I have observed during this process is that the state-machines created by the factory

Simple State Machine Problem

送分小仙女□ 提交于 2019-12-10 19:15:17
问题 I have a very simple FSM which should drive some output signals of an external RAM. The problem that I have comes with handling the data bus which can be input as well as output... I am not too sure how I can handle best this case in my FSM. The problem comes from the following line: v.sram_data <= io_sram_data; Obviously, the left hand side is a variable while the right hand side is a signal. Is there a "nice" way how to handle inout signals in a FSM as the one I have? entity sram_fsm is

Enterprise architect: Order of entry/exit functions in states

China☆狼群 提交于 2019-12-10 18:34:01
问题 In my state machine, I have a state with several entry and exit functions. Enterprise Architect sorts them alphabetically, which can lead to something like this: entry / a exit / b entry / c The entry and exit functions are what EA calls "element operations". Question: How can I change the order of these operations? Ideally, I'd like to be able to order them in any way; if that is not possible, I'd like to have all the entry functions before the exit functions. What I tried: In the