Presentation is loading. Please wait.

Presentation is loading. Please wait.

Random Logic l Forum.NET l 20061 State Machine Mechanism Forum.NET 1 st Meeting ● December 27, 2005.

Similar presentations


Presentation on theme: "Random Logic l Forum.NET l 20061 State Machine Mechanism Forum.NET 1 st Meeting ● December 27, 2005."— Presentation transcript:

1 Random Logic l Forum.NET l 20061 State Machine Mechanism Forum.NET 1 st Meeting ● December 27, 2005

2 Random Logic l Forum.NET l 20062 Agenda  State Machine Definition  Why do we need it?  The General State Machine Library  Using the Machine  Summary

3 Random Logic l Forum.NET l 20063 State Machine Definition  In general, a state machine is any device that stores the status of something at a given time and can operate on input to change the status and/or cause an action to take place when status is changed

4 Random Logic l Forum.NET l 20064 State Machine Definition cont. A state machine can be described as:  An initial state or record of a generic object  A set of possible input events  A set of new states that may result from the input  A set of possible actions or output events that result from a new state

5 Random Logic l Forum.NET l 20065 Why do we need it?  Generic method to navigate through a module independent process graph  dynamically configure a process graph  Very easy to add new states to the process

6 Random Logic l Forum.NET l 20066 The State Machine Library Concept:  Start from first node (state) in graph.  Create the state using a Factory.  Call its Handle() method and get the result in return.  If state type is final – finish.  If not final - Based on the result, get the next node in graph (and loop).

7 Random Logic l Forum.NET l 20067 The State Machine Library Internal Singleton 2

8 Random Logic l Forum.NET l 20068 The State Machine Library cont.

9 Random Logic l Forum.NET l 20069 The State Machine Library cont. View Code 1

10 Random Logic l Forum.NET l 200610 Using the Machine The Process: Search Available Book in a library The Entities: Library, Book, BookCopy, SearchRequest (1) Enter Book Title (2) Check that title exists (State 1) (3) Check that copy available (State 2) UILogicMachine

11 Random Logic l Forum.NET l 200611 Using the Machine UILogic State Machine

12 Random Logic l Forum.NET l 200612 Using the Machine cont. View Code 2

13 Random Logic l Forum.NET l 200613 Using the Machine cont. The Process: Search Available Book in a library The Entities: Library, Book, BookCopy, SearchRequest (1) Enter Book Title (2) Check that title exists (State 1) (3) Check that copy available (State 2) (4) Assign copy (State 3)

14 Random Logic l Forum.NET l 200614 Using the Machine cont. Adding New State Actions:  Create new class which implements the IState Interface (AssignBookState)  Add State to configuration file  Add node to Graph in configuration file

15 Random Logic l Forum.NET l 200615 Using the Machine cont. View / Add Code 3

16 Random Logic l Forum.NET l 200616 Summary  The State Machine library manages a generic process based on configuration file.  Using the Interfaces, a specific client can declare states and data, and let the machine manage the process itself.  Addition of new state to a process or changing the order of existing states in a process becomes a very simple task.  Defining specific order to specific cases in a process, is a simple task as well.

17 Random Logic l Forum.NET l 200617 State Machine Mechanism Thank you!


Download ppt "Random Logic l Forum.NET l 20061 State Machine Mechanism Forum.NET 1 st Meeting ● December 27, 2005."

Similar presentations


Ads by Google