Questions tagged [finite-state-machine]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
2
votes
1answer
40 views

State Pattern: duplication in State and Context

Wikipedia gave an example of State Pattern: Define LowerCaseState and MultipleUpperCaseState, both inherite from State. interface State { void writeName(StateContext context, String name); } ...
4
votes
1answer
197 views

Repeating a state in a state machine

I have a state machine in which I might have to restart something when needed (Say restart a hardware). But after restarting, I need to run some tests on the thing. If the tests fail, I need to stop ...
2
votes
1answer
99 views

State Machine: what object is responsible for state transfer?

I would like to create a state machine. Each State would have its run method, and, according to some logic would then set a next state. Option 1: If each state is responsible for determining a next ...
0
votes
1answer
132 views

Edit and extract the response of a system from its State machine diagram

Consider the following state machine diagram: If we have the following event sequence : Close door --> Start --> Open door --> Reset and we need to know the corresponding response ...
3
votes
1answer
90 views

In an UML 2.5 State Machine, how can I model sending a Signal as an effect on a transition in a convenient way?

In an UML 2.5 State Machine, how can I model sending a Signal as an effect on a transition in a convenient way? In one of the older UML versions you simply prefixed the name of the signal with a send ...
1
vote
0answers
40 views

Tiered/grouped/layered FSM for deisning software?

Well in the past during education about integrated systems we've been thought a lot about FSM and how to design those. It was a good tool to "talk" about complicated systems and create a common ...
0
votes
1answer
87 views

How to plot a state machine diagram of multiple related objects in one diagram?

In an order management system for example, what's the best way to plot the states of different objects that overlap and interconnect at different states? Example: Order object will have states like ...
0
votes
2answers
144 views

Using UML State Machine for blockchain smart contract implementation

This is a conceptual question about applying UML State Machine model for smart contracts in blockchain. I want to develop a smart contract framework in a bitcoin-like blockchain which is based on the ...
8
votes
1answer
228 views

How to design a good generic tiled image downloader?

Tiled images Tiled images are large images that have been split in smaller square tiles. There are several tiled image formats, with different ways of organizing the tile files. A tiled image on ...
3
votes
2answers
203 views

Designing a builder as a compile-time state machine

I'm working on a text GUI library which comes with builders for UI components (Buttons, Panels, etc). I have a base class for these builders which I'd like to redesign so that meaningless component ...
2
votes
1answer
119 views

What is a good technique to process an event stream to ensure sequential or transactional consistency

I am trying to improve an event-driven processing system, which is having a few problems because the events are not guaranteed to arrive in the correct chronological sequence. This is due to batching ...
2
votes
2answers
186 views

Hierarchical State Machine (HSM) superstate and substate sharing event

I am learning HSMs and I can see a problem that I don’t know how to address. The problem is shown in the image bellow. Inside S1, substates S11 and S12 are continuously changing in reaction to ...
0
votes
0answers
162 views

Linear “steps” of operations considered a state machine?

I have a set of tasks I perform to complete some larger operation. These tasks must be executed in linear order, and you cannot proceed onto the next task until the previous completes. For the most ...
1
vote
1answer
293 views

Problem in creating a correct finite-state-machine for a given short text

I like to create a finite-state machine for the given text below. While solving this, I came accross with several problems I listed at the bottom. (This example is in terms of testing (where you later ...
1
vote
0answers
43 views

Byzantine Failures - Client Voter and Replica on Same Processor

I need help understanding the following text from section 4.2 on this paper: Implementing Fault-Tolerant Services Using the State Machine Approach: A Tutorial Dependent-Failures Output ...
0
votes
1answer
155 views

Will FSM be a good solution?

At work, we are creating an android app. We have a business logic module for talking to an API for CRUD operations. The app I'm working on, the UI module, speaks to the business logic module to create,...
1
vote
2answers
1k views

Can a state machine transition depend on the previous state?

I was wondering what the state machine for a video player would be like. I can think of two states : playing and paused. When the video is playing and the user clicks on a point in the progress ...
2
votes
1answer
1k views

What is the relationship between event driven design and state machines/charts?

I'm trying to understand event driven design better and have not picked up a book on it yet. But just from others explaining it to me it seems to be really similar to state machines/charts. What are ...
0
votes
2answers
153 views

How to handle state of an object? And how to enrich the state transition logic?

I am designing a class that has a state. I wonder if I should expose that state in the interface in view of allowing a decorator to enrich the state transition logic. Shall my design expose access to ...
0
votes
2answers
374 views

If a business's workflow steps can reside solely in a database, is there a reason to use a workflow engine to accomplish those steps?

I found various libraries in C#, PHP, Python, etc. for workflows. By workflow I mean something like an employee wants personal time and that request starts with the employee and finishes in some ...
4
votes
2answers
355 views

Why do I need a game loop with states, instead of init the next state in current state directly?

For example, it is common to see games with game loop and states: stateChanged(){ switch(state){ STATE.PLAYER_SELECT_CHARACTER: this.currentController=new PlayerSelectCharacterController()...
0
votes
0answers
188 views

Hierarchical state machine. Is there a term for the deepest nested state in a state configuration?

A flat state machine has one active state. In a hierarchical state machine (HSM), if the HSM is in a child state, it's also in it's parent state. So, an active state configuration of an HSM consists ...
0
votes
2answers
137 views

Can my state machines use state that is derived from model data?

I'm putting together some ideas and personal conventions on how to configure state machines when using a language specific library. Because I'm adding state machines to existing model classes in my ...
2
votes
1answer
71 views

Using state machines when managing remote resources

So I’ve got a service I’m trying to clean up. It responds to requests by starting a stopped server on Amazon EC2, waiting for it to come online, then configures a 3rd party piece of software on the ...
-2
votes
1answer
319 views

Finite State Machine odd number of bc at the end

I had this question in a school test: Design a non-deterministic FSM that receives all words over {a,b,c} that: Start with cc. Contain at least 1 ab or aca. Ends with an odd number of (bc). The FSM ...
1
vote
1answer
390 views

Why are next-state function and output functions of an FSM combinational functions?

From my understanding, combinational logic is dependent solely on input, and sequential logic involves state--memory. When explaining a finite state machine (FSM), however, it is said that an FSM ...
1
vote
4answers
5k views

So what exactly is a final state of a finite state machine?

I am playing around the state machine concept trying to better understand the best areas of their application. The formal definition of an FSM contains the following elements: finite non-empty set of ...
0
votes
1answer
2k views

Finite State Vending Machine Diagram

In class, we are asked to draw a finite state machine with the following instructions: Design a finite state machine to model a vending machine that accepts only quarters and gives a container of ...
2
votes
1answer
2k views

State machine with database records

I was re-learning about state diagrams this weekend, and realized that I may have been using them for years without realizing it. Suppose i have an order record, with a bunch of fields including ...
2
votes
2answers
209 views

How to model a statemachine in this case

I have a system where lot of messages come and go over network, each message to be sent or received goes through several states, state change occurs based on external events for example if the linked ...
0
votes
0answers
47 views

How do I know the depth of “k” for characterising set when testing FSM?

I am supposed to design the tests for state machine software. I have covered all states and all transitions. The last step is to detect the hidden states (states that look the same but internally ...
0
votes
0answers
118 views

Design for consuming list items for a state machine like structure

I'm trying to improve this document parser and there is one main loop that goes over all of the main elements (let's call them Nodes). Each step (Step) can either Consume or Ignore the Node that it is ...
4
votes
4answers
4k views

How should state machines handle exceptions in actions?

State machines, for example UML state machines, statecharts or other finite state machines, allow actions to be executed when a state machine takes a transition between states or is within a state. ...
3
votes
1answer
1k views

How does one combine the state pattern and the component pattern?

Suppose we have a class Player with classes PhysicsComponent, InputComponent and StandingState, DuckingState. The class Player itself does not have an input function, the InputComponent does. But ...
0
votes
1answer
107 views

Do I have to state the value of elapsed time in state-charts?

I am modelling a system that requires a state-chart before implementation. Given These Images: Main Questions: Can I use the word "Elapsed Time" if I do not know how long it will take to finish the ...
4
votes
2answers
645 views

A simple GUI app: states

I'm making a Windows Forms app: It is client-server. Authorization, then load some data from server, then send back some statistics from time to time. You should go through a bootstrapping procedure, ...
7
votes
2answers
1k views

How to store and validate data between state transitions?

I'm developing a largeish application that will have custom finite state machines. That is, the admin users of the application will be able to create their own state machines, limited by little pieces ...
3
votes
1answer
300 views

UML “direct substate” vs “transitively nested substate”

I am reading through Wikipedia's page on UML state machines. I don't understand where it says: A nested state is called a direct substate when it is not contained by any other state; otherwise, ...
3
votes
1answer
159 views

In OOP which object is common to update the state of an object when working with State Machines?

I'm about to implement my first State Machine and I'm left with one question, which is the acceptable coding form on who should change the state of the object/entity? Should the StateMachine change ...
4
votes
2answers
917 views

Trouble with circular dependency in state machine design

I am trying to develop the structure for a basic state machine that can also take in input and produce output. I've hit a bit of a mental block in trying to figure out how to model the relationship ...
2
votes
1answer
319 views

Is state pattern a wise architecture for a diagram application?

I'm designing a vector drawing app. I need to implemente copy and paste, shapes insertion, deletion and transforming while still being capable of including new tools with easy in the future. The way ...
5
votes
1answer
1k views

State machine with additional variable

When implementing a state machine and it comes to the fact that a transition depends on an external boolean a, or an enum value b which can be one out of three (which are set somewhere else in the ...
5
votes
2answers
4k views

Language to describe Finite State Machine

I'm doing a lot of code analysis using lexer and finite state machine. For time being I'm using table to describe FSM: | token | current state | target state | +-------+---------------+--------------+...
1
vote
2answers
1k views

State Design Pattern

I've come across the following State Design Pattern which seems extremely logical and simple to implement: class CeilingFanPullChain { private State m_current_state; public ...
0
votes
1answer
544 views

How do I manage a large state graph when building a scaleable finite state machine?

Lately I've been working on a project that involves parsing a toy domain-specific-language. While building it out, I realized that an efficient way to handle parsing tokens would be to represent the ...
6
votes
3answers
1k views

Can a generic piece of C code be converted to an FSM?

I understand that any language worth its salt can encode a Finite state machine. My question is the opposite, is it possible to convert an arbitrary piece of code ( say in C ) to a functionally ...
2
votes
4answers
115 views

How to explain to a vendor that when erroneous data is deleted/deactivated the application future state should be as if the data was never entered?

A major application we use has a bug that the vendor is calling (a swear word in our business) "working as designed". As a programmer / system analyst this is a bug - and against all I have been ...
7
votes
1answer
1k views

Finite state machine menu design

I'm creating an FSM in python (it's a step sequencer and sample pad based on a Raspberry Pi 2). Right now there are two states and the third is the Menu. This is handled by a class System which ...
3
votes
1answer
2k views

What is the alternative design pattern of a state machine that may have recursive state change?

I have a state machine like code, which has state A,B and C, with a function changeState(char i) which can change the state of a system, and each state can also call changeState(char i) to switch the ...
3
votes
2answers
193 views

Is there a well defined notion of 'before' and 'after' in finite state machines?

When working with finite state machines, is there or can there be a well defined concept of 'before' and 'after'. The ordering would, for example, tell me that one state is always considered to be '...