473,382 Members | 1,441 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,382 software developers and data experts.

simple state machine

mickey0
142 100+
Hello,
I just want to try to implement a simple State Machine and I'm reasoning whch class I need
Expand|Select|Wrap|Line Numbers
  1. function Machine(startState) {
  2.     this.startState = new State(startState);
  3.     //states list
  4.  
  5.     this.raise= function(eventName) {
  6.             //alert(eventName);
  7.       }
  8. }
  9.  
  10. function State(idState) {
  11.     this.id = idState;    
  12.         //actions list
  13. }
  14. function Event(eventName) {
  15.  
  16. }
  17. function Action() {
  18.     //execute code
  19. }
  20.  
I dont' know if it's clear what I need to do; what it's not clear to me is how design the things! What must Event class contain? Must each state contain a table like 'for each event says which is the target state' ? . Any helps?

thanks
Jan 31 '10 #1
3 3003
Dormilich
8,658 Expert Mod 8TB
we can’t really help when we don’t know about it. currently I have no idea about the purpose and the usage of the objects concerned, thus I’m as helpless as you.

PS. JavaScript is a prototype based programming language. the concept of classes as you know it from other programming languages does not exist here.
Jan 31 '10 #2
mickey0
142 100+
@Dormilich
I just need to give a definition of a State Machine. It's in js but I would have the same problem with every language.
Jan 31 '10 #3
Dormilich
8,658 Expert Mod 8TB
try the Turing Machine.
Jan 31 '10 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

6
by: Jeff Smythe | last post by:
Why does Session_Start in Global.asax fire for every page opened during a session of an ASP.NET application? Am I wrong to expect that it would fire only when the first page (i.e., any page in...
1
by: Robert | last post by:
In Web.config file is a setting for sessionState. If I want to maintain a users' session state (ie use the Session object) in a web farm that is being load balanced by a Cisco CSS 11501 Switch. ...
7
by: abcd | last post by:
I am trying to set up client machine and investigatging which .net components are missing to run aspx page. I have a simple aspx page which just has "hello world" printed.... When I request...
0
by: Maciek | last post by:
Hi When I set Session state mode to StateServer (IIS 6.0; windows2003; .NET 2.0) in my application, I have recived this message:...
6
by: nilavya | last post by:
HI, I have got a C++ application involving State machine. Now I have got too many states and too many events which changes the state of the Staet machine. So my code is somewhat unmanageable....
4
by: Shawnk | last post by:
This post is intended to verify that true value semantics DO NOT EXIST for the Enum class (relative to boolean operations). If this is true then (thus and therefore) you can not design state...
4
by: nyhetsgrupper | last post by:
I have a C++ application which I am porting to C#. This application is controlling a transport belt. This transport belt is moving bins foreward and backward. I have a state machine controlling...
6
by: Jacob Rael | last post by:
Hello, I have a simple script to parse a text file (a visual basic program) and convert key parts to tcl. Since I am only working on specific sections and I need it quick, I decided not to...
3
by: Jeff User | last post by:
Hi Sorry if this post appears twice, but it is not appearing in my news reader. We have an application that uses sessionState set up in Web.config is setup as follows: <sessionState...
3
by: Pallav singh | last post by:
Hi All i am getting Error while writing following code for state design Pattern kindly let me know How to Correct this Error ?? Thanks Pallav Singh ...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.