state-machines

How to get this Qt state machine to work?

I have two widgets that can be checked, and a numeric entry field that should contain a value greater than zero. Whenever both widgets have been checked, and the numeric entry field contains a value greater than zero, a button should be enabled. I am struggling with defining a proper state machine for this situation. So far I have the fo...

Aspect Oriented Programming vs List<IAction> To execute methods based on conditions

I'm new to AOP so bear with me. Consider the following scenario: A state machine is used in a workflow engine, and after the state of the application is changed, a series of commands are executed. Depending on the state, different types of commands should be executed. As I see it, one implementation is to create List<IAction> and...

Designing a state machine in C++

I have a little problem that involves modeling a state machine. I have managed to do a little bit of knowledge engineering and 'reverse engineer' a set of primitive deterministic rules that determine state as well as state transitions. I would like to know what the best practices are regarding: How to rigorously test my states and st...

Drawing reflexive edges in State Machines

I have to draw a small finite state machine that has some reflexive transitions (meaning the start and the end state of the transition are equal. The problem is that rendering that in Graphviz has ugly results. digraph finite_state_machine { edge [fontsize=11]; S0 -> S0 [label = "td=1\n-/e2"]; S0 -> S1 [label = "td=3 \n-/e3" ]; S...

Getting list of states/events from a model that AASM

Hi, I successfully integrated the most recent AASM gem into an application, using it for the creation of a wizard. In my case I have a model order class Order < ActiveRecord::Base belongs_to :user has_one :billing_plan, :dependent => :destroy named_scope :with_user, ..... <snip> include AASM aasm_column :aasm_state aasm...

How would you code a washing machine?

Imagine I have a class that represents a simple washing machine. It can perform following operations in the following order: turn on -> wash -> centrifuge -> turn off. I see two basic alternatives: A) I can have a class WashingMachine with methods turnOn(), wash(int minutes), centrifuge(int revs), turnOff(). The problem with this is th...

How to save the values if the app when its closed.

Hi...i am new to iPhone programming.. my app is just like a quiz.. it has different type of quizs and many question in each quiz type i want to save the values like strings(quiz name) and integers(question number) when an application is closed so when the app is restarted i want to continue where it was stopped by using saved values H...

Passing variables to Rails StateMachine gem transitions

Is it possible to send variables in the the transition? i.e. @car.crash!(:crashed_by => current_user) I have callbacks in my model but I need to send them the user who instigated the transition after_crash do |car, transition| # Log the car crashers name end I can't access current_user because I'm in the Model and not the Control...

Comparison of Boost StateCharts vs. Samek's "Quantum Statecharts"

I've had heavy exposure to Miro Samek's "Quantum Hierarchical State Machine," but I'd like to know how it compares to Boost StateCharts - as told by someone who has worked with both. Any takers? ...

books on state machine development

Hello, gcc 4.4.3 gcc c89 I have started to go into the world of state machines using c. I have to develop on for my job. I am just wondering if there are any good book in developing state machines development in C. Recently I bought a book called "Data Structures in C". Excellent book as it explains in very simple terms and doesn't g...

State machine in Ruby using Fibers?

hello, I'm trying to get a handle on the new Fiber class in Ruby 1.9 and I read that one of the more common applications for Fibers (and coroutines) is in state machines. Unfortunately my Fiber-fu isn't up to much, so I was hoping one of you could show me a simple statemachine example in Ruby using Fibers thanks :) ...

compare an array of enums in (Objective) C

I want to test for transition from one state to another. I have defined my states in an enum like this: enum FingerStatus { FINGERS_UP, MOVING, FINGERS_STILL }; I have a "currentState" and a "newState" variable. I know that enums are just integers, and if they're 16-bit integers, which I think they are, it's possible to represent two ...

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

Hi, 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 agains...