CN110083406A - State machine based on text two-dimensional table defines method and its system - Google Patents
State machine based on text two-dimensional table defines method and its system Download PDFInfo
- Publication number
- CN110083406A CN110083406A CN201810079584.4A CN201810079584A CN110083406A CN 110083406 A CN110083406 A CN 110083406A CN 201810079584 A CN201810079584 A CN 201810079584A CN 110083406 A CN110083406 A CN 110083406A
- Authority
- CN
- China
- Prior art keywords
- state
- event
- definition
- row
- state machine
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Pending
Links
- 238000000034 method Methods 0.000 title claims abstract description 26
- 230000001960 triggered effect Effects 0.000 claims abstract description 21
- 230000005012 migration Effects 0.000 abstract description 7
- 238000013508 migration Methods 0.000 abstract description 7
- 230000004048 modification Effects 0.000 description 9
- 238000012986 modification Methods 0.000 description 9
- 230000008859 change Effects 0.000 description 8
- 238000005516 engineering process Methods 0.000 description 6
- 230000000007 visual effect Effects 0.000 description 6
- 230000004044 response Effects 0.000 description 4
- 230000009471 action Effects 0.000 description 2
- 239000012141 concentrate Substances 0.000 description 2
- 238000012217 deletion Methods 0.000 description 2
- 230000037430 deletion Effects 0.000 description 2
- 238000013461 design Methods 0.000 description 2
- 201000006549 dyspepsia Diseases 0.000 description 2
- 230000006870 function Effects 0.000 description 2
- 230000007257 malfunction Effects 0.000 description 2
- 238000010606 normalization Methods 0.000 description 2
- 230000008569 process Effects 0.000 description 2
- 238000012546 transfer Methods 0.000 description 2
- 230000008901 benefit Effects 0.000 description 1
- 238000006243 chemical reaction Methods 0.000 description 1
- 230000007547 defect Effects 0.000 description 1
- 230000007812 deficiency Effects 0.000 description 1
- 238000010586 diagram Methods 0.000 description 1
- 235000013399 edible fruits Nutrition 0.000 description 1
- 238000012423 maintenance Methods 0.000 description 1
- 238000004519 manufacturing process Methods 0.000 description 1
- 230000007246 mechanism Effects 0.000 description 1
- 239000003973 paint Substances 0.000 description 1
- 238000000926 separation method Methods 0.000 description 1
- 230000007704 transition Effects 0.000 description 1
Landscapes
- Stored Programmes (AREA)
Abstract
The present invention relates to the state machines based on text two-dimensional table to define method and its system, and this method includes drawing table separator bar using character;In the first row and the direction for intersecting definition tables in cell of first row of table;According to table direction, in the cell of first non-first trip of table occupied state and event are corresponded in non-first of the first trip of table;The movement triggered under corresponding states by corresponding event and succeeding state are defined in the cell of table.The present invention is by being carrier based on common text files, two-dimensional table is used on text file, the movement of state machine and succeeding state are defined using four states and three major issues, is realized and is solved the problems, such as not Comprehensible in the prior art that state machine defines, be difficult to safeguard, be inflexible and can not portable, migration, reuse.
Description
Technical field
The present invention relates to state machines, more specifically refer to that the state machine based on text two-dimensional table defines method and its is
System.
Background technique
In programming arts, state machine is a kind of tool of common complex management programmed logic.Order line program etc.
Simple program can be operated independently from independent of external event in operational process, and the logic of this program is linear.And
Application program more complicated for graphical interface program, web page program etc. is needed by the event occurred external in operational process
To drive.Event generates except application program, can not be controlled by application program or programmer.The code specifically needed to be implemented
Depending on the event received or its arrival time relative to other events.So control flow can neither be sequence
, it can not be previously set, because it will depend on external event, and type and sequence that external event occurs are being opened
It is unknown when sending out program.Obviously, it is necessary to one kind be taken the technology of relationship can to come between management of external events and programmed logic
Handle these situations.State machine is exactly one of such technology.It can handle the event of any sequence, and can provide significant
Response, even if the sequence that these events occur is can not be predetermined.
Programmed logic is abstracted into program and operated to the response of external event by state machine.Further, operation is not only depended on
In the event received, program state in which when event occurs is additionally depended on, so as to make program adapt to each event phase
To the arbitrary arrangement of order of occurrence.State machine safeguards an internal state, it can be updated after receiving event.For a thing
Part and the action responded depends not only on event itself, additionally depend on the internal state of machine.In addition, the action taken can also determine
Fixed and more new engine state.To which any logic can all be modeled as the combination of sequence of events/state.
Meet the programmed logic of the following conditions, can use state machine carry out tissue, first is that limited state, limited
Event;Second is that an event triggers next state transfer, into a kind of new state.State machine can be summarized as elemental as a result,
Show state, condition, movement, next state.Such conclusion, mainly due to the considerations of to the inherent causality of state machine.It is " existing
State " and " condition " are because " movement " and " next state " is fruit.Explain in detail as follows: existing state refers to the state being presently in;Condition is also known as
" event ", when a condition is satisfied, it will one movement of triggering, or execute the migration of a next state;Movement is that condition is full
The movement executed after foot can move to new state after movement is finished, and can also still keep original state, movement is not
Be it is required, when condition meet after, any movement can not also be executed, directly migrate to new state;And next state is that condition meets
The new state to be moved to afterwards, " next state " are for " showing state ", and " next state " is once activated, and are transformed into new " show
State ".Therefore, it in order to define a state machine, needs to be subject to tissue to this 4 big element by some way, and due to state
Machine is for procedure service, and state machine itself is also a part of programmed logic.
Existing state machine definition mode has following several: first is that the direct structural regime machine of program code, this mode
Principle is that the current state of state machine is saved with global variable, event as input parameter, with nested if-else chain or
The rule of switch-case mechanism structural state machine, the form of every rule are as follows: current state=X and when event=Y is executed
Corresponding operation simultaneously updates current state;But which is dispersed in due to logics such as the event of state machine, operation, state transfers
Everywhere in code, none global intuitive ways of presentation, the logic of state machine could be understood by needing to read over code, therefore very
Indigestibility, and if state machine logical changes, the place for needing to modify is dispersed in everywhere in code, none unified ground
Side can modify, and be difficult to safeguard, after state machine logic change, need to recompilate, deployment program, change could be allowed to come into force,
It can not flexibly use, in addition, state machine logic and program code close-coupled, it is difficult to be separated from program, it can not be reused
His language, platform, program, the state machine that this mode defines are difficult to transplant, migrate, reuse.
Second is that with table structural state is used in program code, the elemental of state machine can be organized into a two-dimensional table
Lattice, existing state and event are the row and columns of table, and movement, next state are the contents in cell.Usually such two-dimensional table uses
The two-dimensional array of program language indicates that the first dimension of array is existing state, and the second dimension is event, and the element in array corresponds to this
The operation of existing state and event.This mode has arrived logical centralization in table compared with a kind of upper mode, but still not intuitive enough,
Because the two-dimensional array grammer of program language is not to design for expression table;And there are still it is not flexible, be difficult to transplant, move
The problem of moving, reusing.
Third is that being to use program with generic configuration file such as xml, Json, Yaml format definition status conversion table, this mode
Language realizes state transition operation, and existing state and event are defined in configuration file, and quotes the behaviour that corresponding program language is realized
Make.This mode is more more flexible than first two way, and reuse more easy to migrate, because can realize phase in different program languages
The parsing library of congenerous, the state machine definition of identification generic configuration file format.But in essence, these generic configurations text
Part is all tree structure, can not intuitively show two-dimensional table, and the way generallyd use is first nodes definition status, second level section
Point definition event, the operation of three-level node definition, there are various situations for being unfavorable for understanding, such as check an event in each shape
Operation under state will be searched across all state nodes.Therefore this mode the problem of there are still not intuitive, indigestions.
Fourth is which provides patterned work on the basis of the third mode with graphic interface definition status machine
Tool, can show and modify the state machine being defined in generic configuration file.This mode solves the problems, such as intuitive, still
Must rely on dedicated edit tool could easily check with modification state machine definition, and this in actual production environment simultaneously
It is not always able to meet, edit tool is often fitted without in program execution environments, or even do not have on the platform of program operation
Available edit tool is realized.Therefore the problem of there are still the tools that leaves with regard to indigestion, maintenance, and it can not be detached from tool,
There is also defects in flexibility.
Therefore, it is necessary to design a kind of state based on text two-dimensional table and define method, realize that solve state machine fixed
The not Comprehensible in the prior art of justice is difficult to safeguard, is inflexible and can not portable, migration, the problem of reusing.
Summary of the invention
It is an object of the invention to overcome the deficiencies of existing technologies, the state machine definition side based on text two-dimensional table is provided
Method and its system.
To achieve the above object, the invention adopts the following technical scheme: the state machine definition side based on text two-dimensional table
Method, which comprises
Table separator bar is drawn using character;
In the first row and the direction for intersecting definition tables in cell of first row of table;
According to table direction, in first non-filling corresponding in the cell of first non-first trip of table of the first trip of table
State and event;
The movement triggered under corresponding states by corresponding event and succeeding state are defined in the cell of table.
Its further technical solution are as follows: the step of using character drawing table separator bar, specifically using "-" and " | " character
Draw table separator bar.
Its further technical solution are as follows: after the step of character drawing table separator bar, further includes:
Set table area beginning flag.
Its further technical solution are as follows: in the first row and the direction for intersecting definition tables in cell of first row of table
The step of, specific configurable table first represent state, the first trip of table represents event, alternatively, can be configured to the head of table
Row represent state, table first represent event.
Its further technical solution are as follows: the movement triggered under corresponding states by corresponding event is defined in the cell of table
And the step of succeeding state, comprising the following specific steps
The original state of occupied state machine in table;
Whether the direction for judging table is that first trip represents event and first represents state;
If so, being defined in cell under corresponding states in the row where a state with the intersecting for column where an event
The movement triggered by event and succeeding state;
If it is not, then defining corresponding states in cell with the intersecting for row where an event in the column where a state
The lower movement triggered by event and succeeding state.
The present invention also provides the state machines based on text two-dimensional table to define system, including drawing unit, direction definition
Unit fills in unit and triggering definition unit;
The drawing unit, for drawing table separator bar using character;
The direction definition unit, for the first row and the side for intersecting definition tables in cell of first row in table
To;
It is described to fill in unit, for according to table direction, the first trip of table it is non-first with first non-first trip in table
Cell in correspond to occupied state and event;
The triggering definition unit is moved under corresponding states by what corresponding event triggered for defining in the cell of table
Work and succeeding state.
Its further technical solution are as follows: the system also includes mark setup units;
The mark setup unit, for setting table area beginning flag.
Its further technical solution are as follows: the triggering definition unit includes original state filling module, judgment module, first
Definition module and the second definition module;
The original state fills module, the original state for the occupied state machine in table;
The judgment module, for judging whether the direction of table is that first trip represents event and first represents state;
First definition module, for if so, intersecting in row and the column where an event where a state
The movement triggered under corresponding states by event and succeeding state are defined in cell;
Second definition module, for if it is not, then in the friendship of column and the row where an event where a state
The movement triggered under corresponding states by event and succeeding state can be defined in cell.
Compared with the prior art, the invention has the advantages that: the state machine definition of the invention based on text two-dimensional table
Method uses two-dimensional table on text file, utilizes four states and three major issues by being carrier based on common text files
Part is defined the movement of state machine and succeeding state, and it is in the prior art not readily understood to realize that solution state machine defines
Property, be difficult to safeguard, be inflexible and can not portable, migration, the problem of reusing.
The invention will be further described in the following with reference to the drawings and specific embodiments.
Detailed description of the invention
Fig. 1 is the flow chart that the state machine based on text two-dimensional table that the specific embodiment of the invention provides defines method;
Fig. 2 is defined under corresponding states by corresponding event touching for what the specific embodiment of the invention provided in the cell of table
The flow chart of the movement and succeeding state of hair;
Fig. 3 is the table that the state machine that the specific embodiment of the invention provides defines sample;
Fig. 4 is the structural frames that the state machine based on text two-dimensional table that the specific embodiment of the invention provides defines system
Figure;
Fig. 5 is the structural block diagram for the triggering definition unit that the specific embodiment of the invention provides.
Specific embodiment
In order to more fully understand technology contents of the invention, combined with specific embodiments below to technical solution of the present invention into
One step introduction and explanation, but not limited to this.
The specific embodiment as shown in Fig. 1~5, the state and definition side provided in this embodiment based on text two-dimensional table
Method can also be used in during the complex management programmed logic of programming, realized and solved the prior art that state machine defines
In not Comprehensible, be difficult to safeguard, be inflexible and can not portable, migration, the problem of reusing.
As shown in Figure 1, present embodiments providing the state machine based on text two-dimensional table defines method, this method comprises:
S1, table separator bar is drawn using character;
S2, setting table area beginning flag;
S3, the first row and the direction for intersecting definition tables in cell of first row in table;
S4, according to table direction, in the first trip of table, non-first is corresponding in the cell of first non-first trip of table
Occupied state and event;
S5, the movement triggered under corresponding states by corresponding event and succeeding state are defined in the cell of table.
For above-mentioned S1 step, using character paint table separator bar the step of, specifically drawn using "-" and " | " character
Table separator bar out.Using common text files as carrier, the definition of state machine is advised with two-dimensional table form in text file
A format specification is determined.
For above-mentioned S2 step, as shown in figure 3, [Table] is table area beginning flag, table area beginning flag
It is labeled with the beginning that a state machine defines, until next table area beginning flag, then shows current state machine definition
It has been terminated that, definition is convenient and should be readily appreciated that and safeguards.
Further, it for above-mentioned S3 step, is defined in the first row of table with intersecting in cell for first row
The step of direction of table, specific configurable table first represent state, the first trip of table represents event, alternatively, configurable
For table first trip represent state, table first represent event.As shown in figure 3, the upper left cell lattice of table are definition tables
Direction, S represents state (State), and E is represented event (Event), S E indicate that first of table is status Bar, the first trip of table
Event column, if this lattice content be E S, then it represents that first of table is event column, and the first trip of table is status Bar, it is clear that
It is using first of table is status Bar in the embodiment that Fig. 3 is provided, the first trip of table is event column.
For above-mentioned S4 step, form definition can be represented there are two types of direction, first trip event, first represent state and
First trip represent state, first represent event, then needed in first non-fill state of first trip in head according to the direction of form definition
It arranges non-first trip and fills in event, alternatively, filling in event in non-first of first trip, then need in first non-first trip fill state.
For above-mentioned S5 step, in state machine, " movement " refers in particular to a state should adopt with corresponding to an event
The behavior taken is exactly other cells of non-1st row of table and the 1st column in the present embodiment.
In addition, in certain embodiments, above-mentioned S5 step is defined in the cell of table and is corresponded under corresponding states
The step of movement of event triggering and succeeding state, comprising the following specific steps
S51, in table occupied state machine original state;
Whether S52, the direction for judging table are that first trip represents event and first represents state;
S53, if so, in the row shape corresponding with definition in the intersection cell of the column where an event where a state
The movement triggered under state by event and succeeding state;
S54, if it is not, then where a state column it is corresponding with definition in the intersection cell of the row where an event
The movement triggered under state by event and succeeding state.
For above-mentioned S51 step to S54 step, state machine is in initialization, i.e., before not receiving any event,
Through among a state, this state is the original state of state machine, by adding one " * " number expression before state.
Certainly, original state is not limited to be placed on the second row intersects in lattice with first row.If having " * " number before a state,
So illustrate that this is original state, a state machine there can only be an original state.If there is " * " before none of state
Number, then default uses the second row of table with the state of first row intersected in cell for original state.
For above-mentioned S53 step, in intersecting in cell for row and the column where an event where a state
The step of defining the movement triggered under corresponding states by event and succeeding state, the state include statelessly, normal condition, delete
Except at least one in state, malfunction, the event includes at least one in new events, modification event and deletion event.
As shown in figure 3, state defined in sample table has: this 4 states of NONE, NORMAL, DELETED, FAULT, the thing of definition
Part has: these three events of New, Modify, Delete.
For above-mentioned S53 step, as shown in figure 3, cell row head of the row is state NONE, the column of column are first
For the content marked in event New, state machine is defined in first item description of contents this element lattice and is received at state NONE
Operation when event New is to call yzx.create function in sample.Section 2 content, i.e., in character " -> " heel
It is under current state and event, state machine executes the range for the NextState for allowing to carry out after operation, because state machine is at certain
NextState cannot be statically uniquely determined in a little logics, and not to be any shape depending on the implementing result of operation
State all can be used as NextState, therefore the next state of permission is defined in " { } " bracket pair, be fixed in sample as shown in Figure 3
Adopted state machine allows to carry out Normal or Fault state after receiving the operation of event New at state NONE, as on earth into
Entering which state will be by depending on result that yzx.create is operated.But if the next state that the operation returns is defined here
Except the range of Normal and Fault, then mutually conflict with the definition of state machine, program can detecte out such conflict, this says
Bright yzx.create operation is logically present mistake.
Above-mentioned state is the form that persons or things show.In the present embodiment, state refers in particular to program a period of time in office
The attribute set at quarter and the general name of behavior pattern.Event be computer field refer to can by procedure identification and response information become
Change.
By the two-dimensional table definition in the core element text file of state machine, intuitively show the logic of state machine, nothing
By being to check that operation can obtain rapidly as a result, solving the problems, such as comprehensibility according further to event according to state.If shape
The logic of state machine needs to change, and the place of modification concentrates in table, can be used arbitrary text editor in the correspondence of table
It is modified in statusline cell corresponding with event column.And develop plug-in unit for mainstream text editor, can supplementary table sound of laughing
Formulaization movement, solves the problems, such as maintainability.The logic of state machine is placed outside program, is defined on independent text two-dimensional table
In file, program is not needed to recompilate, be disposed after modification, can be allowed and be changed as long as reloading configuration text two-dimensional table file
Logical active after change, solves the problems, such as flexibility.The normalization of state machine definition format, can be in various program languages
Corresponding tool storage room is developed to be parsed, meet format specification state machine definition can across program, it is cross-platform, obtained across language
It is widely applied, therefore also solves the problems, such as migration/transplanting/scalability.
Meet the principle of high-quality program come definition status based on text two-dimensional table, i.e. program runs visual angle correctness, is good for
Strong property, efficiency, integrality, availability, risk;Modification of program visual angle comprehensibility, maintenanceability, flexibility, testability;Journey
Sequence shifts visual angle portability, re-usability, mutual maneuverability.
The above-mentioned state machine based on text two-dimensional table defines method, by being carrier based on common text files,
Two-dimensional table is used on text file, and the movement of state machine and succeeding state are determined using four states and three major issues
Justice realizes the not Comprehensible in the prior art for solving state machine and defining, is difficult to safeguard, is inflexible and can not be removable
The problem of planting, migrate, reusing.
As shown in figure 4, the present embodiment, which additionally provides the state machine based on text two-dimensional table, defines system comprising drawing
Unit 1, direction definition unit 3 fill in unit 4 and triggering definition unit 5.
Drawing unit 1, for using character drawing table separator bar.Table separation is specifically drawn using "-" and " | " character
Line.Using common text files as carrier, one lattice is defined to the definition of state machine with two-dimensional table form in text file
Formula specification.
Direction definition unit 3, for the first row and the direction for intersecting definition tables in cell of first row in table.
Unit 4 is filled in, is used for according to table direction, in the list of the first trip of table non-first and first non-first trip in table
Occupied state and event are corresponded in first lattice.Form definition can there are two types of direction, first trip represent event, first represent state with
And first trip represent state, first represent event, then needed according to the direction of form definition in first non-fill state of first trip
Event is filled in first non-first trip, alternatively, filling in event in non-first of first trip, is then needed in first non-first trip fill state.
Definition unit 5 is triggered, for defining the movement triggered under corresponding states by corresponding event in the cell of table
And succeeding state.
In addition, the system further includes mark setup unit 2, for setting table area beginning flag.As shown in figure 3,
[Table] is table area beginning flag, and table area beginning flag is labeled with the beginning that a state machine defines, until next
A table area beginning flag then shows that current state machine definition has terminated, and definition is convenient and should be readily appreciated that and safeguards.
For above-mentioned direction definition unit 3, first of specific configurable table represents the first trip generation of state, table
List event, alternatively, the first trip that can be configured to table represent state, table first represent event.As shown in figure 3, a left side for table
Upper cell is the direction of definition tables, and S is represented state (State), and E is represented event (Event), S E indicate table first
Status Bar, the first trip of table is event column, if this lattice content be E S, then it represents that first of table is event column, table
First trip is status Bar, it is clear that be using first of table is status Bar in the embodiment that Fig. 3 is provided, the first trip of table is thing
Part column.
Above-mentioned triggering definition unit 5, in state machine, " movement " is refered in particular to a state and is answered with corresponding to an event
The behavior taken is exactly other cells of non-1st row of table and the 1st column in the present embodiment.
In addition, in certain embodiments, above-mentioned triggering definition unit 5 includes original state filling module 51, judges mould
Block 52, the first definition module 53 and the second definition module 54;
Original state fills module 51, the original state for the occupied state machine in table.
Judgment module 52, for judging whether the direction of table is that first trip represents event and first represents state.
First definition module 53, for if so, intersecting list in row and the column where an event where a state
The movement triggered under corresponding states by event and succeeding state are defined in first lattice.
Second definition module 54, for if it is not, then being intersected in the column where a state with row where an event
The movement triggered under corresponding states by event and succeeding state are defined in cell.State machine does not receive in initialization
It before any event, has been among a state, this state is the original state of state machine, by adding one before state
A " * " number is indicated.
Certainly, original state is not limited to be placed on the second row intersects in lattice with first row.If having " * " number before a state,
So illustrate that this is original state, a state machine there can only be an original state.If there is " * " before none of state
Number, then default uses the second row of table with the state of first row intersected in cell for original state.
For the first above-mentioned definition module 53, list is intersected in row and the column where an event where a state
The step of movement triggered under corresponding states by event and succeeding state are defined in first lattice, the state include stateless, normal
State deletes state, at least one in malfunction, the event include in new events, modification event and deletion event extremely
It is one few.As shown in figure 3, state defined in sample table has: this 4 states of NONE, NORMAL, DELETED, FAULT, it is fixed
The event of justice has: these three events of New, Modify, Delete.
Above-mentioned the first definition module 53 and the second definition module 54 actually includes event definition unit and movement
Trigger definition unit.
For the first above-mentioned definition module 53, as shown in figure 3, cell row head of the row is state NONE, place
The first column of column are the content marked in event New, define state machine in state NONE in first item description of contents this element lattice
Under operation when receiving event New, be to call yzx.create function in sample.Section 2 content, i.e., character "-
> " heel is under current state and event, state machine executes the range for the NextState for allowing to carry out after operation, because of shape
State machine cannot statically uniquely determine NextState in certain logics, and will be depending on the implementing result of operation, but not
It is that any state all can be used as NextState, therefore the next state of permission is defined in " { } " bracket pair, sample as shown in Figure 3
In be allow to carry out Normal or Fault state after definition status machine receives the operation of event New at state NONE, until
Depending on entering the result which state will be operated by yzx.create on earth.But if the next state that the operation returns is fixed here
Except the range of the Normal and Fault of justice, then mutually conflicting with the definition of state machine, program can detecte out such conflict,
This illustrate yzx.create operation be logically present mistake.
Above-mentioned state is the form that persons or things show.In the present embodiment, state refers in particular to program a period of time in office
The attribute set at quarter and the general name of behavior pattern.Event be computer field refer to can by procedure identification and response information become
Change.
By the two-dimensional table definition in the core element text file of state machine, intuitively show the logic of state machine, nothing
By being to check that operation can obtain rapidly as a result, solving the problems, such as comprehensibility according further to event according to state.If shape
The logic of state machine needs to change, and the place of modification concentrates in table, can be used arbitrary text editor in the correspondence of table
It is modified in statusline cell corresponding with event column.And develop plug-in unit for mainstream text editor, can supplementary table sound of laughing
Formulaization movement, solves the problems, such as maintainability.The logic of state machine is placed outside program, is defined on independent text two-dimensional table
In file, program is not needed to recompilate, be disposed after modification, can be allowed and be changed as long as reloading configuration text two-dimensional table file
Logical active after change, solves the problems, such as flexibility.The normalization of state machine definition format, can be in various program languages
Corresponding tool storage room is developed to be parsed, meet format specification state machine definition can across program, it is cross-platform, obtained across language
It is widely applied, therefore also solves the problems, such as migration/transplanting/scalability.
Meet the principle of high-quality program come definition status based on text two-dimensional table, i.e. program runs visual angle correctness, is good for
Strong property, efficiency, integrality, availability, risk;Modification of program visual angle comprehensibility, maintenanceability, flexibility, testability;Journey
Sequence shifts visual angle portability, re-usability, mutual maneuverability.
The above-mentioned state machine based on text two-dimensional table defines system, by being carrier based on common text files,
Two-dimensional table is used on text file, and the movement of state machine and succeeding state are determined using four states and three major issues
Justice realizes the not Comprehensible in the prior art for solving state machine and defining, is difficult to safeguard, is inflexible and can not be removable
The problem of planting, migrate, reusing.
It is above-mentioned that technology contents of the invention are only further illustrated with embodiment, in order to which reader is easier to understand, but not
It represents embodiments of the present invention and is only limitted to this, any technology done according to the present invention extends or recreation, by of the invention
Protection.Protection scope of the present invention is subject to claims.
Claims (8)
1. the state machine based on text two-dimensional table defines method, which is characterized in that the described method includes:
Table separator bar is drawn using character;
In the first row and the direction for intersecting definition tables in cell of first row of table;
According to table direction, in the cell of first non-first trip of table occupied state is corresponded in non-first of the first trip of table
And event;
The movement triggered under corresponding states by corresponding event and succeeding state are defined in the cell of table.
2. the state machine according to claim 1 based on text two-dimensional table defines method, which is characterized in that use character
The step of drawing table separator bar, table separator bar is specifically drawn using "-" and " | " character.
3. the state and definition method according to claim 1 based on text two-dimensional table, which is characterized in that use character
After the step of drawing table separator bar, further includes:
Set table area beginning flag.
4. the state machine according to claim 1 based on text two-dimensional table defines method, which is characterized in that in table
For the first row with first row the step of intersecting the direction of definition tables in cell, first of specific configurable table represents shape
The first trip of state, table represents event, alternatively, the first trip that can be configured to table represent state, table first represent event.
5. the state machine according to any one of claims 1 to 4 based on text two-dimensional table defines method, feature exists
In, the step of definition in the cell of table under corresponding states by the movement of corresponding event triggering and succeeding state, including with
Lower specific steps:
The original state of occupied state machine in table;
Whether the direction for judging table is that first trip represents event and first represents state;
If so, row and the column where an event where a state intersect corresponding states is defined in cell under by thing
The movement of part triggering and succeeding state;
If it is not, then where a state column with the row where an event intersect corresponding states is defined in cell under quilt
The movement of event triggering and succeeding state.
6. the state machine based on text two-dimensional table defines system, which is characterized in that including drawing unit, direction definition unit,
Fill in unit and triggering definition unit;
The drawing unit, for drawing table separator bar using character;
The direction definition unit, for the first row and the direction for intersecting definition tables in cell of first row in table;
It is described to fill in unit, it is used for according to table direction, in the list of the first trip of table non-first and first non-first trip in table
Occupied state and event are corresponded in first lattice;
The triggering definition unit, for defined in the cell of table the movement triggered under corresponding states by corresponding event and
Succeeding state.
7. the state machine according to claim 6 based on text two-dimensional table defines system, which is characterized in that the system
It further include mark setup unit;
The mark setup unit, for setting table area beginning flag.
8. the state machine according to claim 7 based on text two-dimensional table defines system, which is characterized in that triggering definition
Unit includes original state filling module, judgment module, the first definition module and the second definition module;
The original state fills module, the original state for the occupied state machine in table;
The judgment module, for judging whether the direction of table is that first trip represents event and first represents state;
First definition module, for if so, intersecting unit in row and the column where an event where a state
The movement triggered under corresponding states by event and succeeding state are defined in lattice;
Second definition module, for if it is not, then intersecting list with row where an event in the column where a state
The movement triggered under corresponding states by event and succeeding state are defined in first lattice.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201810079584.4A CN110083406A (en) | 2018-01-26 | 2018-01-26 | State machine based on text two-dimensional table defines method and its system |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201810079584.4A CN110083406A (en) | 2018-01-26 | 2018-01-26 | State machine based on text two-dimensional table defines method and its system |
Publications (1)
Publication Number | Publication Date |
---|---|
CN110083406A true CN110083406A (en) | 2019-08-02 |
Family
ID=67412766
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201810079584.4A Pending CN110083406A (en) | 2018-01-26 | 2018-01-26 | State machine based on text two-dimensional table defines method and its system |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN110083406A (en) |
Cited By (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN112363974A (en) * | 2020-09-27 | 2021-02-12 | 青岛矽昌通信技术有限公司 | Control method and system of programmable state machine |
CN112733380A (en) * | 2021-01-20 | 2021-04-30 | 北京高码科技有限公司 | Finite state machine based on relational database |
CN113064674A (en) * | 2020-01-02 | 2021-07-02 | 广东优特云科技有限公司 | Method and device for expanding state machine logic, storage medium and electronic device |
Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN1431598A (en) * | 2002-01-11 | 2003-07-23 | 互慧科技股份有限公司 | Program test system and method |
CN101957751A (en) * | 2010-06-04 | 2011-01-26 | 福建星网锐捷网络有限公司 | Method and device for realizing state machine |
CN102467414A (en) * | 2010-11-19 | 2012-05-23 | 阿里巴巴集团控股有限公司 | State machine control method and device and state machine system |
CN104077121A (en) * | 2013-03-29 | 2014-10-01 | 北京大学深圳研究生院 | State machine information realizing and managing device |
CN106997293A (en) * | 2016-01-26 | 2017-08-01 | 上海大唐移动通信设备有限公司 | The implementation method and device of finite state machine |
-
2018
- 2018-01-26 CN CN201810079584.4A patent/CN110083406A/en active Pending
Patent Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN1431598A (en) * | 2002-01-11 | 2003-07-23 | 互慧科技股份有限公司 | Program test system and method |
CN101957751A (en) * | 2010-06-04 | 2011-01-26 | 福建星网锐捷网络有限公司 | Method and device for realizing state machine |
CN102467414A (en) * | 2010-11-19 | 2012-05-23 | 阿里巴巴集团控股有限公司 | State machine control method and device and state machine system |
CN104077121A (en) * | 2013-03-29 | 2014-10-01 | 北京大学深圳研究生院 | State machine information realizing and managing device |
CN106997293A (en) * | 2016-01-26 | 2017-08-01 | 上海大唐移动通信设备有限公司 | The implementation method and device of finite state machine |
Non-Patent Citations (1)
Title |
---|
吴小滔等: "利用事件-状态图进行面向对象的系统设计", 《数据采集与处理》 * |
Cited By (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN113064674A (en) * | 2020-01-02 | 2021-07-02 | 广东优特云科技有限公司 | Method and device for expanding state machine logic, storage medium and electronic device |
CN113064674B (en) * | 2020-01-02 | 2024-04-16 | 广东优特云科技有限公司 | Method and device for expanding state machine logic, storage medium and electronic device |
CN112363974A (en) * | 2020-09-27 | 2021-02-12 | 青岛矽昌通信技术有限公司 | Control method and system of programmable state machine |
CN112363974B (en) * | 2020-09-27 | 2022-05-31 | 青岛矽昌通信技术有限公司 | Control method and system of programmable state machine |
CN112733380A (en) * | 2021-01-20 | 2021-04-30 | 北京高码科技有限公司 | Finite state machine based on relational database |
CN112733380B (en) * | 2021-01-20 | 2023-10-13 | 北京高码科技有限公司 | Finite state machine based on relational database |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
JP6388682B2 (en) | Method and system for editing and reporting graphic programming language objects | |
CN114398030B (en) | System and method for modeling arbitrary software logic | |
Karsai et al. | Model-integrated development of embedded software | |
CN100511176C (en) | Method and system for rule-based generation of automation test scripts from abstract test case representation | |
DE69731614T2 (en) | NETWORKING DEVICE AND METHOD FOR MANUFACTURING SUCH A DEVICE | |
DE102011001460A1 (en) | Method and device for a data-driven interface based on relations between process control labels | |
CN106293664A (en) | Code generating method and device | |
CN1938690A (en) | Method and system for conversion of automation test scripts into abstract test case representation with persistence | |
CN107220064A (en) | A kind of digital control system interface configuration development approach | |
CN103441900A (en) | Centralization cross-platform automated testing system and control method thereof | |
CN104281906A (en) | Process engine achieving method and system in service process | |
CN102449598A (en) | Package design and generation | |
CN106408170A (en) | Electronic worksheet processing method, workflow engine and electronic worksheet system | |
CN110083406A (en) | State machine based on text two-dimensional table defines method and its system | |
CN104573915A (en) | Method and device for constructing high-speed train product structure tree | |
CN103093038A (en) | Updating method and updating device for bills of material (BOMs) | |
CN103049264A (en) | Method for controlling business system by dynamic modeling of state machine | |
CN103077022B (en) | A kind of work flow visual operation collocation method and device | |
CN103268227A (en) | Method for rapidly developing BI platform based on EXTJS | |
CN106250134B (en) | The code automatic generation method of single language | |
CN115495069B (en) | Model-driven coal industry software process implementation method, device and equipment | |
Coutaz et al. | Applications: A dimension space for user interface management systems | |
CN112784417B (en) | Avionics distributed joint simulation method and system based on SysML | |
CN103593188A (en) | System and method for managing what-you-see-is-what-you-get menus of instrument | |
CN106951593A (en) | A kind of method and apparatus for the configuration file for generating protection supervisory equipment |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
RJ01 | Rejection of invention patent application after publication | ||
RJ01 | Rejection of invention patent application after publication |
Application publication date: 20190802 |