Questions tagged [state-machine]

A State Machine is a computation model used to design both computer programs and sequential logic circuits. It determines that an entity in a program can be in one of a finite number of states. The state it is in at any given time is called the current state. It can change from one state to another when initiated by a triggering event or condition; this is called a transition.

A state machine is an abstract machine, which possesses

  • State a condition that when tested will be either true or false
  • Transitions the result of true/false decision to another State
  • Entry actions (what happens when a state is entered)
  • Exit actions (analogous to entry actions)

As a result, a system can dynamically change its behavior based upon what it is currently doing and what input it receives - this allows state machines to model many types of systems. (An familiar example is Regex - Perl, Python, Tcl, .NET, and most other implementations use a state machine internally).

For example, consider a printer, which can be either waiting for a job, or printing it (states), and can start printing when a job is received and start waiting when it is done with the current job (transitions). Send notification is an exit action for the "Printing" state, to notify the print queue that it is done.

SDL description of a printer

(The above diagram is in the SDL format - UML is also popular for representing state diagrams).

#Related tags - The Coyote open source asynchronous programming framework

1708 questions
0
votes
1 answer

Calculate fmax of Altera design

After I finished my design compilation on Quartus, I get multiple result for fmax as shown below. I want to know, what does it means? and How can I calculate the fmax of the all design?. My design is implementation for the following equation: for(i…
abdelhamedia
  • 64
  • 1
  • 10
0
votes
0 answers

Finite State Machine for Java client - best practice needed

I am creating a Java Client to print messages with a small state-machine at the heart of my main class. This client polls a JMS queue and decides if it needs to print a message from a queue or needs to send a message back with JMS. I was wondering…
Dimitri Dewaele
  • 10,311
  • 21
  • 80
  • 127
0
votes
1 answer

peter-murach/finite_machine restore persisted state

Using finite machine gem for Ruby from Piotr Murach. Would like to restore the state machine with a persisted (stored) state. The documentation teaches the initial state, and restoring state from and ActiveRecord model. All I've been able to find…
Douglas Lovell
  • 1,549
  • 17
  • 27
0
votes
1 answer

UML state machine: Conflict AFTER choice

What happens in an UML state machine if the transition selection algorithm (TSA) finds two transitions that should both fire and the following holds true: transition #1 ends directly in a state transition #2 ends (intermediately) in a choice…
DrP3pp3r
  • 803
  • 9
  • 33
0
votes
1 answer

Game State Implementation Using Protocol And Base Class

From what I've read so far, it seems that Objective C does NOT have abstract classes. I'm trying to implement a game state manager that is similar to what Apple just announced in GameKit (GKState and GKStateMachine). My solution so far involves…
02fentym
  • 1,762
  • 2
  • 16
  • 29
0
votes
1 answer

Best way to provide params to a state transition in a FSM

I'm in a situation where one of the states in my FSM needs some information from the outside world to do its job. This information needs to be provided when the transition is requested. What's the best way to accomplish this? At this time I'm using…
Notbad
  • 5,936
  • 12
  • 54
  • 100
0
votes
3 answers

Solve three letter string into regular expression way

I need help to solve in regular expression way. The language of all strings defined over Σ = {X, Y, Z} with Y as the third letter and Z being the second last letter.
0
votes
1 answer

Can we have more than one trigger between two states in a State Machine?

I am working on implementing a state machine for a workflow management system based on the Stateless4j API. As per the concept of a Finite State Machine, is it possible to have more than one trigger between two states. Triggers are the conceptual…
Gokul Alex
  • 441
  • 4
  • 21
0
votes
1 answer

Qt state machine : How to set guard on initial state?

From Qt state machine documentation, I can set, in a main state, the initial substate. QStateMachine machine; QState *s1 = new QState(); machine.addState(s1); machine.setInitialState(s1); I can also add guard to transition between different…
ruddy
  • 135
  • 4
  • 12
0
votes
2 answers

Controlling finite-state machines

I'm attempting to improve my understanding of FSMs by using them in an application responsible for deploying software to a staging system. A component of this application is responsible for ensuring that git repositories are installed, up-to-date…
Mike
  • 21,301
  • 2
  • 42
  • 65
0
votes
1 answer

Is implementing Finite state machine a right way to do in crm?

I was looking into the oracle's documentation. What one can get from it is they have developed it using FSM. but my idea or confusion remains on the topic is how one can drive FSM without triggers/events for example consider a person doing recharge…
ManMohan Vyas
  • 4,004
  • 4
  • 27
  • 40
0
votes
1 answer

Finite State Machine Vending Machine Diagram

I am trying to draw a FSM diagram for a vending machine. The machine accepts nickles,dimes,quarters, half dollars, and dollar bills. There are 4 selections you can choose from. 3 are $1.15 and 1 is $1.50. Change is to be given if the person inserts…
0
votes
1 answer

Rspec mock state_machine callbacks

I have a state machine coded with the old and unmaintained state_machine gem (https://github.com/pluginaweek/state_machine). Like in the examples, I have callbacks on transitions. For example : # my_class.rb state_machine :state_machine_name,…
Jules Ivanic
  • 1,579
  • 2
  • 15
  • 28
0
votes
0 answers

Graph or Finite State Automata

I have a list of paths (unidentified paths, that is, I do not know all the paths beforehand) A ->B-> C-D, A -> A-> B-> C,A->B-> C->B->C ->D I need to get all different paths which user use to get from A ->D Under this condition, A->B->C ->D and…
kundan kanan
  • 91
  • 1
  • 2
0
votes
1 answer

statemachine, conditional transitions

I'm currently using Workflow. class Link < ActiveRecord::Base include Workflow workflow do state :new do event :process, :transitions_to => :checking #checking http_response_code & content_type end state :checking do …
astropanic
  • 10,800
  • 19
  • 72
  • 132
1 2 3
99
100