Scene execution method, apparatus, and electronic device
Patent Information
- Application Number
- CN202211505573.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-11-28
- Publication Date
- 2026-10-23
- Estimated Expiration
- 2042-11-28
AI Technical Summary
[0046] The fifth aspect of this application provides a computer program product that, when executed by a processor of an electronic device, enables the electronic device to perform the scenario execution method proposed in the first aspect of this application.
Smart Images

Figure CN115878858B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of Internet of Things (IoT) technology, and in particular to a scene execution method, apparatus, and electronic device. Background Technology
[0002] With the continuous development of mobile communication and Internet of Things (IoT) technologies, many everyday devices have become intelligent, such as smart lights, smart switches, and smart thermometers and hygrometers. Users can use automated rules to enable intelligent linkage between multiple devices, thereby realizing a "smart home."
[0003] In some cases, users have a need for nested scene functionality. For example, a user might set manual scene A to "turn off all lights in the bedroom with one click" and manual scene B to "turn off all lights in the living room with one click." The user can then execute scenes A and B respectively when leaving the bedroom and living room. When the user leaves home, a separate manual scene, "turn off all lights in the house with one click," could be set as manual scene C to "execute A and B with one click," making the operation simpler and more convenient for the user. To implement complex nested scene functionality, issues such as circular nesting between scenes and excessively high nesting levels need to be addressed. Summary of the Invention
[0004] This application aims to at least partially address one of the technical problems in the related art.
[0005] Therefore, the purpose of this application is to provide a scenario execution method, apparatus, and electronic device.
[0006] The first aspect of this application proposes a scenario execution method, including:
[0007] Iterate through the list of parent scenes of the current scene, and the list of parent scenes of each scene in the list of parent scenes;
[0008] In response to an empty parent scene list, the current scene's child scene list and the child scene lists of each scene in the child scene list are traversed.
[0009] Based on the traversal results of the parent scene list and the child scene list, determine the nesting level and nesting relationship;
[0010] The current scene is the parent scene in a set of nested scenes to be edited, and the set of nested scenes to be edited includes the current scene and / or at least one sub-scene executed in the current scene.
[0011] Optionally, the method further includes:
[0012] Store the identifiers of each scene in the traversed parent scene list into the parent scene identifier container.
[0013] Optionally, determining the nesting relationship based on the traversal results of the parent scene list and the child scene list includes:
[0014] Based on the traversal results of the parent scene identifier container and the child scene list, determine whether there is a nested relationship forming a cycle.
[0015] Optionally, determining whether a nested, circular relationship exists based on the traversal results of the parent scene identifier container and the child scene list includes:
[0016] Determine whether each scene in the list of traversed sub-scenes is included in the parent scene identifier container;
[0017] In response to the fact that at least one scene in the traversed list of sub-scenes is included within the parent scene identifier container, it is determined that a nested relationship forming a ring exists.
[0018] Since each scene in the traversed list of sub-scenes is not included in the parent scene identifier container, it is determined that there is no nested relationship forming a loop.
[0019] Optionally, the list of sub-scenes of the current scene includes at least one sub-scene from the set of nested scenes to be edited.
[0020] Optionally, determining the nesting level based on the traversal results of the parent scene list and the child scene list includes:
[0021] If the list of parent scenes being traversed is not empty, increment the nesting level by one.
[0022] If the list of traversed sub-scenes is not empty, increment the nesting level by one.
[0023] Optionally, the method further includes:
[0024] Determine whether the number of nested levels exceeds the limit.
[0025] A second aspect of this application provides a scene execution apparatus, comprising:
[0026] The first traversal module is used to traverse the parent scene list of the current scene, as well as the parent scene list of each scene in the parent scene list.
[0027] The second traversal module is used to traverse the list of child scenes of the current scene and the list of child scenes of each scene in the list of child scenes in response to the parent scene list being empty.
[0028] The detection module is used to determine the nesting level and nesting relationship based on the traversal results of the parent scene list and the child scene list;
[0029] The current scene is the parent scene in a set of nested scenes to be edited, and the set of nested scenes to be edited includes the current scene and / or at least one sub-scene executed in the current scene.
[0030] Optionally, the device further includes:
[0031] The storage module is used to store the identifiers of each scene in the traversed parent scene list into the parent scene identifier container.
[0032] Optionally, the detection module is specifically used for:
[0033] Based on the traversal results of the parent scene identifier container and the child scene list, determine whether there is a nested relationship forming a cycle.
[0034] Optionally, the detection module is specifically used for:
[0035] Determine whether each scene in the list of traversed sub-scenes is included in the parent scene identifier container;
[0036] In response to the fact that at least one scene in the traversed list of sub-scenes is included within the parent scene identifier container, it is determined that a nested relationship forming a ring exists.
[0037] Since each scene in the traversed list of sub-scenes is not included in the parent scene identifier container, it is determined that there is no nested relationship forming a loop.
[0038] Optionally, the list of sub-scenes of the current scene includes at least one sub-scene from the set of nested scenes to be edited.
[0039] Optionally, the detection module is specifically used for:
[0040] If the list of parent scenes being traversed is not empty, increment the nesting level by one.
[0041] If the list of traversed sub-scenes is not empty, increment the nesting level by one.
[0042] Optionally, the detection module is further configured to:
[0043] Determine whether the number of nested levels exceeds the limit.
[0044] A third aspect of this application provides an electronic device, comprising: a processor; and a memory for storing executable instructions of the processor; wherein the processor is configured to invoke and execute the executable instructions stored in the memory to implement the scenario execution method proposed in the first aspect of this application.
[0045] The fourth aspect of this application provides a non-transitory computer-readable storage medium that, when the instructions in the storage medium are executed by a processor of an electronic device, enables the electronic device to execute the scenario execution method proposed in the first aspect of this application.
[0046] The fifth aspect of this application provides a computer program product that, when executed by a processor of an electronic device, enables the electronic device to perform the scenario execution method proposed in the first aspect of this application.
[0047] The technical solution of this application, by traversing the parent scene list of the current scene and the parent scene list of each scene in the parent scene list, and responding to the traversed parent scene list being empty, traversing the child scene list of the current scene and the child scene list of each scene in the child scene list, and determining the nesting level and nesting relationship based on the traversal results of the parent scene list and the child scene list, wherein the current scene is the parent scene in a set of nested scenes to be edited, and the set of nested scenes to be edited includes the current scene and / or at least one child scene executed in the current scene, can simply, quickly and efficiently detect the nesting relationship of scenes, can avoid scenes from forming a cycle and limit the nesting level of scenes, can avoid repeated execution of scenes, ensure the execution performance of scene functions, and improve system efficiency.
[0048] Additional aspects and advantages of this application will be set forth in part in the description which follows, and in part will be obvious from the description, or may be learned by practice of this application. Attached Figure Description
[0049] The above and / or additional aspects and advantages of this application will become apparent and readily understood from the following description of the embodiments taken in conjunction with the accompanying drawings, wherein:
[0050] Figure 1 A flowchart illustrating a scenario execution method provided in an embodiment of this application;
[0051] Figure 2 A flowchart illustrating another scenario execution method provided in an embodiment of this application;
[0052] Figure 3 This is a schematic diagram of the structure of a scene execution device provided in an embodiment of this application;
[0053] Figure 4 This is a structural block diagram of an electronic device provided in an embodiment of this application. Detailed Implementation
[0054] The embodiments of this application are described in detail below. Examples of these embodiments are shown in the accompanying drawings, wherein the same or similar reference numerals denote the same or similar elements or elements having the same or similar functions throughout. The embodiments described below with reference to the accompanying drawings are exemplary and intended to explain this application, and should not be construed as limiting this application.
[0055] To better understand this application, some terms and concepts will be explained first.
[0056] 1. Scenario: In the embodiments of this application, a scenario refers to a manual scenario, which is a smart home rule created by the user. One or more execution actions can be configured in the manual scenario, such as "turn on the lights", "turn on the TV", etc. This rule can be triggered by a certain triggering method, such as clicking a button in the application.
[0057] 2. Nesting: An action can be added to a manual scene A to execute a manual scene B, which is called A nested in B. In the embodiments of this application, if scene A nests scene B, then scene A can be called the parent scene of scene B, and scene B can be called the child scene of scene A.
[0058] 3. Nesting Level: The nesting level is the number of scenes in the chain from the top to the bottom scene, minus 1. For example, A nesting B is called level 1 nesting; A nesting B, and B nesting C is called level 2 nesting.
[0059] 4. Nested Loops: The phenomenon that causes scenes to be triggered cyclically is called nested loops. For example, A nests within A; A nests within B, and B nests within A. Both of these nesting methods can cause scene A to be triggered cyclically.
[0060] The following description, with reference to the accompanying drawings, outlines the scenario execution methods, apparatus, and electronic devices according to embodiments of this application.
[0061] Figure 1 This is a flowchart illustrating a scenario execution method provided in an embodiment of this application.
[0062] like Figure 1 As shown, the execution method for this scenario may include the following steps:
[0063] Step 101: Traverse the list of parent scenes of the current scene, and the list of parent scenes of each scene in the list of parent scenes.
[0064] The current scene is the parent scene in a set of nested scenes to be edited, which includes the current scene and / or at least one child scene executed in the current scene.
[0065] In the various embodiments of this application, each scene has a parent scene list and a child scene list. The parent scene list may be empty or may include at least one scene; similarly, the child scene list may be empty or may include at least one scene.
[0066] In some implementations, as an example, the data structure for scene storage can be as follows:
[0067]
[0068] In some implementations, the scenario described in this application is a scenario under a single family ID. As an example, the data structure stored in this scenario can be as follows:
[0069]
[0070] Optionally, the family ID can be a hashkey.
[0071] In this application embodiment, the scenario for detecting nested relationships can be all scenarios under a single family ID.
[0072] It is understood that in this application embodiment, the family ID can be used to identify a room, or it can be used to identify a family including multiple rooms, etc. Its specific meaning can be set by the user according to their own usage habits, and this application embodiment does not limit it here. A family ID can include one or more scenarios.
[0073] In this embodiment of the application, it is possible to traverse the list of parent scenes of the current scene, and the list of parent scenes of each scene in the list of parent scenes.
[0074] In some implementations, the identifiers of each scene in each parent scene list that has been traversed can be stored in a parent scene identifier container.
[0075] It is understandable that the scenes corresponding to each identifier stored in the parent scene identifier container are all parent scenes that have at least one nesting relationship with the current scene, meaning that they can all execute the current scene in some way.
[0076] Step 102: In response to the parent scene list being empty, traverse the child scene list of the current scene, and the child scene list of each scene in the child scene list.
[0077] In this embodiment of the application, in response to the parent scene list being empty, the child scene list of the current scene and the child scene list of each scene in the child scene list are traversed.
[0078] Understandably, an empty list of parent scenes in response to the traversal indicates that the root node has been reached.
[0079] In this embodiment of the application, the list of sub-scenes of the current scene includes at least one sub-scene executed in the current scene from a set of nested scenes to be edited.
[0080] Step 103: Determine the nesting level and nesting relationship based on the traversal results of the parent scene list and the child scene list.
[0081] In this embodiment of the application, the nesting level and nesting relationship can be determined based on the traversal results of the parent scene list and the child scene list.
[0082] In some implementations, the traversal results can be used to determine whether there is a nested relationship between scenes that forms a loop.
[0083] In some implementations, the identifiers of each scene in each parent scene list that has been traversed can be stored in a parent scene identifier container, and the existence of a nested relationship forming a cycle can be determined based on the parent scene identifier container and the traversal results of the child scene list.
[0084] Optionally, it is possible to determine whether a nested relationship exists between scenes by judging whether each scene in the traversed sub-scene list is included in the parent scene identifier container. If at least one scene in the traversed sub-scene list is included in the parent scene identifier container, a nested relationship is determined to exist; if none of the scenes in the traversed sub-scene list are included in the parent scene identifier container, a nested relationship is determined not to exist.
[0085] In some implementations, the nesting level can be determined based on whether the traversed parent scene list and child scene list are empty. The nesting level is incremented by one if the traversed parent scene list is not empty; the nesting level is incremented by one if the traversed child scene list is not empty.
[0086] In some implementations, it is also possible to determine whether the number of nested layers exceeds the limit.
[0087] It is understood that, in the embodiments of this application, the number of limiting layers can be a pre-set value, and different values can be set according to the different application scenarios, the different devices used in the application, and the different nesting processing capabilities of different scenarios.
[0088] In this embodiment, by traversing the parent scene list of the current scene and the parent scene list of each scene in the parent scene list, and in response to the traversed parent scene list being empty, the child scene list of the current scene and the child scene list of each scene in the child scene list are traversed. Based on the traversal results of the parent scene list and the child scene list, the nesting level and nesting relationship are determined. Here, the current scene is the parent scene in a set of nested scenes to be edited. The set of nested scenes to be edited includes the current scene and / or at least one child scene executed in the current scene. This method can simply, quickly, and efficiently detect the nesting relationship of scenes, avoid scenes from forming a cycle, limit the nesting level of scenes, avoid repeated execution of scenes, ensure the execution performance of scene functions, and improve system efficiency.
[0089] Figure 2 This is a flowchart illustrating another scenario execution method provided in an embodiment of this application.
[0090] like Figure 2 As shown, the execution method for this scenario may include the following steps:
[0091] Step 201: Traverse the list of parent scenes of the current scene, and the list of parent scenes of each scene in the list of parent scenes.
[0092] The current scene is the parent scene in a set of nested scenes to be edited, which includes the current scene and / or at least one child scene executed in the current scene.
[0093] In the various embodiments of this application, each scene has a parent scene list and a child scene list. The parent scene list may be empty or may include at least one scene; similarly, the child scene list may be empty or may include at least one scene.
[0094] In some implementations, as an example, the data structure for scene storage can be as follows:
[0095]
[0096] In some implementations, the scenario described in this application is a scenario under a single family ID. As an example, the data structure stored in this scenario can be as follows:
[0097]
[0098] Optionally, the family ID can be a hashkey.
[0099] In this application embodiment, the scenario for detecting nested relationships can be all scenarios under a single family ID.
[0100] It is understood that in this application embodiment, the family ID can be used to identify a room, or it can be used to identify a family including multiple rooms, etc. Its specific meaning can be set by the user according to their own usage habits, and this application embodiment does not limit it here. A family ID can include one or more scenarios.
[0101] As an example, consider a family with three scenarios, A, B, and C, where A executes B, and B executes C. These three scenarios can be stored using the following data structure:
[0102]
[0103] In this embodiment of the application, it is possible to traverse the list of parent scenes of the current scene, and the list of parent scenes of each scene in the list of parent scenes.
[0104] In some implementations, before traversing the parent scene list, it is possible to obtain all scenes under the family ID of the nested scene to be edited (including the scene's ID, the parent scene list, and the child scene list).
[0105] Optionally, all the acquired scenes can be saved as a map, with the key set to the scene ID.
[0106] Step 202: Determine if the list of parent scenes being traversed is empty.
[0107] In this embodiment, it is possible to determine whether the list of parent scenes to be traversed is empty. If the list of parent scenes to be traversed is not empty, steps 203 and 204 are executed; if the list of parent scenes to be traversed is empty, step 205 is executed.
[0108] Step 203: In response to the parent scene list being non-empty, increment the nesting level by one.
[0109] It is understood that in this embodiment of the application, in response to the traversal of the parent scene list not being empty, that is, there is a nested scene above the current scene, so the nesting level can be incremented by one.
[0110] Step 204: Store the identifier of each scene in the traversed parent scene list into the parent scene identifier container.
[0111] In this embodiment of the application, the identifiers of each scene in each traversed parent scene list can be stored in the parent scene identifier container.
[0112] Optionally, the parent scene label container can be a parSceneidMap, where the key is set to the scene ID.
[0113] It is understandable that the scenes corresponding to each identifier stored in the parent scene identifier container are all parent scenes that have at least one nesting relationship with the current scene, meaning that they can all execute the current scene in some way.
[0114] Step 205: In response to the parent scene list being empty, iterate through the child scene list of the current scene, and the child scene list of each scene in the child scene list.
[0115] In this embodiment of the application, in response to the parent scene list being empty, the child scene list of the current scene and the child scene list of each scene in the child scene list are traversed.
[0116] Understandably, an empty list of parent scenes in response to the traversal indicates that the root node has been reached.
[0117] In this embodiment of the application, the list of sub-scenes of the current scene includes at least one sub-scene executed in the current scene from a set of nested scenes to be edited.
[0118] It should be noted that the first iteration of the sub-scene list includes at least one sub-scene in the nested scene set to be edited.
[0119] Step 206: Determine if the list of traversed sub-scenes is empty.
[0120] In this embodiment, it is possible to determine whether the list of parent scenes to be traversed is empty. If the list of parent scenes to be traversed is not empty, steps 207 and 208 are executed; if the list of parent scenes to be traversed is empty, step 209 is executed.
[0121] Step 207: In response to the fact that the list of traversed sub-scenes is not empty, increment the nesting level by one.
[0122] Similarly, it can be understood that in the embodiments of this application, in response to the traversal of the sub-scene list not being empty, that is, there is a nested scene below the current scene, so the nesting level can be incremented by one.
[0123] Step 208: Determine whether each scene in the traversed list of sub-scenes is included in the parent scene identifier container.
[0124] In this embodiment of the application, it is possible to determine whether there is a nested loop by judging whether each scene in the traversed sub-scene list is included in the parent scene identifier container.
[0125] Optionally, it can be determined whether each scene in the sub-scene list is included in the parent scene identifier container by searching for the scene ID of each scene in the sub-scene list within the parent scene identifier container.
[0126] In response to at least one scene in the traversed list of sub-scenes being included within the parent scene identifier container, it is determined that a nested relationship exists in a loop.
[0127] Since none of the scenes in the traversed list of child scenes are included in the parent scene identifier container, it is determined that there is no nested relationship forming a cycle.
[0128] Step 209: Determine the number of nesting levels and whether there is a nested relationship forming a ring.
[0129] In some implementations, it is also possible to determine whether the number of nested layers exceeds the limit.
[0130] If nested loops exist and / or the number of levels exceeds the limit, the traversal process can be terminated early, and the presence of nested loops and / or the number of levels exceeding the limit can be directly output.
[0131] It is understood that, in the embodiments of this application, traversing the parent scene list can traverse from the parent scene list of the current scene to the scene corresponding to the root node in all scenes (that is, the scene whose parent scene list is empty), which means it can traverse scenes above the current scene's level; traversing the child scene list can traverse from the child scene list of the current scene to the scene corresponding to the leaf node in all scenes (that is, the scene whose child scene list is empty), which means it can traverse scenes below the current scene's level.
[0132] In the embodiments of this application, the above steps can be executed individually, together, or only some of the above steps. For example, in some embodiments, steps 201 to 203, steps 205 to 207, and step 209 can be executed to determine the nesting level of the scene, or in some embodiments, to determine whether the nesting level exceeds a limit. Similarly, in some embodiments, steps 201 to 202, steps 204 to 206, and steps 208 to 209 can also be executed to determine whether a nested loop exists.
[0133] In this embodiment, by traversing the parent scene list of the current scene and the parent scene list of each scene in the parent scene list, it is determined whether the traversed parent scene list is empty. If the traversed parent scene list is not empty, the nesting level is incremented by one, and the identifier of each scene in each traversed parent scene list is stored in the parent scene identifier container. If the traversed parent scene list is empty, the child scene list of the current scene and the child scene list of each scene in the child scene list are traversed. It is determined whether the traversed child scene list is empty. If the traversed child scene list is not empty, the nesting level is incremented by one, and it is determined whether each scene in the traversed child scene list is included in the parent scene identifier container. This determines the nesting level and whether there is a nested loop relationship. This method can detect the nesting relationship of scenes simply, quickly, and efficiently, avoid scene nesting loops, limit the nesting level of scenes, avoid scene repetition, ensure the execution performance of scene functions, and improve system efficiency.
[0134] To implement the above embodiments, this application also proposes a scene execution device.
[0135] Figure 3 This is a schematic diagram of the structure of a scene execution device provided in an embodiment of this application.
[0136] like Figure 3 As shown, the scene execution device includes: a first traversal module 310, a second traversal module 320, and a detection module 330, wherein:
[0137] The first traversal module 310 is used to traverse the parent scene list of the current scene, and the parent scene list of each scene in the parent scene list.
[0138] The second traversal module 320 is used to traverse the sub-scene list of the current scene and the sub-scene list of each scene in the sub-scene list in response to the parent scene list being empty.
[0139] The detection module 330 is used to determine the nesting level and nesting relationship based on the traversal results of the parent scene list and the child scene list;
[0140] The current scene is the parent scene in a set of nested scenes to be edited, and the set of nested scenes to be edited includes the current scene and / or at least one sub-scene executed in the current scene.
[0141] As one possible implementation, the device further includes:
[0142] The storage module (not shown in the figure) is used to store the identifiers of each scene in the traversed parent scene list into the parent scene identifier container.
[0143] As one possible implementation, the detection module 330 is specifically used for:
[0144] Based on the traversal results of the parent scene identifier container and the child scene list, determine whether there is a nested relationship forming a cycle.
[0145] As one possible implementation, the detection module 330 is specifically used for:
[0146] Determine whether each scene in the list of traversed sub-scenes is included in the parent scene identifier container;
[0147] In response to the fact that at least one scene in the traversed list of sub-scenes is included within the parent scene identifier container, it is determined that a nested relationship forming a ring exists.
[0148] Since each scene in the traversed list of sub-scenes is not included in the parent scene identifier container, it is determined that there is no nested relationship forming a loop.
[0149] As one possible implementation, the list of sub-scenes of the current scene includes at least one sub-scene from the set of nested scenes to be edited.
[0150] As one possible implementation, the detection module 330 is specifically used for:
[0151] If the list of parent scenes being traversed is not empty, increment the nesting level by one.
[0152] If the list of traversed sub-scenes is not empty, increment the nesting level by one.
[0153] As one possible implementation, the detection module 330 is further configured to:
[0154] Determine whether the number of nested levels exceeds the limit.
[0155] In this embodiment, by traversing the parent scene list of the current scene and the parent scene list of each scene in the parent scene list, and in response to the traversed parent scene list being empty, the child scene list of the current scene and the child scene list of each scene in the child scene list are traversed. Based on the traversal results of the parent scene list and the child scene list, the nesting level and nesting relationship are determined. The current scene is the parent scene in a set of nested scenes to be edited. The set of nested scenes to be edited includes the current scene and / or at least one child scene executed in the current scene. This method can simply, quickly, and efficiently detect the nesting relationship of scenes, avoid scenes from forming a cycle and limit the nesting level of scenes, avoid repeated execution of scenes, ensure the execution performance of scene functions, and improve system efficiency.
[0156] It should be noted that the foregoing explanation of the scene execution method embodiment also applies to the scene execution device of this embodiment, and will not be repeated here.
[0157] Figure 4 This is a structural block diagram of an electronic device provided in an embodiment of this application.
[0158] like Figure 4 As shown, the electronic device 400 includes: a memory 410 and a processor 420, and a bus 430 connecting different components (including the memory 410 and the processor 420).
[0159] The memory 410 is used to store executable instructions of the processor 420; the processor 420 is configured to call and execute the executable instructions stored in the memory 410 to implement the scenario execution method proposed in the above embodiments of this application.
[0160] Bus 430 represents one or more of several bus architectures, including a memory bus or memory controller, a peripheral bus, a graphics acceleration port, a processor, or a local bus using any of the various bus architectures. Examples of these architectures include, but are not limited to, the Industry Standard Architecture (ISA) bus, the Micro Channel Architecture (MAC) bus, the Enhanced ISA bus, the Video Electronics Standards Association (VESA) local bus, and the Peripheral Component Interconnect (PCI) bus.
[0161] Electronic device 400 typically includes a variety of electronic device readable media. These media can be any available media that can be accessed by electronic device 400, including volatile and non-volatile media, removable and non-removable media.
[0162] Memory 410 may also include computer system readable media in the form of volatile memory, such as random access memory (RAM) 440 and / or cache memory 450. Electronic device 400 may further include other removable / non-removable, volatile / non-volatile computer system storage media. By way of example only, storage system 460 may be used to read and write non-removable, non-volatile magnetic media (… Figure 4 Not shown; usually referred to as a "hard drive"). Although Figure 4 Not shown, a disk drive for reading and writing to a removable non-volatile disk (e.g., a "floppy disk") and an optical disk drive for reading and writing to a removable non-volatile 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 430 via one or more data media interfaces. Memory 410 may include at least one program product having a set (e.g., at least one) of program modules configured to perform the functions of the embodiments of this application.
[0163] A program / utility 480 having a set (at least one) of program modules 470 may be stored, for example, in memory 410. Such program modules 470 include—but are not limited to—an operating system, one or more application programs, other program modules, and program data. Each or some combination of these examples may include an implementation of a network environment. Program modules 470 typically perform the functions and / or methods described in the embodiments of this application.
[0164] Electronic device 400 can also communicate with one or more external devices 490 (e.g., keyboard, pointing device, display 491, etc.), and with one or more devices that enable a user to interact with electronic device 400, and / or with any device that enables electronic device 400 to communicate with one or more other computing devices (e.g., network card, modem, etc.). This communication can be performed via input / output (I / O) interface 492. Furthermore, electronic device 400 can also communicate with one or more networks (e.g., local area network (LAN), wide area network (WAN), and / or public networks, such as the Internet) via network adapter 493. As shown, network adapter 493 communicates with other modules of electronic device 400 via bus 430. It should be understood that, although not shown in the figures, other hardware and / or software modules can be used in conjunction with electronic device 400, including but not limited to: microcode, device drivers, redundant processing units, external disk drive arrays, RAID systems, tape drives, and data backup storage systems.
[0165] The processor 420 performs various functional applications and data processing by running programs stored in the memory 410.
[0166] To implement the above embodiments, this application also proposes a non-transitory computer-readable storage medium, wherein the instructions in the storage medium, when executed by the processor of an electronic device, enable the electronic device to execute the scenario execution method proposed in any of the foregoing embodiments.
[0167] To implement the above embodiments, this application also provides a computer program product, which, when executed by the processor of an electronic device, enables the electronic device to execute the scenario execution method proposed in any of the foregoing embodiments.
[0168] In the description of this specification, the references to terms such as "one embodiment," "some embodiments," "example," "specific example," or "some examples," etc., refer to specific features, structures, materials, or characteristics described in connection with that embodiment or example, which are included in at least one embodiment or example of this application. In this specification, the illustrative expressions of the above terms do not necessarily refer to the same embodiment or example. Furthermore, the specific features, structures, materials, or characteristics described may be combined in any suitable manner in one or more embodiments or examples. Moreover, without contradiction, those skilled in the art can combine and integrate the different embodiments or examples described in this specification, as well as the features of different embodiments or examples.
[0169] Furthermore, the terms "first" and "second" are used for descriptive purposes only and should not be construed as indicating or implying relative importance or implicitly specifying the number of technical features indicated. Thus, a feature defined as "first" or "second" may explicitly or implicitly include at least one of that feature. In the description of this application, "multiple" means at least two, such as two, three, etc., unless otherwise explicitly specified.
[0170] Any process or method description in the flowchart or otherwise herein can be understood as representing a module, segment, or portion of code comprising one or more executable instructions for implementing custom logic functions or processes, and the scope of the preferred embodiments of this application includes additional implementations in which functions may be performed not in the order shown or discussed, including substantially simultaneously or in reverse order depending on the functions involved, as should be understood by those skilled in the art to which embodiments of this application pertain.
[0171] The logic and / or steps represented in the flowchart or otherwise described herein, for example, can be considered as a sequenced list of executable instructions for implementing logical functions, and can be embodied in any computer-readable medium for use by, or in conjunction with, an instruction execution system, apparatus, or device (such as a computer-based system, a processor-included system, or other system that can fetch and execute instructions from, an instruction execution system, apparatus, or device). For the purposes of this specification, "computer-readable medium" can be any means that can contain, store, communicate, propagate, or transmit programs for use by, or in conjunction with, an instruction execution system, apparatus, or device. More specific examples (a non-exhaustive list) of computer-readable media include: an electrical connection having one or more wires (electronic device), a portable computer disk drive (magnetic device), random access memory (RAM), read-only memory (ROM), erasable and editable read-only memory (EPROM or flash memory), fiber optic devices, and portable optical disc read-only memory (CDROM). Alternatively, the computer-readable medium may be paper or other suitable media on which the program can be printed, since the program can be obtained electronically, for example, by optically scanning the paper or other medium, followed by editing, interpreting, or otherwise processing as necessary, and then stored in a computer memory.
[0172] It should be understood that various parts of this application can be implemented using hardware, software, firmware, or a combination thereof. In the above embodiments, multiple steps or methods can be implemented using software or firmware stored in memory and executed by a suitable instruction execution system. For example, if implemented in hardware as in another embodiment, it can be implemented using any one or a combination of the following techniques known in the art: discrete logic circuits having logic gates for implementing logical functions on data signals, application-specific integrated circuits (ASICs) having suitable combinational logic gates, programmable gate arrays (PGAs), field-programmable gate arrays (FPGAs), etc.
[0173] Those skilled in the art will understand that all or part of the steps of the methods in the above embodiments can be implemented by a program instructing related hardware. The program can be stored in a computer-readable storage medium, and when executed, the program includes one or a combination of the steps of the method embodiments.
[0174] Furthermore, the functional units in the various embodiments of this application can be integrated into a processing module, or each unit can exist physically separately, or two or more units can be integrated into a module. The integrated module can be implemented in hardware or as a software functional module. If the integrated module is implemented as a software functional module and sold or used as an independent product, it can also be stored in a computer-readable storage medium.
[0175] The storage medium mentioned above can be a read-only memory, a disk, or an optical disk, etc. Although embodiments of this application have been shown and described above, it is understood that the above embodiments are exemplary and should not be construed as limiting this application. Those skilled in the art can make changes, modifications, substitutions, and variations to the above embodiments within the scope of this application.
Claims
1. A scenario execution method, characterized in that, include: Iterate through the list of parent scenes of the current scene, and the list of parent scenes of each scene in the list of parent scenes; Store the identifiers of each scene in the traversed parent scene list into the parent scene identifier container; In response to an empty parent scene list, the current scene's child scene list and each scene's child scene list in the child scene list are traversed. The scene whose parent scene list is empty is the scene corresponding to the root node in all scenes. Determine the nesting level based on the traversal results of the parent scene list and the child scene list; Determine whether each scene in the list of traversed sub-scenes is included in the parent scene identifier container; In response to the fact that at least one scene in the traversed list of sub-scenes is included within the parent scene identifier container, it is determined that a nested relationship forming a ring exists. In response to the fact that each scene in the traversed list of sub-scenes is not included in the parent scene identifier container, it is determined that there is no nested relationship forming a cycle. The current scene is the parent scene in a set of nested scenes to be edited, and the set of nested scenes to be edited includes the current scene and / or at least one sub-scene executed in the current scene.
2. The method according to claim 1, characterized in that, The list of sub-scenes of the current scene includes at least one sub-scene from the set of nested scenes to be edited.
3. The method according to any one of claims 1-2, characterized in that, The step of determining the nesting level based on the traversal results of the parent scene list and the child scene list includes: If the list of parent scenes being traversed is not empty, increment the nesting level by one. If the list of traversed sub-scenes is not empty, increment the nesting level by one.
4. The method according to claim 3, characterized in that, The method further includes: Determine whether the number of nested levels exceeds the limit.
5. A scene execution device, characterized in that, include: The first traversal module is used to traverse the parent scene list of the current scene, as well as the parent scene list of each scene in the parent scene list. The storage module is used to store the identifiers of each scene in the traversed parent scene list into the parent scene identifier container; The second traversal module is used to traverse the child scene list of the current scene and the child scene list of each scene in the child scene list in response to the parent scene list being empty, wherein the scene whose parent scene list is empty is the scene corresponding to the root node in all scenes. The detection module is used to determine whether each scene in the traversed sub-scene list is included in the parent scene identifier container; in response to at least one scene in the traversed sub-scene list being included in the parent scene identifier container, it is determined that a nested relationship forming a cycle exists; in response to each scene in the traversed sub-scene list not being included in the parent scene identifier container, it is determined that no nested relationship forming a cycle exists. The current scene is the parent scene in a set of nested scenes to be edited, and the set of nested scenes to be edited includes the current scene and / or at least one sub-scene executed in the current scene.
6. The apparatus according to claim 5, characterized in that, The list of sub-scenes of the current scene includes at least one sub-scene from the set of nested scenes to be edited.
7. The apparatus according to any one of claims 5-6, characterized in that, The detection module is specifically used for: If the list of parent scenes being traversed is not empty, increment the nesting level by one. If the list of traversed sub-scenes is not empty, increment the nesting level by one.
8. The apparatus according to claim 7, characterized in that, The detection module is also used for: Determine whether the number of nested levels exceeds the limit.
9. An electronic device, comprising: At least one processor; as well as A memory communicatively connected to the at least one processor; wherein, The memory stores instructions that can be executed by the at least one processor to enable the at least one processor to perform the method of any one of claims 1-4.
10. A computer-readable storage medium, wherein, Computer instructions are used to cause the computer to perform the method according to any one of claims 1-4.
Citation Information
Patent Citations
Application scene creation detection method and device
CN105407089A