Summary of the invention
Technical matters to be solved by this invention provides a kind of generation method and system of electronic data table calculation chain, can generate according to the dependence between spreadsheet cell and calculate chain, when spreadsheet being carried out computing etc. and handles, raise the efficiency, save resource for computer system.
In order to address the above problem, the invention discloses the generation method that a kind of spreadsheet active cell calculates chain, specifically can comprise:
Resolve the dependence between each unit of spreadsheet;
Add active cell to calculating chain;
According to the dependence unit of dependence inquiry active cell, and whether the dependence unit of judging described active cell be present in and calculate in the chain, if not, the dependence unit of described active cell is added into calculates the chain afterbody;
Inquire about the dependence unit of new adding device according to dependence, and whether the dependence unit of judging described new adding device is present in the calculating chain, if not, the dependence unit of described new adding device is added into the afterbody that calculates chain, repeat this step to last unit that calculates chain, with the direct dependence unit of active cell with rely on the unit indirectly and all be added into and calculate in the chain.
Preferably, when in calculating chain, having had the unit that will add, no longer add this unit.
Described method may further include: finish the calculating of active cell and dependence unit thereof according to the calculating chain of this generation.Described method can further include: the calculating chain of described generation is with array or storage of linked list.
According to another embodiment of instructions, the invention also discloses a kind of generation method of electronic data table calculation chain, comprising:
Resolve the dependence between each unit of spreadsheet;
In calculating chain, add first module;
Inquire about the dependence unit of this unit according to dependence;
Whether the dependence unit of judging described first module is present in the calculating chain, if not, the dependence unit of described first module is added to the afterbody of calculating chain;
Next unit is added to the afterbody that calculates chain according to the traversal order that presets, inquire about the dependence unit of this unit, whether the dependence unit of judging described next unit is present in the calculating chain, if not, add the dependence unit of described next unit to calculate chain afterbody, repeat this step, all add the calculating chain to until all unit.
According to another embodiment of instructions, the invention also discloses a kind of generation method of electronic data table calculation chain, comprising:
Dependence between a, each unit of parsing spreadsheet;
B, add first module to calculating chain;
C, inquire about the dependence unit of this unit, and judge whether the dependence unit of described first module is present in the calculating chain, if not, add the dependence unit of described first module to calculate chain afterbody according to dependence;
D, inquire about the dependence unit of new adding device according to dependence, whether the dependence unit of judging described new adding device is present in is calculated in the chain, if not, adds the dependence unit of described new adding device to calculate chain afterbody;
E, repeating step d are to last unit that calculates chain;
F, add next unit to calculate chain afterbody according to the traversal order that presets, to this unit repeating step c, d, e;
G, repeating step f obtain the calculating chain of spreadsheet.
Preferably, when in calculating chain, having had the unit that will add, no longer add this unit.
This method may further include: finish the calculating of spreadsheet according to the calculating chain of this generation.
This method can further include: the calculating chain of described generation is with array or storage of linked list.
According to another embodiment of instructions, the invention also discloses the generation system that a kind of spreadsheet active cell calculates chain, comprising:
Parsing module is used to resolve the dependence between each unit of spreadsheet;
First inserts module, is used for active cell is added into the calculating chain;
Enquiry module is according to the dependence unit of unit in the parsing module inquiry spreadsheet;
Judge module is used for judging whether the dependence unit that described enquiry module obtains is present in the calculating chain;
Second inserts module: be used for when the judged result of described judge module for not the time, the dependence unit that described enquiry module is obtained is added into the afterbody that calculates chain;
Calculate the chain generation module, be used to call first and insert the afterbody that module is added active cell on the calculating chain, call enquiry module and inquire about the dependence unit of described active cell, and call judge module and judge whether the dependence unit that obtains in the described enquiry module is present in the calculating chain, when the judged result of described judge module for not the time, calling second inserts the dependence unit that module obtains described enquiry module and is added into the afterbody that calculates chain, new adding device is repeated to call enquiry module once more, judge module, second inserts module, the direct dependence unit and the indirect unit that relies on of active cell all are added in the calculating chain, obtain the calculating chain of spreadsheet active cell.
Preferably, when in calculating chain, having had the unit that will add, then never call and insert module and add this unit.This system can further include: memory module, and with the calculating chain of array or storage of linked list generation.
According to another embodiment of instructions, the invention also discloses a kind of generation system of electronic data table calculation chain, comprising:
Parsing module is used to resolve the dependence between each unit of spreadsheet;
First inserts module, is used for the spreadsheet first module is added into the calculating chain;
Enquiry module is used for the dependence unit according to parsing module inquiry spreadsheet unit;
Judge module is used for judging whether the dependence unit that described enquiry module obtains is present in the calculating chain;
Second inserts module: be used for when the judged result of described judge module for not the time, the dependence unit that described enquiry module is obtained is added into the afterbody that calculates chain;
Calculate the chain generation module, be used to call first and insert the afterbody that module is added first module on the calculating chain, call enquiry module and inquire about the dependence unit of described active cell, and call judge module and judge whether the dependence unit that obtains in the described enquiry module is present in the calculating chain, when the judged result of described judge module for not the time, call second and insert the dependence unit that module obtains described enquiry module and be added into the afterbody that calculates chain; And, to the dependence unit of new adding device repeat to call enquiry module once more, judge module, second is inserted module, up to the afterbody that calculates chain; And, calling first once more at the spreadsheet next unit and insert module, the polyphony of laying equal stress on is inserted module with enquiry module, judge module, second, obtains the calculating chain of spreadsheet.
Preferably, for calculating the chain generation module, when in calculating chain, having had the unit that will add, then never call and insert module and add this unit.This system can further include: memory module, and with the calculating chain of array or storage of linked list generation.This system can further include: computing module is used for finishing according to the calculating chain that generates the computing of spreadsheet.
Compared with prior art, the present invention has the following advantages:
Because before spreadsheet is handled, by resolving the dependence between each unit of spreadsheet, calculate chain thereby generate, so in processing procedure, just no longer need frequent each cell node that moves, improve efficient, saved resource for computer system.Especially when spreadsheet is calculated, generate the method for calculating chain while calculating, be optimized for to generate earlier and calculate chain, and then finish the calculating of spreadsheet according to the calculating chain of this generation, thereby avoided moving repeatedly of in computation process cell node, and can reduce redundant operation, obvious to the raising of spreadsheet counting yield, and saved resource for computer system greatly.
Embodiment
For above-mentioned purpose of the present invention, feature and advantage can be become apparent more, the present invention is further detailed explanation below in conjunction with the drawings and specific embodiments.
Core concept of the present invention is to make up the dependence between each unit in the spreadsheet earlier, make up dependence between each unit in the implementation difference of different spreadsheets, but principle is similar: will notify other unit that rely on this element when a location contents changes, and upgrade content separately.In calculating chain, add supporter according to certain traversal order then, inquire about the dependence unit of this unit, add them to calculate chain afterbody successively, first dependence unit of supporter begins from calculate chain, inquire about the dependence unit of this unit, add them to calculate chain afterbody successively; So circulate up to calculating chain afterbody, thereby all unit that directly and indirectly depend on supporter have all been added into the calculating chain.Finish the interpolation of whole unit by traversal order, generate the calculating chain of spreadsheet.The order that the whole calculating chain that generate this moment has kept supporter to calculate earlier basically.By the present invention, generate the method for calculating chain while calculating, be optimized for to generate earlier and calculate chain, and then finish the calculating of spreadsheet according to the calculating chain of this generation, avoided moving repeatedly of in computation process cell node like this, and can reduce redundant operation, efficient is significantly improved when utilizing the calculating chain of this generation spreadsheet to be carried out processing such as computing, and has saved resource for computer system greatly.
The present invention can be used in numerous general or special purpose computingasystem environment or the configuration.For example: personal computer, server computer, handheld device or portable set, plate equipment, multicomputer system, the system based on microprocessor, set top box, programmable consumer-elcetronics devices, network PC, small-size computer, mainframe computer, comprise distributed computing environment of above any system or equipment or the like.
The present invention can describe in the general context of the computer executable instructions of being carried out by computing machine, for example program module.Usually, program module comprises the routine carrying out particular task or realize particular abstract, program, object, assembly, data structure or the like.Also can in distributed computing environment, put into practice the present invention, in these distributed computing environment, by by communication network connected teleprocessing equipment execute the task.In distributed computing environment, program module can be arranged in the local and remote computer-readable storage medium that comprises memory device.
The generation method of electronic data table calculation chain of the present invention can be used for whole all unit of spreadsheet, also can be used to finish the generation to its unit, subregion or individual unit calculating chain.
With reference to Fig. 1, show the process flow diagram that a kind of spreadsheet active cell of the present invention calculates the generation method of chain, may further comprise the steps:
Step 101, make up the dependence between each unit.
Spreadsheet is composed of multiple units usually, and might there be complementary relation in these unit each other.As unit formula C4=A4+B4, unit C4 depends on unit A4 and unit B 4, and then described unit C4 is for relying on the unit, and described unit A4, B4 are supporter.In spreadsheet, relying on unit and supporter is not what fix, can transform mutually, promptly relies on the supporter that the unit may be other unit.In D4=C4+E4, C4 then is a supporter, and D4 relies on the unit.Therefore, have such a case in spreadsheet, the dependence unit of a supporter is the supporter of another unit.Depend on supporter because rely on the unit,, after all supporter that rely on the unit are all handled, just can finish the processing that relies on the unit so in the processing procedures such as calculating of spreadsheet, should handle supporter earlier.
Make up dependence according to the relation between each unit of spreadsheet, the principle of described structure is: supporter is positioned in calculating chain as far as possible relies on before the unit.The such dependence of cell formation in the spreadsheet there is multiple attainable method, as travels through all unit, resolve syntax tree, generate a data structure that comprises dependence.Specifically, for C4=A4+B4, at first A4, B4 are the supporter of unit C4, and C4 relies on the unit, resolve in the process of A4, B4 generative grammar tree, and the Formula Parsing device has been discerned by dependent A4 and B4, thereby sets up dependence.
The requirement of described dependence data structure is that the unit of available electron tables of data is efficiently inquired about as " key assignments ", all can realize with Hash table or ordering array." key assignments " of unit " codomain " pointed is a set, is used for comprising the dependence unit.
Step 102, add active cell to calculating the chain afterbody.
Step 103, inquire about the dependence unit of this unit.
Instep 101, built the dependence between each unit in the spreadsheet, therefore, in this step, in dependence, inquired about the dependence unit that can obtain this unit with " key assignments " or the additive method of unit.Consider counting yield, the unit syntax tree of resolving in thestep 101 and the dependence of structure need buffer memory.General meeting construction unit syntax tree when File Open.Especially, not necessarily will make up the syntax tree of all unit, as only making up current active table page or leaf, the employing lazy-mode of other table page or leaf makes up.Perhaps syntax tree, dependence have been kept in the file, directly loading gets final product.Therefore, by the described dependence data structure that makes up, can inquire the dependence unit of each unit easily.
Step 104, add the unit that respectively relies on that obtains by inquiry to calculate chain afterbody.
In spreadsheet, the dependence unit of a unit has a plurality of usually, if a plurality of dependences unit then adds this a plurality of dependences unit to the afterbody that calculates chain successively.
Step 105, inquire about the dependence unit of new adding device, and be added into the afterbody that calculates chain according to dependence.
Repeat this step to last unit that calculates chain, all of active cell directly and are indirectly relied on unit all be added into and calculate in the chain.
Rely on unit from first and begin traversal to calculating the chain afterbody, the dependence unit of each unit of traversing is added to calculate the chain afterbody.When calculating chain afterbody no longer increased, then all of active cell had directly all been added in the calculating chain with the indirect unit that relies on.
By the calculating chain that this method generates, notice relies on other unit of this element when a location contents changes, and upgrades content separately.Further, when the unit that will add has been added in the calculating chain, then no longer in calculating chain, add this unit.Because the unit of spreadsheet is a small object of realizing " can calculate interface ", one of them method that can calculate interface is provided with " adding " mark exactly, so in the time of in the unit being added to the calculating chain, " adding " mark is done in the unit show that this element has added the calculating chain, thereby when identical unit will add, " add " sign by this and just can realize no longer repeating adding.Thereby can save system resource, also can raise the efficiency.This moment, whole calculating chain guaranteed supporter processing earlier basically.
Further, the calculating chain for generating can adopt the mode of array or chained list to store, and no matter adopts which kind of mode, and is all each has something to recommend him on access efficiency, insertion operation and EMS memory occupation cost.Can certainly adopt other mode to store calculating chain, the present invention does not limit this.
Further, can also comprise a calculation procedure,, finish the calculating of active cell and dependence unit thereof by the calculating chain of this generation.
On the whole, the inventive method has kept being relied on the order that the unit calculates earlier substantially, thereby part has avoided calculating chain node to move and redundant computation, has improved counting yield.The inventive method has been widely applied the dependence inquiry in generating the process of calculating chain, with respect to the consumption of unit formula redundant computation, cost is that reasonably the overall treatment efficiency of spreadsheet has remarkable lifting.
With reference to Fig. 2, show the process flow diagram of the generation method of a kind of electronic data table calculation chain of the present invention, be with the difference of method shown in Figure 1: this method is to generate at whole unit of spreadsheet or selected part unit to calculate chain.Comprise step:
Step 201, make up the dependence between each unit.
Spreadsheet is composed of multiple units usually, and might there be complementary relation in these unit each other.Relation according to each unit of spreadsheet makes up dependence, and the principle of described structure is: supporter is positioned in calculating chain as far as possible relies on before the unit.The such dependence of cell formation in the spreadsheet there is multiple attainable method, as travels through all unit, resolve syntax tree, generate a data structure that comprises dependence.The requirement of described dependence data structure is that the unit of available electron tables of data is efficiently inquired about as " key assignments ", all can realize with Hash table or ordering array." key assignments " of unit " codomain " pointed is a set, is used for comprising the dependence unit.
Step 202, add first module to calculating the chain afterbody.
Step 203, inquire about the dependence unit of this unit.
Step 204, described dependence unit added to the afterbody that calculates chain.
In step 201, built the dependence between each unit in the spreadsheet, therefore, in this step, in dependence, inquired about the dependence unit that can obtain this unit with " key assignments " or the additive method of unit.
Step 205, add next unit to calculate chain afterbody, inquire about the dependence unit of this unit, and add this dependences unit the afterbody of calculating chain to, repeat this step, all add the calculating chain to until all unit according to the traversal order that presets.
Described traversal order is can be Row Column, can be Column Row also, adopts which type of traversal order that the inventive method is not had influence, and the present invention is not limited this yet.
Further, when the unit that will add has been added in the calculating chain, then no longer in calculating chain, add this unit.Because the unit of spreadsheet is a small object of realizing " can calculate interface ", one of them method that can calculate interface is provided with " adding " mark exactly, so in the time of in the unit being added to the calculating chain, " adding " mark is done in this unit show that this element has added the calculating chain, when identical unit will add, " add " sign by this and just can realize no longer repeating adding.Thereby can save system resource, also can raise the efficiency.This moment, whole calculating chain kept being relied on the order that the unit is handled earlier basically.
With reference to Fig. 3, show the process flow diagram of a kind of electronic data table calculation chain of the present invention generation method, comprise step:
Step 301, make up the dependence between each unit.
Spreadsheet is composed of multiple units usually, and might there be complementary relation in these unit each other.As unit formula C4=A4+B4, unit C4 depends on unit A4 and unit B 4, and then described unit C4 is for relying on the unit, and described unit A4, B4 are supporter.In spreadsheet, relying on unit and supporter is not what fix, can transform mutually, and promptly relying on the unit may be exactly supporter in other formula.In D4=C4+E4, C4 is a supporter, and D4 relies on the unit.Therefore, have such a case in spreadsheet, the dependence unit of a supporter is the supporter of another unit.Depend on supporter because rely on the unit,, after all supporter that rely on the unit are all handled, just can finish the processing that relies on the unit so in the processing procedures such as calculating of spreadsheet, all be that supporter is handled earlier.
Relation according to each unit of spreadsheet makes up dependence, and the principle of described structure is: supporter is positioned in calculating chain as far as possible relies on before the unit.The such dependence of cell formation in the spreadsheet there is multiple attainable method, as travels through all unit, resolve syntax tree, generate a data structure that comprises dependence.Specifically, for C4=A4+B4, at first A4, B4 are the supporter of unit C4, and C4 relies on the unit, resolve in the process of A4, B4 generative grammar tree, and the Formula Parsing device has been discerned by dependent A4 and B4, thereby sets up dependence.
The requirement of described dependence data structure is that the unit of available electron tables of data is efficiently inquired about as " key assignments ", all can realize with Hash table or ordering array." key assignments " of unit " codomain " pointed is a set, is used for comprising the dependence unit.
Step 302, in calculating chain, add first module.
Step 303, inquire about the dependence unit of this unit, described dependence unit is added to the afterbody that calculates chain.
Instep 301, built the dependence between each unit in the spreadsheet, therefore, in this step, in dependence, inquired about the dependence unit that can obtain this unit with " key assignments " or the additive method of unit.Consider counting yield, resolving in thestep 301 is that the dependence of unit syntax tree and structure needs buffer memory.General meeting construction unit syntax tree when File Open.Not necessarily will make up the syntax tree of all unit, under particular case, only make up current active table page or leaf, employing lazy-mode of other table page or leaf makes up.Perhaps syntax tree, dependence have been kept in the file, directly loading gets final product.Therefore, by the described dependence data structure that makes up, can inquire the dependence unit of each unit easily.In spreadsheet, the dependence unit of a unit has a plurality of usually, if a plurality of dependences unit then adds this a plurality of dependences unit to the back of calculating this supporter of chain successively.
Step 304, inquire about the dependence unit of this new adding device, the dependence unit of described new adding device added to the afterbody that calculates chain.
Though should the new unit that adds be the dependence unit of previous supporter, but in spreadsheet, it may be the supporter of other unit, inquires about the dependence unit of this new adding device, the dependence unit of described new adding device is added to the afterbody that calculates chain according to dependence.
When the unit that adds has when a plurality of, to the unit of each newinterpolation repeating step 304 all, promptly be right after unit after the supporter from calculating chain, inquiry depends on the dependence unit of this element, adds them the afterbody of calculating chain to successively; So circulation is up to the afterbody that calculates chain.So just all unit that directly and indirectly depend on supporter have all been added into the calculating chain.
Step 305, add next unit to calculate chain afterbody according to the traversal order that presets, repeating step 303,304 directly relies on and relies on indirectly the unit with all of this supporter and all adds the calculating chain to.If also there is next unit, then repeatingstep 305, all travel through until all unit and finish, and then finish, and generate the calculating chain of spreadsheet.
Described traversal order is can be Row Column, can be Column Row also, adopts which type of traversal order that the inventive method is not had influence, and the present invention is not limited this yet.
Further, when the unit that will add has been added in the calculating chain, then no longer in calculating chain, add this unit.Because the unit of spreadsheet is a small object of realizing " can calculate interface ", one of them method that can calculate interface is provided with " adding " mark exactly, so in the time of in the unit being added to the calculating chain, " adding " mark is done in this unit show that this element has added the calculating chain, when identical unit will add, " add " sign by this and just can realize no longer repeating adding.Thereby can save system resource, also can raise the efficiency.This moment, whole calculating chain kept being relied on the order that the unit is handled earlier basically.
Further, the calculating chain for generating can adopt the mode of array or chained list to store, and no matter adopts which kind of mode, and is all each has something to recommend him on access efficiency, insertion operation and EMS memory occupation cost.Can certainly adopt other mode to store calculating chain, the present invention does not limit this.
Further, can also comprise a step 1 calculation procedure,, finish the calculating of selected unit in whole spreadsheet or the spreadsheet by the calculating chain of this generation.
Describe the generation method of electronic data table calculation chain of the present invention below in detail with an example.Described spreadsheet is:
| A | B | C |
| 1 | =4*B3 | =A1*C3 | =A1+B1+C2 |
| 2 | 3 | =3*B1 | 5 |
| 3 | 2 | =A3*4 | =A1*A3 |
According to column unit on the sequential access of Row Column, when calculating chain, tissue considers the dependent of active cell, be active cell in []:
The first step, according to ranks circulations, A1 added calculates chain: { A1};
Second step, [A1] add the calculating chain with the dependent [B1, C1, C3] of A1: { A1, B1, C1, C3}; From B1, be circulated to the calculating end of chain (EOC) according to calculating chain sequence:
The 3rd step, [B1] attempt the dependent C1 of B1 added and calculate chain, but C1 no longer adds in calculating chain;
The 4th step, [B1] add the calculating chain with the dependent B2 of B1: { A1, B1, C1, C3, B2};
The 5th step, [C1] C1 do not have the dependent;
The 6th step, [C3] attempt the dependent B1 of C3 added and calculate chain, but B1 no longer adds in calculating chain;
The 7th step, [B2] B2 do not have the dependent;
The 8th step, according to ranks circulations, attempts B1 added and calculate chain, but B1 no longer adds in calculating chain;
The 9th step, according to ranks circulations, attempts C1 added and calculate chain, but C1 no longer adds in calculating chain;
The tenth goes on foot, circulates according to ranks, attempts A2 is added the calculating chain, need not to calculate but A2 is a constant, no longer interpolation;
The 11 step, according to ranks circulations, attempts B2 added and calculate chain, but B2 no longer adds in calculating chain;
The 12 goes on foot, circulates according to ranks, attempts C2 is added the calculating chain, need not to calculate but C2 is a constant, no longer interpolation;
The 13 goes on foot, circulates according to ranks, attempts A3 is added the calculating chain, need not to calculate but A3 is a constant, no longer interpolation;
The 14 goes on foot, circulates according to ranks, B3 is added calculate chain: { A1, B1, C1, C3, B2, B3};
The 15 step, [B3] attempt the dependent A1 of B3 added and calculate chain, but A1 no longer adds in calculating chain;
The 16 step, according to ranks circulations, attempts C3 added and calculate chain, but C3 no longer adds in calculating chain;
The 17 step, ranks circulation are finished, and generate the calculating chain of this spreadsheet, net result { A1, B1, C1, C3, B2, B3}.
With reference to Fig. 4, show the structured flowchart that a kind of spreadsheet active cell of the present invention calculates the chain generation system, comprising:
Parsing module 401, be used to resolve the dependence between each unit of spreadsheet, make up dependence.
Relation according to each unit of spreadsheet makes up dependence, and the principle of described structure is: supporter is positioned in calculating chain as far as possible relies on before the unit.The such dependence of cell formation in the spreadsheet there is multiple attainable method, as travels through all unit, resolve syntax tree, generate a data structure that comprises dependence.The requirement of described dependence data structure is that the unit of available electron tables of data is efficiently inquired about as " key assignments ", all can realize with Hash table or ordering array." key assignments " of unit " codomain " pointed is a set, is used for comprising the dependence unit.
Insert module 402, be used for to calculating the chain adding device.
Enquiry module 403, according to the dependence unit of unit in the parsing module inquiry spreadsheet.
" key assignments " or additive method with the unit are inquired about the dependence unit that can obtain this unit in dependence.
Calculate chain generation module 404, call and insert module interpolation active cell to calculating in the chain, call enquiry module and inquire about the dependence unit of this unit, and call once more and insert the afterbody that module is added described dependence unit on the calculating chain, new adding device is repeated to call enquiry module, insert module once more, all direct unit that rely on of active cell all are added in the calculating chain with the indirect unit that relies on, generate the calculating chain of spreadsheet active cell.
Further, when the unit that will add has been added in the calculating chain, then no longer in calculating chain, add this unit.Because the unit of spreadsheet is a small object of realizing " can calculate interface ", one of them method that can calculate interface is provided with " adding " mark exactly, so in the time of in the unit being added to the calculating chain, " adding " mark is done in the unit show that this element has added the calculating chain, thereby when identical unit will add, " add " sign by this and just can realize no longer repeating adding.Thereby can save system resource, also can raise the efficiency.This moment, whole calculating chain kept being relied on the order that the unit calculates earlier basically.
Further, the calculating chain for generating can adopt the mode of array or chained list to store, and no matter adopts which kind of mode, and is all each has something to recommend him on access efficiency, insertion operation and EMS memory occupation cost.Can certainly adopt other mode to store calculating chain, the present invention does not limit this.
Further, can also comprise a computing module,, finish the computing of active cell and dependence unit thereof by the calculating chain of this generation.
With reference to Fig. 5, show the structured flowchart of a kind of electronic data table calculation chain of the present invention generation system, comprising:
Parsingmodule 501, be used to resolve the dependence between each unit of spreadsheet.
Relation according to each unit of spreadsheet makes up dependence, and the principle of described structure is: supporter is positioned in calculating chain as far as possible relies on before the unit.The such dependence of cell formation in the spreadsheet there is multiple attainable method, as travels through all unit, resolve syntax tree, generate a data structure that comprises dependence.The requirement of described dependence data structure is that the unit of available electron tables of data is efficiently inquired about as " key assignments ", all can realize with Hash table or ordering array." key assignments " of unit " codomain " pointed is a set, is used for comprising the dependence unit.
Insert module 502, be used for to calculating the chain adding device.
Enquiry module 503, according to the dependence unit of unit in the parsing module inquiry spreadsheet.
" key assignments " or additive method with the unit are inquired about the dependence unit that can obtain this unit in dependence.
Calculatechain generation module 504, call and insert module interpolation first module to calculating in the chain, call enquiry module and inquire about the dependence unit of this unit, and call once more and insert the afterbody that module is added described dependence unit on the calculating chain, unit to new interpolation, repeat to call enquiry module and insert the dependence unit that module is added this new adding device, afterbody up to calculating chain has so just all added into the calculating chain with all unit that directly and indirectly depend on supporter.Next unit repeated to call once more insert module, enquiry module, generate the calculating chain of spreadsheet.
Further, when the unit that will add has been added in the calculating chain, then no longer in calculating chain, add this unit.Because the unit of spreadsheet is a small object of realizing " can calculate interface ", one of them method that can calculate interface is provided with " adding " mark exactly, so in the time of in the unit being added to the calculating chain, " adding " mark is done in the unit show that this element has added the calculating chain, thereby when identical unit will add, " add " sign by this and just can realize no longer repeating adding.Thereby can save system resource, also can raise the efficiency.This moment, whole calculating chain kept being relied on the order that the unit calculates earlier basically.
Further, the calculating chain for generating can adopt the mode of array or chained list to store, and no matter adopts which kind of mode, and is all each has something to recommend him on access efficiency, insertion operation and EMS memory occupation cost.Can certainly adopt other mode to store calculating chain, the present invention does not limit this.
Further, can also comprise a computing module,, finish the computing of the selected unit of whole spreadsheet or spreadsheet by the calculating chain of this generation.
Fig. 4,5, shown in the part that do not describe in detail in the system can consider for length referring to the relevant portion of method shown in Fig. 1,2,3, be not described in detail in this.
More than the calculating chain of a kind of spreadsheet provided by the present invention and current cell is generated method and system, be described in detail explanation, used specific case herein principle of the present invention and embodiment are set forth, method of the present invention and core concept thereof are understood in the help that just is used for of above embodiment; Simultaneously, for one of ordinary skill in the art, according to thought of the present invention, the part that all can change in specific embodiments and applications, in sum, this description should not be construed as limitation of the present invention.