CN111625233A - Configuration method, device and equipment of state diagram and storage medium - Google Patents
Configuration method, device and equipment of state diagram and storage medium Download PDFInfo
- Publication number
- CN111625233A CN111625233A CN202010448851.8A CN202010448851A CN111625233A CN 111625233 A CN111625233 A CN 111625233A CN 202010448851 A CN202010448851 A CN 202010448851A CN 111625233 A CN111625233 A CN 111625233A
- Authority
- CN
- China
- Prior art keywords
- target
- state
- instruction
- event
- state diagram
- 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
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F8/00—Arrangements for software engineering
- G06F8/30—Creation or generation of source code
- G06F8/34—Graphical or visual programming
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F8/00—Arrangements for software engineering
- G06F8/30—Creation or generation of source code
- G06F8/38—Creation or generation of source code for implementing user interfaces
Landscapes
- Engineering & Computer Science (AREA)
- Software Systems (AREA)
- General Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Physics & Mathematics (AREA)
- Human Computer Interaction (AREA)
- User Interface Of Digital Computer (AREA)
Abstract
The embodiment of the invention discloses a configuration method, a configuration device, equipment and a storage medium of a state diagram. The method comprises the following steps: monitoring an operation instruction in a state diagram editing interface; and if a target configuration instruction is received in the state diagram editing interface, executing the state diagram configuration operation corresponding to the target configuration instruction. The technical scheme provides a flexible state diagram configuration method, simplifies configuration operation of a developer, avoids development and modification of the developer on a code level, and further reduces development cost and maintenance cost of the state diagram.
Description
Technical Field
The embodiment of the invention relates to the technical field of computers, in particular to a configuration method, a configuration device, configuration equipment and a storage medium of a state diagram.
Background
A state diagram, also called state machine diagram, is a diagram showing a state machine showing the dynamic behavior of how an object reacts to different events according to the current state. The state diagram is suitable for modeling the dynamic aspects of the system, and for describing various states and state transitions of an object during its lifecycle.
At present, state diagrams are generated according to actual application requirements. That is, the state diagram includes various states corresponding to the actual application requirements, and what events are used to transition between the various states. Furthermore, for different application requirements, developers need to develop codes separately, and if the requirements are adjusted, the developers need to modify the development codes to adapt to the adjusted application requirements, which results in high development cost and high maintenance cost of the state diagram.
Disclosure of Invention
Embodiments of the present invention provide a method, an apparatus, a device, and a storage medium for configuring a state diagram, so as to implement simple and flexible configuration of the state diagram, and reduce development cost and maintenance cost of the state diagram.
In a first aspect, an embodiment of the present invention provides a method for configuring a state diagram, including:
monitoring an operation instruction in a state diagram editing interface;
and if a target configuration instruction is received in the state diagram editing interface, executing the state diagram configuration operation corresponding to the target configuration instruction.
In a second aspect, an embodiment of the present invention further provides a method for configuring a state diagram, including:
the operation instruction monitoring module is used for monitoring operation instructions in the state diagram editing interface;
and the state diagram configuration module is used for executing the state diagram configuration operation corresponding to the target configuration instruction if the target configuration instruction is received in the state diagram editing interface.
In a third aspect, an embodiment of the present invention further provides a computer device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, where the processor implements the configuration method of the state diagram according to any embodiment of the present invention when executing the program.
In a fourth aspect, the embodiment of the present invention further provides a computer-readable storage medium, on which a computer program is stored, where the computer program, when executed by a processor, implements the method for configuring the state diagram according to any embodiment of the present invention.
According to the technical scheme provided by the embodiment of the invention, a state diagram editing interface is provided for a user, the user can configure the state diagram in the state diagram editing interface, and when a target configuration command initiated by the user is received in the state diagram editing interface, the state diagram configuration operation matched with the target configuration command is correspondingly executed, so that a flexible state diagram configuration method is provided, the configuration operation of a developer is simplified, the development and modification of the developer at a code level are avoided, and the development cost and the maintenance cost of the state diagram are further reduced.
Drawings
FIG. 1 is a flow chart of a method for configuring a state diagram according to one embodiment of the present invention;
FIG. 2 is an exemplary diagram of a state diagram editing interface in accordance with one embodiment of the present invention;
FIG. 3 is a schematic structural diagram of a configuration device of a state diagram according to a second embodiment of the present invention;
fig. 4 is a schematic hardware structure diagram of a computer device in the third embodiment of the present invention.
Detailed Description
The present invention will be described in further detail with reference to the accompanying drawings and examples. It is to be understood that the specific embodiments described herein are merely illustrative of the invention and are not limiting of the invention. It should be further noted that, for the convenience of description, only some of the structures related to the present invention are shown in the drawings, not all of the structures.
Before discussing exemplary embodiments in more detail, it should be noted that some exemplary embodiments are described as processes or methods depicted as flowcharts. Although a flowchart may describe the operations (or steps) as a sequential process, many of the operations can be performed in parallel, concurrently or simultaneously. In addition, the order of the operations may be re-arranged. The process may be terminated when its operations are completed, but may have additional steps not included in the figure. The processes may correspond to methods, functions, procedures, subroutines, and the like.
Example one
Fig. 1 is a flowchart of a method for configuring a state diagram according to an embodiment of the present invention, which is applicable to a situation where a state diagram is newly created and/or adjusted, and the method can be performed by a device for configuring a state diagram according to an embodiment of the present invention, and the device can be implemented in software and/or hardware, and can be generally integrated in a computer device.
As shown in fig. 1, the configuration method of a state diagram provided in this embodiment specifically includes:
and S110, monitoring an operation instruction in the state diagram editing interface.
In this embodiment, a state diagram editing interface is provided, and a user can create a state diagram in the state diagram editing interface and also can adjust an original state diagram, including creating an event, deleting an event, and the like.
In an example, the state diagram editing interface may be implemented based on the Vue framework. Vue is a set of progressive JavaScript frames for constructing a user interface. Specifically, Vue may be used as a front-end framework in this example to enable bi-directional binding of data to views. Of course, the state diagram editing interface may also be implemented based on other frames, which is not specifically limited in this embodiment.
Further, the state diagram editing interface provided by the embodiment may be used in a client side or a browser side. Specifically, the multi-end use of the state diagram editing interface may be implemented based on electron, which is not specifically limited in this embodiment.
In an example, SVG (Scalable Vector Graphics) may be used as a drawing tool in the state diagram editing interface to graphically show each state and each event to a user, specifically, a block for identifying the state may be drawn by "rect", a polyline for identifying the event may be drawn by "polyline", text above the state block and text on the event line may be drawn by "text", a circle for identifying the start point of the event may be drawn by "circle", an arrow for identifying the end point of the event may be drawn by "path", which is also not specifically limited in this embodiment.
In an example, a computer language for implementing the state diagram editing interface may be typescript, a style pre-compiling tool may be less, and a component library may be ant-design-vue, which is not specifically limited in this embodiment.
The operation instruction may be any instruction initiated by a user, including but not limited to a normal operation instruction, a configuration instruction related to a state diagram, and the like. The normal operation instruction may be, for example, new creation, insertion, editing, and the like. Specifically, the operation instruction is input based on a computer input device, wherein the computer input device includes, but is not limited to, a mouse, a keyboard, a tablet, a microphone, and the like.
In one example, the state editing interface may be as shown in fig. 2, where each frame in fig. 2 identifies a state and the line between two frames identifies an event.
And S120, if the target configuration instruction is received in the state diagram editing interface, executing the state diagram configuration operation corresponding to the target configuration instruction.
Target configuration instructions refer to instructions related to state diagram configuration, including but not limited to state addition instructions, state deletion instructions, state editing instructions, state block movement instructions, state block adjustment instructions, event addition instructions, event deletion instructions, event editing instructions, event line segment adjustment instructions, and the like.
The target configuration instruction may be implemented by at least one mouse event and/or at least one keyboard event, which is not specifically limited in this embodiment.
When a user needs to create a new state diagram, a series of corresponding target configuration instructions are initiated in a state diagram editing interface according to actual application requirements, and the system carries out sequential response on the target configuration instructions and draws the state diagram corresponding to the application requirements for the user.
When a user needs to adjust the state diagram, a series of corresponding target configuration instructions are initiated in the state diagram editing interface corresponding to the original state diagram according to the adjustment requirement after the original state diagram is opened, and the system sequentially responds to the target configuration instructions to adjust the original state diagram for the user.
According to the technical scheme provided by the embodiment of the invention, a state diagram editing interface is provided for a user, the user can configure the state diagram in the state diagram editing interface, and when a target configuration command initiated by the user is received in the state diagram editing interface, the state diagram configuration operation matched with the target configuration command is correspondingly executed, so that a flexible state diagram configuration method is provided, the configuration operation of a developer is simplified, the development and modification of the developer at a code level are avoided, and the development cost and the maintenance cost of the state diagram are further reduced.
The state diagram obtained by the technical scheme supports storage and reading, and an example can be created by a state machine to show the current state.
In an example, when the target configuration instruction is a state adding instruction, executing a state diagram configuration operation corresponding to the target configuration instruction may specifically be: initializing a new state class object in response to the state addition instruction; and adding the new state class object to a target state array.
And the target state array refers to a set for storing data related to each state in the state diagram. For example, if a state diagram includes six states in total, the target state array corresponding to the state diagram includes related data corresponding to the six states.
Specifically, the state adding instruction can be triggered by left-clicking an "add button" to indicate that a state is newly created. And a left mouse click event is bound on the 'adding button', a new state class object is initialized after the left mouse click event is triggered, and the new state class object is added into a target state array of the state diagram corresponding to the current state diagram editing interface. At this time, a frame appears in the current state diagram editing interface to identify the new state, and the parameters of the frame are initialized default values.
In an example, when the target configuration instruction is a state deletion instruction, executing a state diagram configuration operation corresponding to the target configuration instruction may specifically be: and in response to the state deleting instruction, deleting the target state class object indicated by the state deleting instruction in the target state array.
The target state class object refers to a state class object corresponding to the target configuration instruction.
Specifically, the state deleting instruction may be triggered by a left-click event of a mouse and a keyboard deleting event, and is used to instruct deletion of the selected state. Each state diagram block is bound with a left-click event of the mouse, the left-click event of the mouse is bound with a class used for indicating the selection, after the left-click event of the mouse is triggered, the class bound with the left-click event of the mouse is used for adding background colors to the state diagram blocks to indicate the selection, as shown in a state 'TRX' in fig. 2, a keyboard event is also bound in the state diagram editing interface, if a delete key is clicked by a user to trigger a keyboard deletion event, a state class object corresponding to the selected state diagram block is deleted in a target state array of the state diagram corresponding to the current state diagram editing interface.
In an example, when the target configuration instruction is a state block moving instruction, executing a state diagram configuration operation corresponding to the target configuration instruction may specifically be: responding to the state block moving instruction, and determining a target state class object and target coordinates corresponding to the state block moving instruction; determining a target image block area of the target state class object in the state diagram editing interface according to the target coordinates; and if the target image block region and any image block region of the state class object in the state diagram editing interface do not have an intersection, modifying the position coordinates of the target state class object according to the target coordinates.
Specifically, the state block movement instruction may be triggered by a left mouse click event, a mouse movement event, and a mouse lift event, and is used to instruct to move the position coordinates of the state block. A left mouse click event is bound to each state diagram block, a mouse movement event and a mouse lifting event are bound in the left mouse click event, a target coordinate corresponding to the left mouse click event can be recorded through an external variable (wherein the target coordinate corresponding to the left mouse click event can refer to a position coordinate of one vertex of a target diagram block of a target state class object in a current state diagram editing interface, such as a vertex coordinate of the upper left corner) when the left mouse click event occurs, in the mouse lifting event, whether an intersection exists between a target diagram block region of the target state class object in the current state diagram editing interface and a diagram block region of any one state class object in the state diagram editing interface is judged, if yes, the target diagram block region of the target state class object in the current state diagram editing interface is moved to a position corresponding to the target coordinate, if not, further judgment is needed.
Further, in a mouse lifting event, if the target image block region intersects with one other state class object, whether the target image block region falls into the image block region of the other state class object in the state diagram editing interface is judged, if yes, a parent-child nesting relation between the other state class object and the target state class object is set, and if not, the target image block region of the target state class object in the current state diagram editing interface is not moved.
Specifically, whether all target block areas of a moved target state class object in a current state diagram editing interface fall into block areas of other state class objects in the current state diagram editing interface is judged, namely whether coordinates of four vertexes of the target block areas of the target state class object in the current state diagram editing interface are contained in the block areas of the other state class objects in the current state diagram editing interface is judged, and if yes, the other state class objects are recorded in a parent state attribute of the target state class object so as to achieve the purpose of configuring the parent-child nesting relationship. As shown in fig. 2, all records in the parent status attributes of the statuses "TRI", "TRJ", "TRD", "TRX", "TRXD" are the status "TR".
Further, if the parent-child nesting relationship is set between the other state class objects and the target state class object, when a state block moving instruction for the target state class object is received, if it is determined that the target image block region does not completely fall into any image block region of the state class object in the state diagram editing interface, the parent-child nesting relationship between the other state class object and the target state class object is cleared.
Specifically, if the parent state attribute of the target state class object is not empty, whether the target block region of the moved target state class object in the current state diagram editing interface does not fall into the block region of any other state class object in the current state diagram editing interface is also judged, namely the coordinates of four vertexes of the target block region of the target state class object in the current state diagram editing interface do not fall into the block region of any other state class object in the current state diagram editing interface, if yes, the parent state attribute of the target state class object is emptied, namely the parent nesting relationship between the other state class object and the target state class object is released.
In a specific example, when the target configuration instruction is a state block movement instruction, in a mouse left-click event bound to a state block, a vertex position of a target block of the target state class object in the current state diagram editing interface is first recorded through an external variable. And in the mouse moving event, modifying the position of the target image block region of the target state class object in the current state diagram editing interface in real time, and realizing the effect that the target image block region moves along with the mouse. In the event of mouse lifting, judging the position relationship between the target block region determined according to the horizontal coordinate and the vertical coordinate at the moment and the block regions of other state class objects in the current state diagram editing interface, if the target block region and the block regions of other state class objects in the current state diagram editing interface have intersection and the target block region does not completely fall into the block regions of other state class objects in the current state diagram editing interface, restoring the position of the block region of the target state class object in the current state diagram editing interface to the original position according to the coordinate value (for example, the original top left vertex position coordinate of the target region) recorded by the previous external variable, and if the target block region and the block regions of other state class objects in the current state diagram editing interface have no intersection, removing the mouse moving event and the mouse lifting event, the state block move ends.
In an example, when the target configuration instruction is a state block adjustment instruction, executing a state diagram configuration operation corresponding to the target configuration instruction may specifically be:
in response to the state block adjustment instruction, determining a target boundary of a target state class object corresponding to the state block adjustment instruction in a state diagram editing interface; adjusting the position coordinates of the target boundary according to the target coordinates corresponding to the state block adjusting instruction, and adjusting the image block area of the target state class object in the state diagram editing interface according to the adjusted target boundary; and updating the target state class object in the target state array according to the adjusted image block area.
The state block moving instruction can be triggered by a mouse moving event, a mouse left-click event, a mouse moving event and a mouse lifting event, and is used for indicating that the size of the area of the state block is adjusted, and the state block can be enlarged or reduced. Each state image block is bound with a mouse moving event, whether the distance between the coordinates of the mouse and each boundary of the image block of the target state class object in the state diagram editing interface is within a set pixel range (for example, 5 pixels) is judged in the mouse moving event, and if yes, the mouse style is converted into a zoom icon through the style class bound with the mouse moving event (the icon style is not specifically limited and is different from the conventional mouse style). And after the left-click event of the mouse bound by the state image block is triggered, if the mouse style is judged to be a zoom icon, recording the current mouse coordinate, and adding a mouse movement event. In the mouse moving event, the boundary position corresponding to the mouse left-click event is adjusted according to the current mouse coordinates, and meanwhile, the whole image block area is adaptively adjusted, so that the effect of zooming the image block area is realized. And the mouse moving event is also bound with a mouse lifting event, and in the mouse lifting event, whether the adjusted block region has intersection with other block regions is judged, if so, the block region is restored, and if not, the state block adjusting process is ended.
In an example, when the target configuration instruction is a state editing instruction, executing a state diagram configuration operation corresponding to the target configuration instruction may specifically be: in response to the status edit instruction, a status edit window pops up to receive status configuration details.
And the state editing instruction can be triggered by a mouse left double-click event and a keyboard event and is used for editing the details of the state. And each state graph block is bound with a left double-click event of the mouse, and when the left double-click event of the mouse is triggered, a variable which is bound with the left double-click event of the mouse and is used for judging whether a popup window is opened or not can be assigned as a true value, so that the popup window is used for a user to edit state details.
In an example, when the target configuration instruction is an event addition instruction, executing a state diagram configuration operation corresponding to the target configuration instruction may specifically be:
in response to an event adding instruction, determining a starting point and an end point of a new event class object corresponding to the event adding instruction in a line segment in a state diagram editing interface, and setting indication marks of the new event class object at the positions of the starting point and the end point; and adding the new event class object to a target event array.
And the target event array refers to a set for storing data related to each event in the state diagram. For example, if a state diagram includes six events in total, the target event array corresponding to the state diagram includes related data corresponding to the six events.
The event adding instruction can be triggered by a right mouse click event, a mouse moving event and a mouse lifting event and is used for creating an event. Specifically, each state graph block is bound with a right mouse click event, the current mouse coordinate is assigned to the start point coordinate of the temporary schematic line segment in the right mouse click event, and a mouse moving event and a mouse lifting event are added. And in the event of mouse movement, assigning the current mouse coordinate to the endpoint coordinate of the temporary schematic line segment in real time. In the event of mouse lifting, if the current coordinates of the mouse are within the area range of a certain state diagram block, the starting point and the end point of the temporary line segment are adjusted, so that the starting point and the end point of the temporary line segment just fall on one boundary of the state diagram block. For example, it is possible to determine which boundary of the status block including the start point coordinate of the temporary line segment is closest, assign the coordinate value corresponding to the closest boundary to the start point of the temporary line segment, and so on for the end point of the temporary line segment. Then, the data of the temporary line segment is copied into the target event array. At this time, a new creation of an event is completed in the current state diagram editing interface, and the new creation is identified by a line segment.
Further, SVG may be used to draw a circle at the start of the line segment and an arrow at the end of the line segment to indicate the direction of the event, i.e. the transition flow of the two states, as shown in fig. 2. Wherein the coordinates of the respective vertices of the end arrows can be calculated by trigonometric functions. And finally, setting the coordinates of the starting point and the end point of the temporary line segment to zero.
In an example, when the target configuration instruction is an event deletion instruction, executing a state diagram configuration operation corresponding to the target configuration instruction may specifically be: and in response to the event deleting instruction, deleting the event class object corresponding to the event deleting instruction in the target event array.
Specifically, the event deletion instruction may be triggered by a left-click mouse event and a keyboard deletion event, and is used to instruct deletion of the selected event. The method comprises the steps that a left-click event of a mouse is bound to each event line segment, the left-click event of the mouse is bound with a class used for indicating selection, when the left-click event of the mouse is triggered, the class bound to the left-click event of the mouse adds an identifier for the event line segment to indicate selection, a keyboard event is also bound to a state diagram editing interface, if a delete key is clicked by a user to trigger the keyboard event, an event class object corresponding to the selected event line segment is deleted in a target event array of a state diagram corresponding to the current state diagram editing interface.
In an example, when the target configuration instruction is an event line segment adjustment instruction, executing a state diagram configuration operation corresponding to the target configuration instruction may specifically be:
responding to the event line segment adjusting instruction, and determining a new starting point and/or a new end point of a line segment of a target event class object corresponding to the event line segment adjusting instruction in the state diagram editing interface; and updating the target event class object in the target event array according to the new starting point and/or the new ending point.
The target event class object refers to an event class object corresponding to the target configuration instruction.
The event line segment adjusting instruction can be triggered by a left mouse click event, a mouse moving event and a mouse lifting event and is used for adjusting the event line segment. Specifically, a left-click mouse event is bound to the start point and the end point of the event line segment, for example, a left-click mouse event is bound to the start point circle and the end point arrow, data of the current event line segment is copied to an external variable in the left-click mouse event, and a mouse movement event and a mouse lifting event are bound. If the left mouse click event at the starting point of the event segment is triggered, assigning the current coordinate of the mouse to the starting point of the event segment in the mouse moving event, judging whether the current coordinate of the mouse is in the area range of a certain state segment in the mouse lifting event, if so, adjusting the starting point of the event segment to ensure that the starting point of the event segment just falls on one boundary of the state segment, for example, judging which boundary of the state segment containing the starting point coordinate of the temporary segment is closest to the starting point coordinate of the temporary segment, and assigning the corresponding coordinate value on the closest boundary to the starting point of the temporary segment. In the event of mouse lifting, if the current coordinate of the mouse is not in the area range of a certain state image block, the data in the external variable is assigned to the event line segment again so as to restore the event line segment. The left mouse click event on the event segment end point is triggered, and so on, and will not be described herein.
In an example, when the target configuration instruction is an event editing instruction, executing a state diagram configuration operation corresponding to the target configuration instruction may specifically be: in response to the event editing instructions, an event editing window pops up to receive state configuration details.
And the event editing instruction can be triggered by a mouse left double-click event and a keyboard event and is used for editing the details of the event. And a left double-click event of the mouse is bound to each event line segment, and when the left double-click event of the mouse is triggered, a variable which is bound to the left double-click event of the mouse and is used for judging whether a popup window is opened or not can be assigned as a true value, so that the popup window is used for a user to edit the details of the event.
Further, the event line segment may be a broken line, that is, a plurality of line segments connected together. A mouse left-click event and a mouse moving event are bound to the middle position (non-starting point) of the event line segment, and when a mouse click event on any point of the middle position of the event line segment is triggered, the style class bound with the mouse click event converts the mouse style into a broken line setting icon (the icon style is not specifically limited and is different from the conventional mouse style). And after the left-click event of the mouse is triggered, if the mouse style is judged to be the fold line setting icon, recording the current mouse coordinate, and adding a mouse moving event. In the mouse moving event, the coordinates of the click points of the event line segment are adjusted according to the current mouse coordinates, and the whole event line segment is adaptively adjusted at the same time, so that the event line segment becomes an event broken line segment. And the mouse moving event is also bound with a mouse lifting event, in the mouse lifting event, whether the adjusted event broken line segment has intersection with other image block areas is judged, if so, the image block area is restored, and if not, the broken point data is added into the target broken point array, and the event broken line setting process is ended.
In one example, SVG may be used to draw a circle over a break point of an event line segment, as shown in FIG. 2.
Further, the word "event details" may be displayed on the event line segment, and specifically, the position of the word "event details" may be calculated using the pythagorean theorem, so that the word "event details" is displayed on the middle position of the event line segment. When the number of the break points on the event broken line segment is large, the center position of the event segment can be determined by utilizing the Pythagorean theorem according to the coordinates of each break point after the mouse lifting event is triggered, and then the text 'event details' is displayed on the center position of the event segment.
In an example, a left mouse click event and a mouse movement event are bound to the break point to realize adjustment of the break point, and the principle is the same as that of adjustment of the event line segment, which is not described herein again.
In one example, a left-click mouse event and a keyboard deletion event are bound to the break point to delete the break point. When a mouse left-click event on a break point is triggered, once a keyboard deletion event is also triggered, the break point data is deleted in a target break point array, correspondingly, the break point disappears in the current state diagram editing interface, and the event line segment adaptability is adjusted.
Example two
Fig. 3 is a schematic structural diagram of a configuration apparatus of a state diagram according to a second embodiment of the present invention, which is applicable to a case where a state diagram is newly created and/or adjusted, and the apparatus can be implemented in software and/or hardware, and can be generally integrated in a computer device.
As shown in fig. 3, the configuration apparatus of the state diagram specifically includes: an operation instruction monitoring module 210 and a state diagram configuration module 220. Wherein,
an operation instruction monitoring module 210, configured to monitor an operation instruction in the state diagram editing interface;
and the state diagram configuration module 220 is configured to, if a target configuration instruction is received in the state diagram editing interface, execute a state diagram configuration operation corresponding to the target configuration instruction.
According to the technical scheme provided by the embodiment of the invention, a state diagram editing interface is provided for a user, the user can configure the state diagram in the state diagram editing interface, and when a target configuration command initiated by the user is received in the state diagram editing interface, the state diagram configuration operation matched with the target configuration command is correspondingly executed, so that a flexible state diagram configuration method is provided, the configuration operation of a developer is simplified, the development and modification of the developer at a code level are avoided, and the development cost and the maintenance cost of the state diagram are further reduced.
In one example, the target configuration instructions include: a state add instruction; correspondingly, the state diagram configuring module 220 is specifically configured to, if a target configuration instruction is received in the state diagram editing interface, respond to the state addition instruction and initialize a new state class object; adding the new state class object to a target state array;
in one example, the target configuration instructions include: a state deleting instruction; correspondingly, the state diagram configuring module 220 is specifically configured to, if a target configuration instruction is received in the state diagram editing interface, respond to the state deleting instruction, delete the target state class object indicated by the state deleting instruction in the target state array.
In one example, the target configuration instructions include: a status block move instruction; correspondingly, the state diagram configuring module 220 is specifically configured to, if a target configuration instruction is received in the state diagram editing interface, determine, in response to the state block moving instruction, a target state class object and a target coordinate corresponding to the state block moving instruction; determining a target image block area of the target state class object in the state diagram editing interface according to the target coordinates; and if the target image block region does not have an intersection with any image block region of the state class object in the state diagram editing interface, modifying the position coordinates of the target state class object according to the target coordinates.
Further, the state diagram configuring module 220 is further specifically configured to, if the target tile block region intersects with one other state class object, determine whether all the target tile block regions fall into the tile block regions of the other state class objects in the state diagram editing interface, and if yes, set a parent-child nesting relationship between the other state class objects and the target state class object;
further, the state diagram configuration module 220 is further specifically configured to, if a parent-child nesting relationship is set between another state class object and the target state class object, when a state block movement instruction for the target state class object is received, if it is determined that all of the target tile regions do not fall within any tile region of the state class object in the state diagram editing interface, clear the parent-child nesting relationship between the other state class object and the target state class object.
In one example, the target configuration instructions include: a state block adjustment instruction; correspondingly, the state diagram configuring module 220 is specifically configured to, if a target configuration instruction is received in the state diagram editing interface, determine, in response to the state block adjustment instruction, a target boundary of a target state class object corresponding to the state block adjustment instruction in a tile in the state diagram editing interface; adjusting the position coordinates of the target boundary according to the target coordinates corresponding to the state block adjusting instruction, and adjusting the image block area of the target state class object in the state diagram editing interface according to the adjusted target boundary; and updating the target state class object in the target state array according to the adjusted image block area.
In one example, the target configuration instructions include: an event adding instruction; correspondingly, the state diagram configuring module 220 is specifically configured to, if a target configuration instruction is received in the state diagram editing interface, determine, in response to the event addition instruction, a start point and an end point of a line segment of a new event class object in the state diagram editing interface, where the new event class object corresponds to the event addition instruction, and set an indication identifier of the new event class object at positions of the start point and the end point; adding the new event class object to a target event array;
in one example, the target configuration instructions include: an event deletion instruction; correspondingly, the state diagram configuration module 220 is specifically configured to, if a target configuration instruction is received in the state diagram editing interface, respond to the event deletion instruction, delete the event class object corresponding to the event deletion instruction in the target event array.
In one example, the target configuration instructions include: an event line segment adjustment instruction; correspondingly, the state diagram configuring module 220 is specifically configured to, if a target configuration instruction is received in the state diagram editing interface, determine, in response to the event line segment adjustment instruction, a new start point and/or a new end point of a line segment of the target event class object in the state diagram editing interface, where the target event class object corresponds to the event line segment adjustment instruction; and updating the target event class object in the target event array according to the new starting point and/or the new ending point.
The configuration device of the state diagram can execute the configuration method of the state diagram provided by any embodiment of the invention, and has the corresponding functional modules and beneficial effects of executing the configuration method of the state diagram.
EXAMPLE III
Fig. 4 is a schematic structural diagram of a computer device according to a third embodiment of the present invention. FIG. 4 illustrates a block diagram of an exemplary computer device 12 suitable for use in implementing embodiments of the present invention. The computer device 12 shown in FIG. 4 is only one example and should not bring any limitations to the functionality or scope of use of embodiments of the present invention.
As shown in FIG. 4, computer device 12 is in the form of a general purpose computing device. The components of computer device 12 may include, but are not limited to: one or more processors or processing units 16, a system memory 28, and a bus 18 that couples various system components including the system memory 28 and the processing unit 16.
The system memory 28 may include computer system readable media in the form of volatile memory, such as Random Access Memory (RAM)30 and/or cache memory 32. Computer device 12 may further include other removable/non-removable, volatile/nonvolatile computer system storage media. By way of example only, storage system 34 may be used to read from and write to non-removable, nonvolatile magnetic media (not shown in FIG. 4, and commonly referred to as a "hard drive"). Although not shown in FIG. 4, a magnetic disk drive for reading from and writing to a removable, nonvolatile magnetic disk (e.g., a "floppy disk") and an optical disk drive for reading from or writing to a removable, nonvolatile optical disk (e.g., a CD-ROM, DVD-ROM, or other optical media) may be provided. In these cases, each drive may be connected to bus 18 by one or more data media interfaces. System memory 28 may include at least one program product having a set (e.g., at least one) of program modules that are configured to carry out the functions of embodiments of the invention.
A program/utility 40 having a set (at least one) of program modules 42 may be stored, for example, in system memory 28, such program modules 42 including, but not limited to, an operating system, one or more application programs, other program modules, and program data, each of which examples or some combination thereof may comprise an implementation of a network environment. Program modules 42 generally carry out the functions and/or methodologies of the described embodiments of the invention.
The processing unit 16 executes various functional applications and data processing by executing programs stored in the system memory 28, for example, to implement a configuration method of a state diagram provided by an embodiment of the present invention. That is, the processing unit implements, when executing the program: monitoring an operation instruction in a state diagram editing interface; and if a target configuration instruction is received in the state diagram editing interface, executing the state diagram configuration operation corresponding to the target configuration instruction.
Example four
A fourth embodiment of the present invention provides a computer-readable storage medium, on which a computer program is stored, where the computer program, when executed by a processor, implements a method for configuring a state diagram, as provided in all embodiments of the present invention: that is, the program when executed by the processor implements: monitoring an operation instruction in a state diagram editing interface; and if a target configuration instruction is received in the state diagram editing interface, executing the state diagram configuration operation corresponding to the target configuration instruction.
Any combination of one or more computer-readable media may be employed. The computer readable medium may be a computer readable signal medium or a computer readable storage medium. A computer readable storage medium may be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination of the foregoing. More specific examples (a non-exhaustive list) of the computer readable storage medium would include the following: an electrical connection having one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing. In the context of this document, a computer readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device.
A computer readable signal medium may include a propagated data signal with computer readable program code embodied therein, for example, in baseband or as part of a carrier wave. Such a propagated data signal may take many forms, including, but not limited to, electro-magnetic, optical, or any suitable combination thereof. A computer readable signal medium may also be any computer readable medium that is not a computer readable storage medium and that can communicate, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device.
Program code embodied on a computer readable medium may be transmitted using any appropriate medium, including but not limited to wireless, wireline, optical fiber cable, RF, etc., or any suitable combination of the foregoing.
Computer program code for carrying out operations for aspects of the present invention may be written in any combination of one or more programming languages, including an object oriented programming language such as Java, Smalltalk, C + + or the like and conventional procedural programming languages, such as the "C" programming language or similar programming languages. The program code may execute entirely on the user's computer, partly on the user's computer, as a stand-alone software package, partly on the user's computer and partly on a remote computer or entirely on the remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer through any type of network, including a Local Area Network (LAN) or a Wide Area Network (WAN), or the connection may be made to an external computer (for example, through the Internet using an Internet service provider).
It should be noted that, in the embodiment of the configuration apparatus of the state diagram, the included units and modules are only divided according to functional logic, but are not limited to the above division as long as the corresponding functions can be implemented; in addition, specific names of the functional units are only for convenience of distinguishing from each other, and are not used for limiting the protection scope of the present invention.
It is to be noted that the foregoing is only illustrative of the preferred embodiments of the present invention and the technical principles employed. It will be understood by those skilled in the art that the present invention is not limited to the particular embodiments described herein, but is capable of various obvious changes, rearrangements and substitutions as will now become apparent to those skilled in the art without departing from the scope of the invention. Therefore, although the present invention has been described in greater detail by the above embodiments, the present invention is not limited to the above embodiments, and may include other equivalent embodiments without departing from the spirit of the present invention, and the scope of the present invention is determined by the scope of the appended claims.
Claims (10)
1. A method for configuring a state diagram, comprising:
monitoring an operation instruction in a state diagram editing interface;
and if a target configuration instruction is received in the state diagram editing interface, executing the state diagram configuration operation corresponding to the target configuration instruction.
2. The method of claim 1, wherein the target configuration instruction comprises: a state add instruction;
executing a state diagram configuration operation corresponding to the target configuration instruction, including:
initializing a new state class object in response to the state addition instruction;
adding the new state class object to a target state array;
and/or the presence of a gas in the gas,
the target configuration instructions include: a state deleting instruction;
executing a state diagram configuration operation corresponding to the target configuration instruction, including:
and in response to the state deleting instruction, deleting the target state class object indicated by the state deleting instruction in the target state array.
3. The method of claim 1, wherein the target configuration instruction comprises: a status block move instruction;
executing a state diagram configuration operation corresponding to the target configuration instruction, including:
responding to the state block moving instruction, and determining a target state class object and target coordinates corresponding to the state block moving instruction;
determining a target image block area of the target state class object in the state diagram editing interface according to the target coordinates;
and if the target image block region does not have an intersection with any image block region of the state class object in the state diagram editing interface, modifying the position coordinates of the target state class object according to the target coordinates.
4. The method of claim 3, further comprising:
if the target image block region is intersected with one other state class object, judging whether the target image block region falls into the image block region of the other state class object in the state diagram editing interface or not, if so, setting a parent-child nesting relation between the other state class object and the target state class object;
and/or the presence of a gas in the gas,
if the parent-child nesting relationship is set between other state class objects and the target state class object, when a state block moving instruction for the target state class object is received, if the target image block region is determined not to fall into any image block region of the state class object in the state diagram editing interface, the parent-child nesting relationship between the other state class objects and the target state class object is cleared.
5. The method of claim 1, wherein the target configuration instruction comprises: a state block adjustment instruction;
executing a state diagram configuration operation corresponding to the target configuration instruction, including:
in response to the state block adjustment instruction, determining a target boundary of a target state class object corresponding to the state block adjustment instruction in a graph block in the state diagram editing interface;
adjusting the position coordinates of the target boundary according to the target coordinates corresponding to the state block adjusting instruction, and adjusting the image block area of the target state class object in the state diagram editing interface according to the adjusted target boundary;
and updating the target state class object in the target state array according to the adjusted image block area.
6. The method of claim 1, wherein the target configuration instruction comprises: an event adding instruction;
executing a state diagram configuration operation corresponding to the target configuration instruction, including:
in response to the event adding instruction, determining a starting point and an end point of a line segment of a new event class object corresponding to the event adding instruction in the state diagram editing interface, and setting indication marks of the new event class object at the positions of the starting point and the end point;
adding the new event class object to a target event array;
and/or the presence of a gas in the gas,
the target configuration instructions include: an event deletion instruction;
executing a state diagram configuration operation corresponding to the target configuration instruction, including:
and in response to the event deleting instruction, deleting the event class object corresponding to the event deleting instruction in the target event array.
7. The method of claim 1, wherein the target configuration instruction comprises: an event line segment adjustment instruction;
executing a state diagram configuration operation corresponding to the target configuration instruction, including:
responding to the event line segment adjusting instruction, and determining a new starting point and/or a new end point of a line segment of a target event class object corresponding to the event line segment adjusting instruction in the state diagram editing interface;
and updating the target event class object in the target event array according to the new starting point and/or the new ending point.
8. An apparatus for configuring a state diagram, comprising:
the operation instruction monitoring module is used for monitoring operation instructions in the state diagram editing interface;
and the state diagram configuration module is used for executing the state diagram configuration operation corresponding to the target configuration instruction if the target configuration instruction is received in the state diagram editing interface.
9. A computer device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, characterized in that the processor implements the method according to any of claims 1-7 when executing the program.
10. A computer-readable storage medium, on which a computer program is stored which, when being executed by a processor, carries out the method according to any one of claims 1-7.
Priority Applications (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN202010448851.8A CN111625233A (en) | 2020-05-25 | 2020-05-25 | Configuration method, device and equipment of state diagram and storage medium |
Applications Claiming Priority (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN202010448851.8A CN111625233A (en) | 2020-05-25 | 2020-05-25 | Configuration method, device and equipment of state diagram and storage medium |
Publications (1)
| Publication Number | Publication Date |
|---|---|
| CN111625233A true CN111625233A (en) | 2020-09-04 |
Family
ID=72259062
Family Applications (1)
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| CN202010448851.8A Pending CN111625233A (en) | 2020-05-25 | 2020-05-25 | Configuration method, device and equipment of state diagram and storage medium |
Country Status (1)
| Country | Link |
|---|---|
| CN (1) | CN111625233A (en) |
Cited By (1)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN113610939A (en) * | 2021-07-28 | 2021-11-05 | Oppo广东移动通信有限公司 | UI object positioning method, terminal device and computer-readable storage medium |
Citations (6)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| US5801687A (en) * | 1994-09-30 | 1998-09-01 | Apple Computer, Inc. | Authoring tool comprising nested state machines for use in a computer system |
| US20080263512A1 (en) * | 2007-04-20 | 2008-10-23 | Dellas Christina M | Statechart Development Environment with Embedded Graphical Data Flow Code Editor |
| CN105955755A (en) * | 2016-05-19 | 2016-09-21 | 上海大学 | State diagram-based coding verification method |
| CN109901764A (en) * | 2019-01-29 | 2019-06-18 | 深圳点猫科技有限公司 | A kind of code editor right-click menu function realizing method and electronic equipment |
| CN110502237A (en) * | 2019-09-07 | 2019-11-26 | 创新奇智(广州)科技有限公司 | A kind of software interface prototype method and tool based on state diagram |
| CN110825428A (en) * | 2019-11-06 | 2020-02-21 | 政采云有限公司 | State machine configuration method, device, equipment and readable storage medium |
-
2020
- 2020-05-25 CN CN202010448851.8A patent/CN111625233A/en active Pending
Patent Citations (6)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| US5801687A (en) * | 1994-09-30 | 1998-09-01 | Apple Computer, Inc. | Authoring tool comprising nested state machines for use in a computer system |
| US20080263512A1 (en) * | 2007-04-20 | 2008-10-23 | Dellas Christina M | Statechart Development Environment with Embedded Graphical Data Flow Code Editor |
| CN105955755A (en) * | 2016-05-19 | 2016-09-21 | 上海大学 | State diagram-based coding verification method |
| CN109901764A (en) * | 2019-01-29 | 2019-06-18 | 深圳点猫科技有限公司 | A kind of code editor right-click menu function realizing method and electronic equipment |
| CN110502237A (en) * | 2019-09-07 | 2019-11-26 | 创新奇智(广州)科技有限公司 | A kind of software interface prototype method and tool based on state diagram |
| CN110825428A (en) * | 2019-11-06 | 2020-02-21 | 政采云有限公司 | State machine configuration method, device, equipment and readable storage medium |
Cited By (1)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN113610939A (en) * | 2021-07-28 | 2021-11-05 | Oppo广东移动通信有限公司 | UI object positioning method, terminal device and computer-readable storage medium |
Similar Documents
| Publication | Publication Date | Title |
|---|---|---|
| US11650910B2 (en) | Automated testing method and apparatus, storage medium and electronic device | |
| CN110069257B (en) | Interface processing method and device and terminal | |
| CA2124604C (en) | Method and apparatus for operating on an object-based model data structure to produce a second image in the spatial context of a first image | |
| CN102221993B (en) | The declarative definition of complex user interface Status Change | |
| US20060112346A1 (en) | System and method for directional focus navigation | |
| CN110378063B (en) | Equipment deployment method and device based on intelligent building space and electronic equipment | |
| US20170221242A1 (en) | Automatic overdraw reduction before rendering | |
| CN107807814B (en) | Application component construction method, device, equipment and computer readable storage medium | |
| CN110990014A (en) | Method and device for generating page code of skeleton screen, server and storage medium | |
| US20220284377A1 (en) | Method and apparatus for task group positioning | |
| US10983625B2 (en) | Systems and methods for measurement of unsupported user interface actions | |
| CN107885437A (en) | multi-element interaction method, device, equipment and storage medium | |
| US20220358258A1 (en) | Computer-aided design methods and systems | |
| KR20040021563A (en) | Screen display processing apparatus, screen display processing method and computer program | |
| US6734855B2 (en) | Image editing system and method, image processing system and method, and recording media therefor | |
| CN108920230B (en) | Response method, device, device and storage medium for mouse hovering operation | |
| CN111625233A (en) | Configuration method, device and equipment of state diagram and storage medium | |
| CN107992242A (en) | Switching method, device and equipment of floating window and storage medium | |
| CN111008934A (en) | Scene construction method, device, equipment and storage medium | |
| CN111054072B (en) | Method, device, equipment and storage medium for role model tailing | |
| CN111414085B (en) | An input method operation method, system and medium of a Kirin mobile operating system | |
| US20250045471A1 (en) | Multimodal prompts for machine learning models to generate three-dimensional designs | |
| CN110147260B (en) | Method, medium, apparatus and computing device for implementing scene transition animation | |
| CN114356475B (en) | Display processing method, device, equipment and storage medium | |
| CN112306588A (en) | A window stacking method, apparatus, apparatus and medium |
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 |
Application publication date: 20200904 |
|
| RJ01 | Rejection of invention patent application after publication |