A method and device for processing multi-level data
By obtaining the data nodes to be modified in the multi-level data tree structure, modifying the node status and determining the transfer direction, and processing the data level by level, the infinite loop problem in multi-level data is solved and the data processing efficiency is improved.
Patent Information
- Application Number
- CN202011128402.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-10-20
- Publication Date
- 2024-09-20
- Estimated Expiration
- 2040-10-20
AI Technical Summary
In the existing technology, when the data flow in multi-level data is modified downward and upward at the same time, it is easy to form an infinite loop, resulting in low data processing efficiency.
By obtaining the data to be modified, the data nodes to be modified in the multi-level data tree structure are determined, the node status is modified, the transfer direction is determined based on the status, and the data nodes are modified level by level to avoid an infinite loop.
It effectively solves the problem of an infinite loop formed when the data flow in multi-level data is modified simultaneously downward and upward, and improves the efficiency and accuracy of data processing.
Smart Images

Figure CN112214208B
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer technology, and in particular to a method and device for processing multi-level data. Background Art
[0002] For a website, the front end usually refers to the front-end part of the website, including the presentation layer and the structural layer of the website. Therefore, front-end technology is generally divided into front-end design and front-end development. Front-end design can generally be understood as the visual design of the website, and front-end development is the front-end code implementation of the website, including basic HTML (Hypertext Markup Language), CSS (Cascading Style Sheets) and JavaScript / ajax. In the field of front-end development, more and more business logic and data processing are forcibly connected. Each business layer will consider past achievements or future plans based on data, which will involve a series of data synchronization updates and linkages.
[0003] Among them, in the existing mechanism system, page data exists in a hierarchical relationship. When the data corresponding to the target child is modified, the data corresponding to the previous level will also be changed synchronously with the target child, and the previous level will also be changed, until the root node of the tree. At the same time, the data will flow to the next level to modify the next level, until the last level. If the data flow modifies the data downward and upward at the same time, an infinite loop will be formed. Summary of the invention
[0004] The main purpose of the embodiments of the present application is to provide a multi-level data processing method and related products, which can effectively solve the problem of forming an infinite loop when the data flow in the multi-level data modifies the data downward and upward at the same time.
[0005] In a first aspect, an embodiment of the present application provides a multi-level data processing method, which is applied to an electronic device. The multi-level data processing method includes:
[0006] Get the data to be modified;
[0007] Determine a first data node corresponding to the data to be modified among the data nodes to be modified in the tree structure of the multi-level data;
[0008] Modifying the first data node;
[0009] Extracting a modification status of the first data node, the modification status being used to indicate whether to modify a next data node to be modified of the first data node except the first data node in the tree structure of the multi-level data;
[0010] Determining a modification transfer direction corresponding to the first data node according to the modification state;
[0011] The second data node is determined according to the modification transfer direction, and the second data node is modified, where the second data node is the next data node to be modified except the first data node in the tree structure of the multi-level data.
[0012] Optionally, modifying the first data node includes: modifying data corresponding to the first data node into target data; and modifying a node execution state of the first data node, wherein the node execution state is used to indicate whether the first data node is modified.
[0013] Optionally, determining the modification transmission direction corresponding to the first data node according to the modification status includes: if the first data node is not a terminal node in the tree structure of the multi-level data, judging whether the first data node is in an active modification status; if the modification status of the first data node is an active modification status, determining that the modification transmission direction of the data node of the first data node is a first transmission direction; if the modification status of the first data node is a passive modification status, determining that the modification transmission direction of the data node of the first data node is a second transmission direction based on the fact that the first data node is in a passive modification status.
[0014] Optionally, the first transmission direction specifically refers to: a preset transmission direction; or a transmission direction obtained according to the first data node.
[0015] Optionally, if the first data node is not the terminating node in the tree structure of the multi-level data, then determining the modification transmission direction of the first data node according to the modification status, including: if the first data node is not the terminating node in the tree structure of the multi-level data, then judging whether the first data node is in an active modification status; if the modification status of the first data node is a passive modification status, then determining the modification transmission direction of the data node of the first data node as the second transmission direction based on the fact that the first data node is in a passive modification status.
[0016] In a second aspect, an embodiment of the present application provides a multi-level data processing device, the multi-level data processing device comprising:
[0017] An acquisition unit, used for acquiring data to be modified;
[0018] A first determining unit, used to determine a first data node among the data nodes to be modified in the tree structure of the multi-level data;
[0019] A first modification unit, configured to modify the first data node;
[0020] A second determining unit is used to extract a modification status of the first data node, wherein the modification status is used to indicate whether to modify a next data node to be modified of the first data node except the first data node in the tree structure of the multi-level data;
[0021] A third determining unit, configured to determine a modification transfer direction corresponding to the first data node according to the modification state;
[0022] The second modification unit is used to determine the second data node according to the modification transmission direction and modify the second data node, where the second data node is the next data node to be modified in the tree structure of the multi-level data except the first data node.
[0023] In a third aspect, an embodiment of the present application provides an electronic device, comprising a processor, a memory, a communication interface, and one or more programs, wherein the one or more programs are stored in the memory and configured to be executed by the processor, and the program includes instructions for executing the steps of any method in the first aspect of the embodiment of the present application.
[0024] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program for electronic data exchange, wherein the computer program enables a computer to execute part or all of the steps described in any method of the first aspect of the embodiment of the present application.
[0025] In a fifth aspect, an embodiment of the present application provides a computer program product, wherein the computer program product includes a non-transitory computer-readable storage medium storing a computer program, and the computer program is operable to cause a computer to execute some or all of the steps described in any method of the first aspect of the embodiment of the present application. The computer program product may be a software installation package.
[0026] It can be seen that the embodiment of the present application obtains data to be modified; determines the first data node corresponding to the data to be modified in the data nodes to be modified in the tree structure of the multi-level data; modifies the first data node; determines the modification status of the first data node; determines the modification transmission direction corresponding to the first data node according to the modification status; determines the second data node according to the modification transmission direction, and modifies the second data node, which can effectively solve the problem of an infinite loop formed when the data flow in the multi-level data modifies the data downward and upward at the same time. BRIEF DESCRIPTION OF THE DRAWINGS
[0027] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0028] Figure 1 A flowchart of a multi-level data processing method provided in an embodiment of the present application;
[0029] Figure 2 A schematic diagram of a tree structure of multi-level data provided in an embodiment of the present application;
[0030] Figure 3 A flowchart of a multi-level data processing method provided in an embodiment of the present application;
[0031] Figure 4 It is a structural schematic diagram of an electronic device provided in an embodiment of the present application;
[0032] Figure 5 It is a block diagram of the functional units of a multi-level data processing method device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0033] In order to enable those skilled in the art to better understand the solution of the present application, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.
[0034] The terms "first", "second", etc. in the specification and claims of this application and the above-mentioned drawings are used to distinguish different objects, rather than to describe a specific order. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions. For example, a process, method, system, product or device that includes a series of steps or units is not limited to the listed steps or units, but optionally includes steps or units that are not listed, or optionally includes other steps or units inherent to these processes, methods, products or devices.
[0035] Reference to "embodiments" herein means that a particular feature, structure, or characteristic described in conjunction with the embodiments may be included in at least one embodiment of the present application. The appearance of the phrase in various locations in the specification does not necessarily refer to the same embodiment, nor is it an independent or alternative embodiment that is mutually exclusive with other embodiments. It is explicitly and implicitly understood by those skilled in the art that the embodiments described herein may be combined with other embodiments.
[0036] The following is a detailed description of the embodiments of the present application.
[0037] In order to solve the problem of forming an infinite loop when the data flow in multi-level data modifies data downward and upward at the same time, the present application provides a multi-level data processing method, which is applied to electronic equipment, specifically as follows Figure 1 As shown, the multi-level data processing method may include but is not limited to the following steps:
[0038] S101, the electronic device obtains data to be modified;
[0039] In a specific implementation, the electronic device obtains the data to be modified, including but not limited to: the electronic device determines the position of the data to be modified in the tree structure of the multi-level data according to the first instruction, and obtains the data to be modified according to the position.
[0040] S102, the electronic device determines a first data node corresponding to the data to be modified among the data nodes to be modified in the tree structure of the multi-level data;
[0041] The electronic device may include various handheld devices, vehicle-mounted devices, and computing devices, such as smart phones, tablet computers, desktop computers, laptop computers, and the like.
[0042] Among them, the tree structure corresponding to the first data node can be: any one of: binary search tree, balanced binary tree, red-black tree, B tree, B+ tree, dictionary tree, suffix tree, generalized suffix tree, and can also be other types of tree structures, and no excessive restrictions are made here.
[0043] In a specific implementation, before the electronic device determines the first data node in the data nodes to be modified in the tree structure of the multi-level data, it also includes: initializing the data nodes in the tree structure of the multi-level data.
[0044] What needs further explanation is: initializing the data tree structure in the multi-level data includes: determining the structure type of the tree in the data tree structure in the multi-level data, the depth of the tree, the number of nodes in the tree, the number of parents and the number of children between the nodes, the content of each node of the tree, and the node status of each node of the tree.
[0045] In a specific implementation, an electronic device determines a first data node among data nodes to be modified in a tree structure of multi-level data, including: determining the first data node among data nodes to be modified in a tree structure of multi-level data according to a first instruction, wherein the first instruction is an instruction used for active modification; or determining the first data node among data nodes to be modified in a tree structure of multi-level data according to a second pointer, wherein the second pointer is a pointer to the storage of the second data node after the data node is modified, and the second pointer points to the storage address of the first data node.
[0046] Among them, each data node in the data node to be modified in the tree structure of multi-level data will have two modification states, and the modification state can be an active modification state or a passive modification state. The active modification state is the state of artificial modification on a certain data node, and the passive modification state refers to the state in which the data of the current data node itself changes due to the modification of other data nodes, wherein the other data nodes need to have an association relationship with the current data node itself, and the electronic device will execute different processes according to different modification states.
[0047] S103, the electronic device modifies the first data node;
[0048] In a specific implementation, the electronic device modifies the first data node, including: modifying the data corresponding to the first data node into target data, and modifying the node execution state of the first data node.
[0049] Further, modifying the node execution state of the first data node includes, but is not limited to: setting the node execution state of the first data node to an executable state or a non-executable state, for example, setting a flag in the first data node to true or false.
[0050] The node execution state is used to modify the flag of the node data, and the node execution state includes an executable state and a non-executable state.
[0051] It needs to be further explained that the node execution state can be determined by the following method: a flag is set in each data node (the value of the flag is true, false), and the node execution state of the first data node is determined according to the flag. The default value is false, false represents an executable state, and true represents an unexecutable state; or the default value is true, false represents an unexecutable state, and true represents an executable state.
[0052] It needs to be further explained that the node execution state can be determined in the following manner: a first numerical bit is set in each data node, and the node execution state of the first data node is determined according to the first numerical bit. Wherein, the value of the first numerical bit includes: a first numerical value and a second numerical value. The first numerical value represents an executable state, and the second numerical value represents an unexecutable state; wherein, the first numerical value is different from the second numerical value, and the first numerical value can be 1, 2, 3, 0, 3, 5, 7 and other numerical values, and there are no excessive restrictions here, and the second numerical value can be 1, 2, 3, 0, 3, 5, 7 and other numerical values, and there are no excessive restrictions here. For example, if the first numerical value is 0 and the second numerical value is 1, then when the first numerical bit is 0, the first data node is in an executable state; when the first data bit is 1, the first data node is in an unexecutable state.
[0053] When the electronic device modifies the first data node, the electronic device calculates the number of modified data nodes through the first global variable. For example, when a data node is modified, the first global variable resetFlagCount is used for calculation, resetFlagCount--. When the global variable is initialized, it is set to the first initial value. When the global variable resetFlagCount=0, the electronic device resets all the flags of all data nodes to the default value, for example, flag=false.
[0054] S104, the electronic device extracts the modification status of the first data node;
[0055] The modification status is used to indicate whether to modify the next data node to be modified of the first data node except the first data node in the tree structure of the multi-level data.
[0056] The modification state includes active modification state and passive modification state. The active modification state is the state of artificial modification on a data node, and the passive modification state is the state where the data of the current data node changes due to the modification of other data nodes. The other data nodes need to have an association relationship with the current data node itself, and the electronic device will execute different processes according to different modification states.
[0057] S105. The electronic device determines a modification transfer direction corresponding to the first data node according to the modification state;
[0058] The second data node is the next data node to be modified except the first data node in the tree structure of the multi-level data.
[0059] In a specific implementation, the electronic device determines the second data node according to the modification status and modifies the second data node, including: if the first data node is not the terminal node in the tree structure of the multi-level data, determining the modification transmission direction of the first data node according to the modification status.
[0060] The terminal nodes include the root node and the node without child nodes.
[0061] Further, if the first data node is not the terminating node in the tree structure of the multi-level data, the modification transmission direction of the first data node is determined according to the modification status, including but not limited to: if the first data node is not the terminating node in the tree structure of the multi-level data, then it is judged whether the first data node is actively modified; if the modification status of the first data node is an active modification status, then the modification transmission direction of the data node of the first data node is determined to be the first transmission direction.
[0062] The first transmission direction specifically refers to: a preset transmission direction; or a transmission direction obtained according to the first data node. The preset transmission direction may be to first modify the transmission upwards from the first data node as the starting point until the end node, and then modify the transmission downwards from the first data node as the starting point, for example, Figure 2 As shown, the first data node is B, which is first transferred upward from B->A, and then transferred downward from B->D->H or I or J, and then from B->E. The preset transfer direction can be to start with the first data node as the starting point, modify and transfer downward until the end node, and then modify and transfer downward from the first data node as the starting point, for example, Figure 2 As shown, the first data node is, then B->D->H or I or J, B->E is passed downward, and then B is passed upward to B->A.
[0063] It needs to be further explained that if the first transmission direction is the transmission direction obtained according to the first data node, the first transmission direction can be determined by the following specific steps: if the first data node is a termination node, determine whether the first data node is a root node, and if so, determine that the first transmission direction is downward transmission; or if the first data node is not a root node, that is, the first data node is a leaf node, then determine that the first transmission direction is upward transmission.
[0064] In a specific implementation, if the first data node is not the terminating node in the tree structure of the multi-level data, the modification transmission direction of the first data node is determined according to the modification status, including: if the first data node is not the terminating node in the tree structure of the multi-level data, then judging whether the first data node is in an active modification status; if the modification status of the first data node is in a passive modification status, then determining the modification transmission direction of the data node of the first data node as the second transmission direction based on the fact that the first data node is in a passive modification status.
[0065] For example, Figure 2 As shown, when the first data node is not in the active modification state, that is, the first data node is in the passive modification state,
[0066] If the modification transfer direction of the first data node is upward transfer, and the first data node is B, then by judging whether the flag of the parent node A of the first data node is equal to false, if the flag of A is set to false, it is executable, then B->A transfer is executed, that is, the parent node A of the first data node is the second data node, otherwise B is the termination node of the upward transfer modification;
[0067] If the modification transmission direction of the first data node is downward transmission, the flag of D or E is judged, and the flag is set to false, then the modification is transmitted from B->D, B->E until the termination node.
[0068] S106: The electronic device determines the second data node according to the modification transmission direction, and modifies the second data node.
[0069] In a specific implementation, the method also includes: calculating the number of data nodes to be modified in the tree structure of the multi-level data based on the first data node; determining whether the modification of the data nodes to be modified in the tree structure of the multi-level data has been completed based on the number of nodes, and if the modification of the data nodes to be modified in the tree structure of the multi-level data has been completed, storing the data nodes to be modified.
[0070] In a specific implementation, the number of data nodes to be modified in the tree structure of the multi-level data is calculated based on the first data node, including but not limited to: calculating the number of data nodes to be modified in the tree structure of the multi-level data based on the numerical value of the first global variable in the first data node and the initial value of the first global variable, wherein the first global variable is a predefined global parameter, and the initial value of the first global variable can be calculated using the data tree principle.
[0071] Among them, it needs to be further explained that when the electronic device modifies the first data node, the electronic device calculates the number of modified data nodes through the first global variable. For example, when a data node is modified, it is calculated through the first global variable resetFlagCount, resetFlagCount--. Among them, when the global variable is initialized, it is set to the first initial value. When the global variable resetFlagCount=0 is reset, the electronic device resets all the flags of all data nodes to the default value, for example, flag=false.
[0072] Specifically, determining whether the modification of the data nodes to be modified in the tree structure of the multi-level data is completed based on the number of nodes; if the modification of the data nodes to be modified in the tree structure of the multi-level data is completed, storing the data nodes to be modified, and also including: judging whether the modification of the data nodes in the tree structure of the multi-level data is completed based on the number of nodes of the data nodes to be modified in the tree structure of the multi-level data; if not, continuing to modify the second data node.
[0073] It can be seen that the embodiment of the present application obtains data to be modified; determines the first data node corresponding to the data to be modified in the data nodes to be modified in the tree structure of the multi-level data; modifies the first data node; determines the modification status of the first data node; determines the modification transmission direction corresponding to the first data node according to the modification status; determines the second data node according to the modification transmission direction, and modifies the second data node, which can effectively solve the problem of an infinite loop formed when the data flow in the multi-level data modifies the data downward and upward at the same time.
[0074] The following is a detailed description of the embodiments of the present application through a specific example.
[0075] With the above Figure 1 The embodiment shown is consistent with that shown in FIG. Figure 3 , Figure 3 1 is a flow chart of a multi-level data processing method provided in an embodiment of the present application, which is applied to an electronic device. The multi-level data processing method includes:
[0076] S301, the electronic device obtains data to be modified;
[0077] S302, the electronic device determines a first data node corresponding to the data to be modified among the data nodes to be modified in the tree structure of the multi-level data;
[0078] S303, the electronic device modifies the first data node;
[0079] S304, the electronic device extracts the modification status of the first data node;
[0080] The electronic device modification status is used to indicate whether to modify the next data node to be modified of the first data node except the first data node in the tree structure of the multi-level data.
[0081] S305. The electronic device determines a modification transfer direction corresponding to the first data node according to the modification state; determines the second data node according to the modification transfer direction, and modifies the second data node;
[0082] The second data node is the next data node to be modified except the first data node in the tree structure of the multi-level data.
[0083] S306, the electronic device calculates the number of data nodes to be modified in the tree structure of the multi-level data according to the first data node;
[0084] S307. The electronic device determines whether the modification of the data node to be modified in the tree structure of the multi-level data is completed according to the number of nodes. If the modification of the data node to be modified in the tree structure of the multi-level data is completed, the electronic device stores the data node to be modified.
[0085] It can be seen that the electronic device of the embodiment of the present application obtains the data to be modified; determines the first data node corresponding to the data to be modified in the data node to be modified in the tree structure of the multi-level data; modifies the first data node; extracts the modification status of the first data node; determines the modification transmission direction corresponding to the first data node according to the modification status; determines the second data node according to the modification transmission direction, and modifies the second data node; calculates the number of nodes of the data nodes to be modified in the tree structure of the multi-level data according to the first data node; determines whether the modification of the data nodes to be modified in the tree structure of the multi-level data is completed according to the number of nodes, and if the modification of the data nodes to be modified in the tree structure of the multi-level data is completed, the data nodes to be modified are stored. It can effectively solve the problem of forming an infinite loop when the data flow in the multi-level data modifies the data downward and upward at the same time.
[0086] See also Figure 4 , Figure 4 4 is a structural diagram of an electronic device 400 provided in an embodiment of the present application. As shown in the figure, the electronic device 400 includes an application processor 410, a memory 420, a communication interface 430, and one or more programs 421, wherein the one or more programs 421 are stored in the above-mentioned memory 420 and are configured to be executed by the above-mentioned application processor 410, and the one or more programs 421 include for performing the following steps:
[0087] Get the data to be modified;
[0088] Determine a first data node corresponding to the data to be modified among the data nodes to be modified in the tree structure of the multi-level data;
[0089] Modifying the first data node;
[0090] Extracting a modification status of the first data node, the modification status being used to indicate whether to modify a next data node to be modified of the first data node except the first data node in the tree structure of the multi-level data;
[0091] Determining a modification transfer direction corresponding to the first data node according to the modification state;
[0092] The second data node is determined according to the modification transfer direction, and the second data node is modified, where the second data node is the next data node to be modified except the first data node in the tree structure of the multi-level data.
[0093] In one possible example, in terms of modifying the first data node, the one or more programs 421 include specifically for performing the following steps: modifying the data corresponding to the first data node into target data; modifying the node execution state of the first data node, the node execution state being used to indicate whether the first data node is modified.
[0094] In one possible example, in terms of determining the modification transfer direction corresponding to the first data node according to the modification status, the one or more programs 421 include specifically for performing the following steps: if the first data node is not a terminal node in the tree structure of the multi-level data, then determining the modification transfer direction of the first data node according to the modification status.
[0095] In one possible example, in terms of determining the modification transmission direction of the first data node according to the modification status if the first data node is not the termination node in the tree structure of the multi-level data, the one or more programs 421 include specifically for performing the following steps: if the first data node is not the termination node in the tree structure of the multi-level data, determining whether the first data node is in an active modification status; if the modification status of the first data node is an active modification status, determining that the modification transmission direction of the data node of the first data node is a first transmission direction; if the modification status of the first data node is a passive modification status, determining that the modification transmission direction of the data node of the first data node is a second transmission direction based on the fact that the first data node is in a passive modification status.
[0096] In a possible example, the first transmission direction specifically refers to: a preset transmission direction; or a transmission direction obtained according to the first data node.
[0097] In a possible example, the one or more programs 421 also include specifically for performing the following steps: calculating the number of data nodes to be modified in the tree structure of the multi-level data based on the first data node; determining whether the modification of the data nodes to be modified in the tree structure of the multi-level data has been completed based on the number of nodes; if the modification of the data nodes to be modified in the tree structure of the multi-level data has been completed, storing the data nodes to be modified.
[0098] It can be seen that the embodiment of the present application obtains data to be modified; determines the first data node corresponding to the data to be modified in the data nodes to be modified in the tree structure of the multi-level data; modifies the first data node; determines the modification status of the first data node; determines the modification transmission direction corresponding to the first data node according to the modification status; determines the second data node according to the modification transmission direction, and modifies the second data node, which can effectively solve the problem of an infinite loop formed when the data flow in the multi-level data modifies the data downward and upward at the same time.
[0099] The above mainly introduces the scheme of the embodiment of the present application from the perspective of the execution process on the method side. It is understandable that, in order to realize the above functions, the electronic device includes a hardware structure and / or software module corresponding to the execution of each function. It should be easily appreciated by those skilled in the art that, in combination with the units and algorithm steps of each example described in the embodiments provided herein, the present application can be implemented in the form of hardware or a combination of hardware and computer software. Whether a function is executed in the form of hardware or computer software driving hardware depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of the present application.
[0100] The embodiment of the present application can divide the electronic device into functional units according to the above method example. For example, each functional unit can be divided according to each function, or two or more functions can be integrated into one processing unit. The above integrated unit can be implemented in the form of hardware or in the form of software functional units. It should be noted that the division of units in the embodiment of the present application is schematic and is only a logical function division. There may be other division methods in actual implementation.
[0101] Figure 5 : is a functional unit composition block diagram of a multi-level data processing device 500 involved in an embodiment of the present application. The multi-level data processing device 500 includes:
[0102] An acquisition unit, used for acquiring data to be modified;
[0103] A first determining unit, used to determine a first data node among the data nodes to be modified in the tree structure of the multi-level data;
[0104] A first modification unit, configured to modify the first data node;
[0105] A second determining unit is used to extract a modification status of the first data node, wherein the modification status is used to indicate whether to modify a next data node to be modified of the first data node except the first data node in the tree structure of the multi-level data;
[0106] A third determining unit, configured to determine a modification transfer direction corresponding to the first data node according to the modification state;
[0107] The second modification unit is used to determine the second data node according to the modification transmission direction and modify the second data node, where the second data node is the next data node to be modified in the tree structure of the multi-level data except the first data node.
[0108] The multi-level data processing device 500 may further include a storage unit 503 for storing program codes and data of the electronic device. The storage unit 503 may be a memory.
[0109] In one possible example, in terms of modifying the first data node, the first modification unit 502 is specifically used to: modify the data corresponding to the first data node into target data; modify the node execution state of the first data node, and the node execution state is used to indicate whether the first data node is modified.
[0110] In one possible example, in terms of determining the modification transmission direction corresponding to the first data node according to the modification status, the second modification unit 504 is specifically used to: if the first data node is not the terminal node in the tree structure of the multi-level data, then determine the modification transmission direction of the first data node according to the modification status.
[0111] In one possible example, in terms of determining the modification transmission direction of the first data node according to the modification status if the first data node is not the termination node in the tree structure of the multi-level data, the second modification unit 504 is specifically used for: if the first data node is not the termination node in the tree structure of the multi-level data, judging whether the first data node is in an active modification status; if the modification status of the first data node is in an active modification status, determining that the modification transmission direction of the data node of the first data node is in a first transmission direction; if the modification status of the first data node is in a passive modification status, determining that the modification transmission direction of the data node of the first data node is in a second transmission direction according to the fact that the first data node is in a passive modification status.
[0112] In a possible example, the first transmission direction specifically refers to: a preset transmission direction; or a transmission direction obtained according to the first data node.
[0113] In a possible example, the second modification unit 504 also includes a specific function for: calculating the number of data nodes to be modified in the tree structure of the multi-level data based on the first data nodes; determining whether the modification of the data nodes to be modified in the tree structure of the multi-level data is completed based on the number of nodes; if the modification of the data nodes to be modified in the tree structure of the multi-level data is completed, storing the data nodes to be modified.
[0114] It can be seen that the embodiment of the present application obtains data to be modified; determines the first data node corresponding to the data to be modified in the data nodes to be modified in the tree structure of the multi-level data; modifies the first data node; determines the modification status of the first data node; determines the modification transmission direction corresponding to the first data node according to the modification status; determines the second data node according to the modification transmission direction, and modifies the second data node, which can effectively solve the problem of an infinite loop formed when the data flow in the multi-level data modifies the data downward and upward at the same time.
[0115] An embodiment of the present application also provides a computer storage medium, wherein the computer storage medium stores a computer program for electronic data exchange, wherein the computer program enables a computer to execute part or all of the steps of any method described in the above method embodiments, and the above computer includes an electronic device.
[0116] The embodiment of the present application also provides a computer program product, the computer program product includes a non-transitory computer-readable storage medium storing a computer program, the computer program is operable to cause a computer to execute some or all of the steps of any method described in the method embodiment. The computer program product may be a software installation package, and the computer includes an electronic device.
[0117] It should be noted that, for the aforementioned method embodiments, for the sake of simplicity, they are all expressed as a series of action combinations, but those skilled in the art should be aware that the present application is not limited by the described order of actions, because according to the present application, certain steps can be performed in other orders or simultaneously. Secondly, those skilled in the art should also be aware that the embodiments described in the specification are all preferred embodiments, and the actions and modules involved are not necessarily required by the present application.
[0118] In the above embodiments, the description of each embodiment has its own emphasis. For parts that are not described in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.
[0119] In the several embodiments provided in the present application, it should be understood that the disclosed device can be implemented in other ways. For example, the device embodiments described above are only schematic, such as the division of the above-mentioned units, which is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, and the indirect coupling or communication connection of devices or units can be electrical or other forms.
[0120] The units described above as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0121] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.
[0122] If the above-mentioned integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable memory. Based on this understanding, the technical solution of the present application, or the part that contributes to the prior art, or all or part of the technical solution can be embodied in the form of a software product. The computer software product is stored in a memory, including a number of instructions to enable a computer device (which can be a personal computer, server or network device, etc.) to execute all or part of the steps of the above-mentioned methods in each embodiment of the present application. The aforementioned memory includes: U disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), mobile hard disk, disk or optical disk and other media that can store program codes.
[0123] Those skilled in the art will appreciate that all or part of the steps in the various methods of the above embodiments may be completed by instructing related hardware through a program, and the program may be stored in a computer-readable memory, which may include a flash drive, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk, etc.
[0124] The embodiments of the present application are introduced in detail above. Specific examples are used in this article to illustrate the principles and implementation methods of the present application. The description of the above embodiments is only used to help understand the method and core idea of the present application. At the same time, for general technical personnel in this field, according to the idea of the present application, there will be changes in the specific implementation method and application scope. In summary, the content of this specification should not be understood as a limitation on the present application.
Claims
1. A method for processing multi-level data, characterized in that: Applied to electronic equipment, the multi-level data processing method includes: Get the data to be modified; Determine a first data node corresponding to the data to be modified among the data nodes to be modified in the tree structure of the multi-level data; Modifying the first data node; Extracting the modification status of the first data node, the modification status is used to indicate whether to modify the next data node to be modified of the first data node except the first data node in the tree structure of the multi-level data, the modification status includes an active modification status and a passive modification status, the active modification status is a status in which a certain data node is manually modified, and the passive modification status refers to a status in which the data of the current data node itself is changed due to the modification of other data nodes except the current data node in the tree structure of the multi-level data; Determining the modification transfer direction corresponding to the first data node according to the modification state includes: if the first data node is not a terminal node in the tree structure of the multi-level data, determining the modification transfer direction of the first data node according to the modification state; Determine a second data node according to the modification transfer direction, and modify the second data node, where the second data node is the next data node to be modified in the tree structure of the multi-level data except the first data node; Wherein, if the first data node is not a terminal node in the tree structure of the multi-level data, determining the modification transfer direction of the first data node according to the modification state includes: If the first data node is not a terminal node in the tree structure of the multi-level data, determining whether the first data node is in an actively modified state; If the modification status of the first data node is an active modification status, then the modification transmission direction of the data node of the first data node is determined to be a first transmission direction. The first transmission direction refers to a preset transmission direction. The preset transmission direction is to first take the first data node as the starting point, modify and transmit upward until the termination node, and then modify and transmit downward starting from the first data node.
2. The method according to claim 1, characterized in that The modifying the first data node comprises: Modify the data corresponding to the first data node into target data; A node execution state of the first data node is modified, where the node execution state is used to indicate whether the first data node is modified.
3. The method according to claim 2, characterized in that If the first data node is not a terminal node in the tree structure of the multi-level data, determining the modification transfer direction of the first data node according to the modification state includes: If the modification state of the first data node is a passive modification state, then according to the fact that the first data node is in a passive modification state, the modification transmission direction of the data node of the first data node is determined to be a second transmission direction.
4. The method according to any one of claims 1 to 3, characterized in that: The method further comprises: Calculate the number of data nodes to be modified in the tree structure of the multi-level data according to the first data node; Determine whether the data nodes to be modified in the tree structure of the multi-level data have been modified according to the number of nodes; if the data nodes to be modified in the tree structure of the multi-level data have been modified, store the data nodes to be modified.
5. A multi-level data processing device, the device being used to execute the method according to any one of claims 1 to 4, characterized in that: The multi-level data processing device comprises: An acquisition unit, used for acquiring data to be modified; A first determining unit, configured to determine a first data node among the data nodes to be modified corresponding to the data to be modified in the tree structure of the multi-level data; A first modification unit, configured to modify the first data node; a second determination unit, for extracting a modification state of the first data node, the modification state being used to indicate whether to modify the next data node to be modified of the first data node other than the first data node in the tree structure of the multi-level data, the modification state comprising an active modification state and a passive modification state, the active modification state being a state in which a certain data node is manually modified, and the passive modification state being a state in which the data of the current data node itself is changed due to the modification of other data nodes other than the current data node in the tree structure of the multi-level data; A third determining unit, configured to determine a modification transfer direction corresponding to the first data node according to the modification state; The second modification unit is used to determine a second data node according to the modification transfer direction and modify the second data node, where the second data node is the next data node to be modified in the tree structure of the multi-level data except the first data node.
6. The multi-level data processing device according to claim 5, characterized in that: The first modification unit comprises: A first modification subunit, used to modify the data corresponding to the first data node into target data; The second modification subunit is used to modify the node execution state of the first data node, and the node execution state is used to indicate whether the first data node is modified.
7. An electronic device, characterized in that: The method comprises a processor, a memory, a communication interface, and one or more programs, wherein the one or more programs are stored in the memory and configured to be executed by the processor, and the programs include instructions for executing the steps in the method according to any one of claims 1 to 4.
8. A computer-readable storage medium, characterized in that: It stores a computer program for electronic data exchange, wherein the computer program enables a computer to execute the method according to any one of claims 1 to 4.
