CN114528047A - Control initialization method, system, equipment and storage medium - Google Patents

Control initialization method, system, equipment and storage medium Download PDF

Info

Publication number
CN114528047A
CN114528047A CN202210150935.2A CN202210150935A CN114528047A CN 114528047 A CN114528047 A CN 114528047A CN 202210150935 A CN202210150935 A CN 202210150935A CN 114528047 A CN114528047 A CN 114528047A
Authority
CN
China
Prior art keywords
control
dependency
chain
cyclic
dependency chain
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202210150935.2A
Other languages
Chinese (zh)
Inventor
江春华
隗刚
陈显龙
李鑫
汪晓旸
林宇
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Forever Technology Co Ltd
Original Assignee
Beijing Forever Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing Forever Technology Co Ltd filed Critical Beijing Forever Technology Co Ltd
Priority to CN202210150935.2A priority Critical patent/CN114528047A/en
Publication of CN114528047A publication Critical patent/CN114528047A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/445Program loading or initiating
    • G06F9/44521Dynamic linking or loading; Link editing at or after load time, e.g. Java class loading
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/90Details of database functions independent of the retrieved data types
    • G06F16/95Retrieval from the web
    • G06F16/957Browsing optimisation, e.g. caching or content distillation
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/30Creation or generation of source code
    • G06F8/31Programming languages or programming paradigms
    • G06F8/313Logic programming, e.g. PROLOG programming language
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/451Execution arrangements for user interfaces

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • General Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Computing Systems (AREA)
  • Databases & Information Systems (AREA)
  • Human Computer Interaction (AREA)
  • Data Mining & Analysis (AREA)
  • Stored Programmes (AREA)

Abstract

The embodiment of the invention provides a control initialization method, a system, equipment and a storage medium, wherein the method comprises the following steps: determining the dependency relationship of each control, determining a cyclic dependency chain formed by each control with the cyclic dependency relationship based on the dependency relationship, executing unbinding operation on each cyclic dependency chain to obtain a non-cyclic dependency chain, determining a root control from the non-cyclic dependency chain, and sequentially executing initialization on each control along the non-cyclic dependency chain where the root control is located from the root control according to the dependency relationship of each control in the non-cyclic dependency chain where the root control is located. The invention avoids the risk that the page initialization process falls into dead cycle and improves the reliability of the page initialization process by adding the steps of detecting and recording the relation of the cyclic dependence chains among the controls and executing the unbinding operation on the cyclic dependence chains. Therefore, the invention achieves the aim of improving the reliability of the page initialization process.

Description

Control initialization method, system, equipment and storage medium
Technical Field
The present invention relates to the field of control initialization, and in particular, to a method, a system, a device, and a storage medium for initializing a control.
Background
Control initialization is an important link for rendering a page based on configuration. Whether the control is initialized successfully or not directly influences the final display effect of the page. The core of the control initialization process is to process and analyze the initialization sequence of the controls. The prior art mainly executes the initialization of the controls according to the loading sequence of the controls. However, because the dependent attributes exist among the controls, when the initialization of the controls is executed according to the loading order of the controls in the prior art, control initialization logic errors exist, and further the risk that page initialization falls into dead loops is caused.
Disclosure of Invention
The embodiment of the invention aims to provide a control initialization method, a control initialization system, control initialization equipment and a storage medium, so as to improve the reliability of a page initialization process. The specific technical scheme is as follows:
a method of initializing a control, the method comprising:
and determining the dependency relationship of each control.
And determining a cyclic dependency chain formed by the controls with cyclic dependency relations based on the dependency relations.
And executing unbinding operation on each cyclic dependency chain to obtain an acyclic dependency chain.
Determining a root control from the acyclic dependency chain, wherein the root control is a control that is independent of other controls.
And according to the dependency relationship of each control in the non-cyclic dependency chain where the root control is located, starting from the root control, and sequentially initializing each control along the non-cyclic dependency chain where the root control is located.
Optionally, the determining the dependency relationship of each control includes:
traversing each control in a control set, judging whether attribute data of the target control is matched with identifiers of other controls according to a preset dependency detection rule, if so, determining that the target control depends on the other controls, and recording a dependency relationship of the target control, wherein the target control is the control to be detected in the control set, and the other controls are controls in the control set except the target control, and the dependency relationship comprises: an identifier of the target control and an identifier of at least one other control on which the target control depends.
Optionally, the determining, based on the dependency relationship, a cyclic dependency chain formed by the controls having the cyclic dependency relationship includes:
and determining a dependency chain where each control is located according to the dependency relationship.
For each dependency chain:
any control in the dependency chain is taken as an initial control. And from the initial control, sequentially using the controls as current controls to perform instantiation operation along the dependency chain until the current controls are already instantiated controls or the current controls do not have the controls depended on in the dependency chain.
And if the current control is the control which is already instantiated, determining that the dependency chain is a circular dependency chain.
And if the current control does not have the control depended on by the current control in the dependency chain, determining the dependency chain as an initialization execution chain.
Optionally, the instantiating operation includes:
and searching the example of the current control from a preset first-level cache, and if the example of the current control cannot be searched, searching the example from a preset second-level cache.
And if the instance of the current control cannot be searched from the preset second-level cache, generating the instance of the current control according to the configuration data of the current control, and adding the instance to the preset second-level cache.
Optionally, the instantiated control of the current control is specifically:
and the preset secondary cache stores the control of the instance of the current control.
Optionally, performing an unbundling operation on each cyclic dependency chain to obtain an acyclic dependency chain, including:
for each cyclic dependency chain:
and when the current control is the control which is already instantiated, searching the control which is dependent on the current control in the cyclic dependency chain according to the sequence of executing the instantiation operation along the cyclic dependency chain.
And deleting the identifier data of the current control in the dependent data set of the control, so that the control is independent of the current control.
Optionally, the sequentially initializing, starting from the root control and along the acyclic dependency chain in which the root control is located, the controls according to the dependency relationship of each control in the acyclic dependency chain in which the root control is located includes:
for each control in each acyclic dependency chain: an identifier of the control is obtained. And searching a corresponding control initialization method from a preset database according to the identifier of the control, wherein the control initialization method and the control have a corresponding relation.
For each acyclic dependent chain: and starting from the root control, sequentially initializing each control along the non-cyclic dependency chain by using a control initialization method.
A system for initializing a control, the system comprising:
and the dependency identification module is used for determining the dependency relationship of each control.
And the cyclic dependency processing module is used for determining a cyclic dependency chain formed by the controls with cyclic dependency relationships based on the dependency relationships. And executing unbinding operation on each cyclic dependent chain to obtain an acyclic dependent chain.
And the initialization execution module is used for determining a root control from the acyclic dependency chain, wherein the root control is a control independent of other controls. And according to the dependency relationship of each control in the non-cyclic dependency chain where the root control is located, starting from the root control, and sequentially initializing each control along the non-cyclic dependency chain where the root control is located.
Optionally, the dependency identification module is configured to:
traversing each control in a control set, judging whether attribute data of the target control is matched with identifiers of other controls according to a preset dependency detection rule, if so, determining that the target control depends on the other controls, and recording a dependency relationship of the target control, wherein the target control is the control to be detected in the control set, and the other controls are controls in the control set except the target control, and the dependency relationship comprises: an identifier of the target control and an identifier of at least one other control on which the target control depends.
Optionally, the loop dependency processing module is configured to:
and determining a dependency chain where each control is located according to the dependency relationship.
For each dependency chain:
any control in the dependency chain is taken as an initial control. And from the initial control, sequentially using the controls as current controls to perform instantiation operation along the dependency chain until the current controls are already instantiated controls or the current controls do not have the controls depended on in the dependency chain.
And if the current control is the control which is already instantiated, determining that the dependency chain is a circular dependency chain.
And if the current control does not have the control depended on by the current control in the dependency chain, determining the dependency chain as an initialization execution chain.
Optionally, the loop dependency processing module is further configured to:
and searching the example of the current control from a preset first-level cache, and if the example of the current control cannot be searched, searching the example from a preset second-level cache.
And if the instance of the current control cannot be searched from the preset second-level cache, generating the instance of the current control according to the configuration data of the current control, and adding the instance to the preset second-level cache.
Optionally, the loop dependency processing module is further configured to:
for each cyclic dependency chain:
and when the current control is the control which is already instantiated, searching the control which is dependent on the current control in the cyclic dependency chain according to the sequence of executing the instantiation operation along the cyclic dependency chain.
And deleting the identifier data of the current control in the dependent data set of the control, so that the control is independent of the current control.
Optionally, the initialization execution module is configured to:
for each control in each acyclic dependency chain: an identifier of the control is obtained. And searching a corresponding control initialization method from a preset database according to the identifier of the control, wherein the control initialization method and the control have a corresponding relation.
For each acyclic dependent chain: and starting from the root control, sequentially initializing each control along the non-cyclic dependency chain by using a control initialization method.
According to the initialization method, the initialization system, the initialization equipment and the storage medium of the controls, provided by the embodiment of the invention, the steps of detecting and recording the relation of the cyclic dependency chains among the controls are added, and the operation of unbinding the cyclic dependency chains is executed, so that all the dependency chains participating in the page initialization process are non-cyclic dependency chains, the risk that the page initialization process falls into dead cycle is avoided, and the reliability of the page initialization process is improved. Meanwhile, the invention determines the initialization logic of each control in the page by determining the dependency relationship between the root control and the control, thereby avoiding the risk of deviation of the page initialization process caused by logic errors and improving the reliability of the page initialization process. Therefore, the invention achieves the aim of improving the reliability of the page initialization process.
Of course, it is not necessary for any product or method of practicing the invention to achieve all of the above-described advantages at the same time.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below, it is obvious that the drawings in the following description are only some embodiments of the present invention, and for those skilled in the art, other drawings can be obtained according to the drawings without creative efforts.
Fig. 1 is a flowchart of an initialization method for a control according to an embodiment of the present invention;
FIG. 2 is a schematic diagram of a circular dependency chain provided in an alternative embodiment of the present invention;
FIG. 3 is a flow chart of determining a circular dependency chain according to an alternative embodiment of the present invention;
fig. 4 is a block diagram of an initialization system for a control according to an embodiment of the present invention;
fig. 5 is a block diagram of an initialization apparatus for a control according to an embodiment of the present invention.
Detailed Description
The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
An embodiment of the present invention provides a method for initializing a control, as shown in fig. 1, the method includes:
and S101, determining the dependency relationship of each control.
The control may be a visual graphic element placed on the form, for example: buttons in pages, dialog boxes, file edit boxes, and the like.
Optionally, in an optional embodiment of the present invention, the dependency relationship is: the functional implementation of one control requires assistance that relies on another control. The dependency relationship can be used as a basis for initializing the execution sequence of the controls in the page. The dependency may exist in the form of a data set, and the data in the set includes but is not limited to: the basic information of the control, the basic information of the control on which the control depends and the type of the dependency relationship. Wherein, the types of the dependency relationship include but are not limited to: the reference relationship of the control value and the participation dependency relationship required for initialization.
And S102, determining a cyclic dependency chain formed by the controls with cyclic dependency relations based on the dependency relations.
Optionally, in an optional embodiment of the present invention, the cyclic dependency relationship may refer to a relationship in which two controls depend on each other. In the process of initializing the page controls, the initialization sequence of each control in the page needs to be determined according to the dependency relationship. In the process of initializing the controls in the page, because the controls in the dependency chain have the above loop dependency relationship, the risk of trapping dead loops in the initialization process of the page occurs. Compared with the prior art, the method and the device have the advantages that the steps of detecting and recording the cyclic dependency chain relation among the controls are added, so that the risk that the page initialization process falls into the dead cycle is reduced, and the reliability of the page initialization process is improved.
S103, executing unbinding operation on each cyclic dependency chain to obtain an acyclic dependency chain.
Optionally, in an optional embodiment of the present invention, the operation object of the unbinding operation may be a control having a circular dependency relationship in a circular dependency chain. Specifically, the above-mentioned unbinding operation is performed on the dependency data of the control with the cyclic dependency relationship, so that the cyclic dependency chain is converted into the acyclic dependency chain with only the unidirectional dependency relationship. According to the invention, through executing the unbinding operation on the circular dependent chain, each dependent chain participating in the page initialization process is an acyclic dependent chain, so that the risk that the page initialization process falls into dead cycle is avoided, and the reliability of the page initialization process is improved.
Optionally, in another optional embodiment of the present invention, the acyclic dependency chain may be a dependency chain in which no cyclic dependency relationship exists between the controls in the dependency chain.
And S104, determining a root control from the acyclic dependency chain, wherein the root control is a control independent of other controls.
Optionally, in an optional embodiment of the present invention, the root control may be determined from an acyclic dependency chain according to the dependency relationship.
And S105, initializing the controls in sequence from the root control along the acyclic dependency chain where the root control is located according to the dependency relationship of the controls in the acyclic dependency chain where the root control is located.
Optionally, in an optional embodiment of the present invention, the root control is determined, and each control in the acyclic dependency chain is determined according to the root control and the dependency relationship, and an initialization logic that initializes each control in the acyclic dependency chain from the root control and in sequence along the acyclic dependency chain where the root control is located is used. In the prior art, each control in a page is initialized according to the loading sequence of the controls, so that the deviation of the display effect of the initialized page caused by logic errors is inevitable. Therefore, the invention avoids the risk of deviation of the page initialization process caused by logic errors by determining the initialization logic, and improves the reliability of the page initialization process.
The method and the device have the advantages that the steps of detecting and recording the relation of the cyclic dependency chains among the controls are added, and the operation of unbinding the cyclic dependency chains is executed, so that all the dependency chains participating in the page initialization process are non-cyclic dependency chains, the risk that the page initialization process falls into dead cycles is avoided, and the reliability of the page initialization process is improved. Meanwhile, the invention determines the initialization logic of each control in the page by determining the dependency relationship between the root control and the control, thereby avoiding the risk of deviation of the page initialization process caused by logic errors and improving the reliability of the page initialization process. Therefore, the invention achieves the aim of improving the reliability of the page initialization process.
Optionally, the determining the dependency relationship of each control includes:
traversing each control in the control set, judging whether attribute data of the target control is matched with identifiers of other controls according to a preset dependency detection rule, if so, determining that the target control depends on the other controls, and recording a dependency relationship of the target control, wherein the target control is the control to be detected in the control set, and the dependency relationship of the other controls is the controls except the target control in the control set, and comprises the following steps: an identifier of the target control and an identifier of at least one other control that the target control depends on.
Optionally, in an optional embodiment of the present invention, the data types in the attribute data include, but are not limited to: the identifier of the control, the reference relation of the storage value of the control, the input parameters needed for initializing the control and the like are depended on.
Optionally, in another optional embodiment of the present invention, the data in the dependency relationship, in addition to the "identifier of the target control and the identifier of at least one other control on which the target control depends", may further include: basic information of the target control, the type of the dependency relationship and the like. It should be noted that the above dependency relationships and the data types included therein are well known techniques, and the present invention is not limited to or described in detail herein.
Optionally, in another optional embodiment of the present invention, a specific implementation manner of the above "determining whether the attribute data of the target control matches the identifier of the other control" may be:
suppose that there are two controls, namely, a control a and a control B, and the attribute data of the control a stores the entry data of the initialized control.
And matching in the attribute data of the control A by utilizing a preset word boundary matching algorithm according to the identifier of the control B. And when the preset word boundary matching algorithm determines the reference data in the attribute data of the control A and the identifier of the control B meets the matching rule, determining that the control A depends on the control B.
It should be noted that the above-mentioned implementation of performing data matching verification by using the preset word boundary matching algorithm is a technical means known to those skilled in the art, and the present invention is not described herein in detail.
Optionally, determining a cyclic dependency chain formed by the controls having the cyclic dependency relationship based on the dependency relationship includes:
and determining a dependency chain where each control is located according to the dependency relationship.
For each dependency chain: any control in the dependency chain is taken as an initial control. And from the initial control, sequentially using the controls as the current control to perform instantiation operation along the dependency chain until the current control is the instantiated control or the current control does not have the control depended on in the dependency chain.
And if the current control is the control which is already instantiated, determining that the dependency chain is a circular dependency chain.
And if the current control does not have the control depended on by the current control in the dependency chain, determining the dependency chain as an initialization execution chain.
Optionally, the instantiating operation includes:
and searching the example of the current control from the preset first-level cache, and if the example of the current control cannot be searched, searching the example from the preset second-level cache.
And if the instance of the current control cannot be searched from the preset second-level cache, generating the instance of the current control according to the configuration data of the current control, and adding the instance to the preset second-level cache.
Optionally, the instantiated control of the current control is specifically:
and the preset secondary cache stores the control of the current control instance.
To describe the above "determining a cyclic dependency chain formed by controls having cyclic dependencies based on dependencies", it is specifically explained in conjunction with a specific embodiment of the present invention as shown in fig. 2 and fig. 3:
for convenience of description, a cyclic dependency chain as shown in fig. 2 is set herein. The cyclic dependency chain comprises a control 1, a control 2 and a control 3, which are all represented by circles with reference numbers. Wherein, the dependency relationship among the controls is as follows: control 1 depends on control 2, control 2 depends on control 3, and control 3 depends on control 1.
Control 1 is determined as an initial control, and instantiation operations are performed on the controls starting along the dependency chain as shown in fig. 2. This instantiation operation is illustrated in FIG. 3:
step S301, search an instance of the control 1 from a preset primary cache. Triggering step S302.
Step S302, the instance of the control 1 is not found from the preset first-level cache, and the instance of the control 1 is created. Triggering step S303.
Step S303, add the instance of the control 1 to a preset secondary cache. Triggering step S304.
And step S304, adding the control 1 into the set to be initialized. Triggering step S305.
Step S305, search for an instance of the control 2 from a preset primary cache. Triggering step S306.
Step S306, the instance of the control 2 is not found in the preset first-level cache, and the instance of the control 2 is created. Triggering step S307.
Step S307, add the instance of the control 2 to the preset secondary cache. Triggering step S308.
Step S308, adding the control 2 into the set to be initialized. Triggering step S309.
Step S309, search the instance of the control 3 from the preset first-level cache. Triggering step S310.
Step S310, the instance of the control 3 is not found in the preset first-level cache, and the instance of the control 3 is created. Triggering step S311.
Step S311, add the instance of the control 3 to the preset second-level cache. Triggering step S312.
Step S312, add control 3 to the set to be initialized. Triggering step S313.
Step 313, the instance of the control 1 is searched from the preset first-level cache. Triggering step S314.
In step S314, the instance of the control 1 is not found in the preset first-level cache. Triggering step S315.
Step S315, the instance of the control 1 is found from the preset second-level cache. And triggers step S316.
Optionally, in an optional embodiment of the present invention, after step S315, the identifier of the control 3 may also be searched for from the set to be initialized, and is recorded. The identifier of control 3 may be used to perform the unbinding operation on the circular dependency chain as described below.
Step S316, completing instantiation, and determining the dependency chain as a circular dependency chain.
It should be noted that this embodiment is only for explaining the above process of determining the cyclic dependency chain. The techniques for this instantiation are well known to those skilled in the art and are not intended to be limiting.
Optionally, performing an unbundling operation on each cyclic dependency chain to obtain an acyclic dependency chain, including:
for each cyclic dependency chain:
and when the current control is the control which is already instantiated, searching the control which is dependent on the current control in the cyclic dependency chain according to the sequence of executing the instantiation operation along the cyclic dependency chain.
And for the control which depends on the current control, deleting the identifier data of the current control in the dependent data set of the control so that the control does not depend on the current control.
Optionally, according to the dependency relationship of each control in the acyclic dependency chain in which the root control is located, starting from the root control, sequentially performing initialization on each control along the acyclic dependency chain in which the root control is located, where the initialization includes:
for each control in each acyclic dependency chain: an identifier of the control is obtained. And searching a corresponding control initialization method from a preset database according to the identifier of the control, wherein the control initialization method and the control have a corresponding relation.
For each acyclic dependent chain: and starting from the root control, sequentially initializing each control along the acyclic dependency chain by using a control initialization method.
Optionally, in an optional embodiment of the present invention, the control initialization method may be stored in a preset database.
Corresponding to the above method embodiment, the present invention further provides a system for initializing a control, as shown in fig. 4, the system includes:
and a dependency identification module 401, configured to determine a dependency relationship of each control.
And the cyclic dependency processing module 402 determines a cyclic dependency chain formed by the controls with cyclic dependency relationships based on the dependency relationships. And executing unbinding operation on each cyclic dependent chain to obtain an acyclic dependent chain.
And an initialization execution module 403, configured to determine a root control from the acyclic dependency chain, where the root control is a control independent of other controls. And according to the dependency relationship of each control in the non-cyclic dependency chain where the root control is located, starting from the root control, and sequentially initializing each control along the non-cyclic dependency chain where the root control is located.
Optionally, the dependency identification module 401 is configured to:
traversing each control in the control set, judging whether attribute data of the target control is matched with identifiers of other controls according to a preset dependence detection rule, if so, determining that the target control depends on the other controls, and recording a dependence relationship of the target control, wherein the target control is the control to be detected in the control set, and the dependence relationship of the other controls except the target control comprises: an identifier of the target control and an identifier of at least one other control on which the target control depends.
Optionally, the loop dependency processing module 402 is configured to:
and determining a dependency chain where each control is located according to the dependency relationship.
For each dependency chain:
any control in the dependency chain is taken as an initial control. And from the initial control, sequentially using the controls as the current control to perform instantiation operation along the dependency chain until the current control is the instantiated control or the current control does not have the control depended on in the dependency chain.
And if the current control is the control which is already instantiated, determining that the dependency chain is a circular dependency chain.
And if the current control does not have the control depended on by the current control in the dependency chain, determining the dependency chain as an initialization execution chain.
Optionally, the loop dependency processing module 402 is further configured to:
and searching the example of the current control from the preset first-level cache, and if the example of the current control cannot be searched, searching the example from the preset second-level cache.
And if the instance of the current control cannot be searched from the preset second-level cache, generating the instance of the current control according to the configuration data of the current control, and adding the instance to the preset second-level cache.
Optionally, the loop dependency processing module 402 is further configured to:
for each cyclic dependency chain:
and when the current control is the control which is already instantiated, searching the control which is dependent on the current control in the cyclic dependency chain according to the sequence of executing the instantiation operation along the cyclic dependency chain.
And for the control which depends on the current control, deleting the identifier data of the current control in the dependent data set of the control so that the control does not depend on the current control.
Optionally, the initialization execution module 403 is configured to:
for each control in each acyclic dependency chain: an identifier of the control is obtained. And searching a corresponding control initialization method from a preset database according to the identifier of the control, wherein the control initialization method and the control have a corresponding relation.
For each acyclic dependent chain: and starting from the root control, sequentially initializing each control along the non-cyclic dependency chain by using a control initialization method.
An embodiment of the present invention provides an initialization device for a control, as shown in fig. 5, the device includes:
a processor 501;
a memory 502 for storing instructions executable by the processor 601;
wherein the processor 501 is configured to execute instructions to implement the method of initializing a control as described in any of the above.
Embodiments of the present invention provide a computer storage medium, wherein when instructions in the computer storage medium are executed by a processor of a device, the device is enabled to execute the method for initializing a control according to any one of the above.
The memory may include volatile memory in a computer readable medium, Random Access Memory (RAM) and/or nonvolatile memory such as Read Only Memory (ROM) or flash memory (flash RAM), and the memory includes at least one memory chip. The memory is an example of a computer-readable medium.
Computer-readable media, including both non-transitory and non-transitory, removable and non-removable media, may implement information storage by any method or technology. The information may be computer readable instructions, data structures, modules of a program, or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), Static Random Access Memory (SRAM), Dynamic Random Access Memory (DRAM), other types of Random Access Memory (RAM), Read Only Memory (ROM), Electrically Erasable Programmable Read Only Memory (EEPROM), flash memory or other memory technology, compact disc read only memory (CD-ROM), Digital Versatile Disks (DVD) or other optical storage, magnetic cassettes, magnetic tape magnetic disk storage or other magnetic storage devices, or any other non-transmission medium, which can be used to store information that can be accessed by a computing device. As defined herein, a computer readable medium does not include a transitory computer readable medium such as a modulated data signal and a carrier wave.
As will be appreciated by one skilled in the art, embodiments of the present application may be provided as a method, system, or computer program product. Accordingly, the present application may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, the present application may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, and the like) having computer-usable program code embodied therein.
It is noted that, herein, relational terms such as first and second, and the like may be used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. It should also be noted that the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other identical elements in the process, method, article, or apparatus that comprises the element.
All the embodiments in the present specification are described in a related manner, and the same and similar parts among the embodiments may be referred to each other, and each embodiment focuses on the differences from the other embodiments. In particular, as for the system embodiment, since it is substantially similar to the method embodiment, the description is relatively simple, and reference may be made to the partial description of the method embodiment for relevant points.
The above are merely examples of the present application and are not intended to limit the present application. Various modifications and changes may occur to those skilled in the art. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application should be included in the scope of the claims of the present application.

Claims (10)

1. A method for initializing a control, the method comprising:
determining the dependency relationship of each control;
determining a cyclic dependency chain formed by all the controls with cyclic dependency relations based on the dependency relations;
executing unbinding operation on each cyclic dependency chain to obtain a non-cyclic dependency chain;
determining a root control from the acyclic dependency chain, wherein the root control is a control independent of other controls;
and according to the dependency relationship of each control in the non-cyclic dependency chain where the root control is located, starting from the root control, and sequentially initializing each control along the non-cyclic dependency chain where the root control is located.
2. The method of claim 1, wherein determining the dependency relationship of each control comprises:
traversing each control in a control set, judging whether attribute data of the target control is matched with identifiers of other controls according to a preset dependency detection rule, if so, determining that the target control depends on the other controls, and recording a dependency relationship of the target control, wherein the target control is the control to be detected in the control set, and the other controls are controls in the control set except the target control, and the dependency relationship comprises: an identifier of the target control and an identifier of at least one other control on which the target control depends.
3. The method according to claim 2, wherein the determining a cyclic dependency chain formed by controls having cyclic dependencies based on the dependencies comprises:
determining a dependency chain where each control is located according to the dependency relationship;
for each dependency chain:
taking any control in the dependency chain as an initial control; sequentially using each control as a current control to perform instantiation operation from the initial control along the dependency chain until the current control is the instantiated control or the current control does not have a control which is depended on in the dependency chain;
if the current control is the instantiated control, determining that the dependency chain is a cyclic dependency chain;
and if the current control does not have the control depended on by the current control in the dependency chain, determining the dependency chain as an initialization execution chain.
4. The method of claim 3, wherein the instantiating operation comprises:
searching the example of the current control from a preset first-level cache, and if the example of the current control cannot be searched, searching the example from a preset second-level cache;
and if the instance of the current control cannot be searched from the preset second-level cache, generating the instance of the current control according to the configuration data of the current control, and adding the instance to the preset second-level cache.
5. The method according to claim 4, wherein the current control is an already instantiated control, and specifically comprises:
and the preset secondary cache stores the control of the instance of the current control.
6. The method according to claim 3, wherein performing a unbinding operation on each circularly dependent chain to obtain an acyclic dependent chain comprises:
for each cyclic dependency chain:
when the current control is the control which is already instantiated, searching the control which is dependent on the current control in the cyclic dependency chain according to the sequence of executing the instantiation operation along the cyclic dependency chain;
and deleting the identifier data of the current control in the dependent data set of the control, so that the control is independent of the current control.
7. The method according to claim 1, wherein the sequentially initializing, starting from a root control, the controls along the acyclic dependency chain in which the root control is located according to the dependency relationship of each control in the acyclic dependency chain in which the root control is located, includes:
for each control in each acyclic dependency chain: obtaining an identifier of the control; searching a corresponding control initialization method from a preset database according to the identifier of the control, wherein the control initialization method and the control have a corresponding relation;
for each acyclic dependent chain: and starting from the root control, sequentially initializing each control along the acyclic dependency chain by using a control initialization method.
8. A system for initializing a control, the system comprising:
the dependency identification module is used for determining the dependency relationship of each control;
the cyclic dependency processing module is used for determining a cyclic dependency chain formed by all the controls with cyclic dependency relationships based on the dependency relationships; executing unbinding operation on each cyclic dependency chain to obtain a non-cyclic dependency chain;
the initialization execution module is used for determining a root control from the acyclic dependency chain, wherein the root control is a control independent of other controls; and according to the dependency relationship of each control in the non-cyclic dependency chain where the root control is located, starting from the root control, and sequentially initializing each control along the non-cyclic dependency chain where the root control is located.
9. An apparatus for initializing a control, the apparatus comprising:
a processor;
a memory for storing the processor-executable instructions;
wherein the processor is configured to execute the instructions to implement the method of initializing a control as claimed in any one of claims 1 to 7 above.
10. A computer storage medium, wherein instructions in the computer-readable storage medium, when executed by the processor of the device, enable the device to perform an initialization method of a control of any of claims 1 to 7.
CN202210150935.2A 2022-02-18 2022-02-18 Control initialization method, system, equipment and storage medium Pending CN114528047A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210150935.2A CN114528047A (en) 2022-02-18 2022-02-18 Control initialization method, system, equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210150935.2A CN114528047A (en) 2022-02-18 2022-02-18 Control initialization method, system, equipment and storage medium

Publications (1)

Publication Number Publication Date
CN114528047A true CN114528047A (en) 2022-05-24

Family

ID=81623308

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210150935.2A Pending CN114528047A (en) 2022-02-18 2022-02-18 Control initialization method, system, equipment and storage medium

Country Status (1)

Country Link
CN (1) CN114528047A (en)

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102486732A (en) * 2010-12-02 2012-06-06 上海可鲁系统软件有限公司 Distributed type platform and control method for starting priorities of functional modules in platform
CN111158593A (en) * 2019-12-26 2020-05-15 浪潮(北京)电子信息产业有限公司 Multi-snapshot dependency relationship processing method and device and related components

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102486732A (en) * 2010-12-02 2012-06-06 上海可鲁系统软件有限公司 Distributed type platform and control method for starting priorities of functional modules in platform
CN111158593A (en) * 2019-12-26 2020-05-15 浪潮(北京)电子信息产业有限公司 Multi-snapshot dependency relationship processing method and device and related components

Similar Documents

Publication Publication Date Title
CN106897342B (en) Data verification method and equipment
CN104112284A (en) Method and equipment for detecting similarity of images
CN110909363A (en) Software third-party component vulnerability emergency response system and method based on big data
CN111008154B (en) Android application automatic test method and system based on reinforcement learning
CN111026663B (en) Software defect detection method, device, computer equipment and storage medium
CN109299276B (en) Method and device for converting text into word embedding and text classification
CN108804332B (en) Machine learning-based C program memory leakage intelligent detection method
CN108399125B (en) Automatic testing method and device, computer equipment and storage medium
US10782942B1 (en) Rapid onboarding of data from diverse data sources into standardized objects with parser and unit test generation
CN111913878A (en) Program analysis result-based bytecode instrumentation method, device and storage medium
CN112115063B (en) Software localization test method, device, terminal and storage medium
CN117290481A (en) Question and answer method and device based on deep learning, storage medium and electronic equipment
CN114528047A (en) Control initialization method, system, equipment and storage medium
CN111597407A (en) Keyword matching method, device, equipment and storage medium based on TCAM
CN116028626A (en) Text matching method and device, storage medium and electronic equipment
CN108681490B (en) Vector processing method, device and equipment for RPC information
CN110019295B (en) Database retrieval method, device, system and storage medium
CN107562533B (en) Data loading processing method and device
CN115619496A (en) Accurate pushing method for E-commerce products and server
CN115129590A (en) Test case generation method and device, electronic equipment and storage medium
CN110929188A (en) Method and device for rendering server page
CN115048083A (en) Visualization method and device for assembly, storage medium and electronic equipment
CN113297498A (en) Internet-based food attribute mining method and system
CN108664900B (en) Method and equipment for identifying similarities and differences of written works
CN112732578A (en) Code performance evaluation method and device

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination