state-machines

Algorithm for implementing C# yield statement

I'd love to figure it out myself but I was wondering roughly what's the algorithm for converting a function with yield statements into a state machine for an enumerator? For example how does C# turn this: IEnumerator<string> strings(IEnumerable<string> args) { IEnumerator<string> enumerator2 = getAnotherEnumerator(); foreach(va...

Are there any programs to draw and test state machines, turing machines, etc?

When I go back to school after Thanksgiving, I'll be taking a course in CS Theory covering topics such as deterministic and nondeterministic finite state machines, turing machines, pushdown automata and a few other things. However, I haven't found a good application that can produce a visual representation of them as well as testing how ...

SharePoint modification forms in state machine workflows

Hello, I've been perplexed lately working on a SharePoint state machine workflow. I was hoping to add some modification forms to the workflow so that I could reassign a task while in its state. Unfortunately, modification forms don't seem to be documented for use with state machine workflows (pretty straight forward for sequence workf...

Calling a method on state change with AASM

How do I go about calling a method on state change in AASM? I'd like to call update_foo when the state transitions to paid in the following model: class Foo < ActiveRecord::Base include AASM # State Machine aasm_initial_state :incomplete aasm_state :incomplete aasm_state :paid aasm_event :pay do transitions :from => :...

How do I build a LR state machine parser?

I'm wanting to play around with creating an LR parser generators. Does anyone know of a good (free) resource describing how to create a state machine table from a grammar? ...

Implementing event conditions in a C++ state machine

I'm using an hierarchical FSM for an embedded C++ application interface. I'd like to use small functions to determine whether certain inter-state events can be triggered, as well as use them to effect changes in the database: however, making a new class with different event functions for each state is daunting, as well as setting pointer...

Is it possible to transition between states until multiple events happen in wf?

I am developing a State Machine Workflow using C# and WF in visual studio 2008. On one of my states I need to wait for multiple events to happen until the workflow can transition to the next state. As an example think of a unanimous voting scenario. I cannot find a way to do this. Does anyone have a solution or workaround for this pr...

Cannot compile FSM sample code

There is a nice state machine tutorial called UML Tutorial: Finite State Machines by Robert C. Martin. But I can't compile the sample code it provides. I got *FsmTest.cpp(46) : error C2664: 'SetState' : cannot convert parameter 1 from 'class UnlockedState *' to 'class TurnstileState ' Please, help. Thanks. class Turnstile { public: vi...

DFA -> regular expression

Hi, I've written a DFA on paper, and want to translate it into a set of regular expressions. Does anybody know a good tool to do this? ...

State Machine Frameworks for .NET

We have a system at my work that is basically a message-driven state machine. It takes in a variety of types of messages, looks up some context/state based on the message, then decides what to do, based on the message and the current state. Normally the result is a message being sent out of the system. Are there any good open-source f...

Data-driven state machine application

We are currently working on a "data-driven" state machine application. Right now, the state flows are all configured in the database, but none of the decision/business logic is configurable in the DB with our current design. Because of this, the code has to basically "know" the state flow as well, so there's really no point in configur...

is state machine suitable for handling state changes in sales-promotion system?

I'm developing sales promotion system and I just stepped on something that could be probably handled with state machine pattern, but I have no experiences with state machines yet. Maybe the state machine is totally useless in this situation :) So I have a sales promotion which has some duration, some assigned customers, products, discoun...

library for converting regular expressions to NFAs?

Is there a good library for converting Regular Expressions into NFAs? I see lots of academic papers on the subject, which are helpful, but not much in the way of working code. My question is due partially to curiosity, and partially to an actual need to speed up regular expression matching on a production system I'm working on. Althou...

How should an object using the state pattern be transitioned to the next state?

I have an Order class which goes through a series of defined states. To aid with this, I have implemented the State pattern such that the Order object has a CurrentState member which implements an IOrderState interface. I then have concrete implementations of this interface such as OrderStateNew, OrderStateDelivered etc etc My question ...

State machine for syntax coloring

Hello. I'm currently learning how lexers and parsers work, and i have following question about state machine. For example, i need to colorize text by following rule: For this rule simple state transition table will look like this: current event next action IDLE $ COLOR - COLOR any - OnColor() COLOR \n IDLE - Th...

State-machine : How to change state without external event (transient state)?

The scenario: I have a simple state machine: Happy path: Uninitialized->Initialized->InProgress->Done Unhappy path: Uninitialized->Initialized->Error Simply put, I need to cause a transition (either into InProgress or in Error state) without an external event/trigger. I.e. Initialized state should immediately result in one o...

Synchronizing two state machines

Hi! Say, I am building a business process management application. It has the following entities: issues and tasks, related to each other as 1 issue to many tasks. Both, task and issue, have their own states and the state of one may influence the state of another. For example, both of them have "Cancelled" and "Completed" states. When I...

Finite State Machine compiler

What is the best Opensource FSM compiler which can generate c++ code ? ...

Controlling Layout of Graphviz Graphs

I have a number of relatively simple (auto-generated) graphs in graphviz dot format. These show the path through a state machine, but dot has a slightly confusing habit of deciding that two nodes must be on the same rank when I would like the graph to be in state order. I've tried a lot of settings (including the :n and :s and the weig...

Java library to check whether a String contains a number *without* exceptions

I'm looking for a method that returns a boolean if the String it is passed is a valid number (e.g. "123.55e-9", "-333,556"). I don't want to just do: public boolean isANumber(String s) { try { BigDecimal a = new BigDecimal(s); return true; } catch (NumberFormatException e) { return false; } } Clea...