CN100483395C - Electronic data table calculation chain generation method and device - Google Patents

Electronic data table calculation chain generation method and device Download PDF

Info

Publication number
CN100483395C
CN100483395C CNB2007101057098A CN200710105709A CN100483395C CN 100483395 C CN100483395 C CN 100483395C CN B2007101057098 A CNB2007101057098 A CN B2007101057098A CN 200710105709 A CN200710105709 A CN 200710105709A CN 100483395 C CN100483395 C CN 100483395C
Authority
CN
China
Prior art keywords
unit
chain
module
dependence
calculating
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.)
Active
Application number
CNB2007101057098A
Other languages
Chinese (zh)
Other versions
CN101055567A (en
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.)
Kingdee Software China Co Ltd
Original Assignee
Kingdee Software China 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 Kingdee Software China Co Ltd filed Critical Kingdee Software China Co Ltd
Priority to CNB2007101057098A priority Critical patent/CN100483395C/en
Publication of CN101055567A publication Critical patent/CN101055567A/en
Application granted granted Critical
Publication of CN100483395C publication Critical patent/CN100483395C/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Landscapes

  • Management, Administration, Business Operations System, And Electronic Commerce (AREA)
  • Document Processing Apparatus (AREA)

Abstract

The invention provides a method and system for producing the calculating chain of spreadsheet.The method comprises the steps of: analyzing the dependent relationship between units in the spreadsheet; adding first unit for the calculating chain; looking up the dependent unit of unit according to the dependent relationship; adding the dependent unit the tail of the calculating chain; adding next unit to the tail of the calculating chain based on predetermined ergodic order to look up the dependent unit of unit, and adding the dependent unit to the tail of the calculating chain, repeating the step until all units is added to the calculating chain. Accordingly, the repeated moving of unit nodes in the calculating process is avoided, and the redundant calculation can be reduced and the calculated efficiency for the spreadsheet is improved obviously, as well as the system resource of computer is also saved greatly.

Description

A kind of generation method and system of electronic data table calculation chain
Technical field
The present invention relates to the electronic data list processing (LISP), particularly relate to a kind of generation method and system of electronic data table calculation chain.
Background technology
Spreadsheet (Spreadsheet): be the computational tool software of organizing data and information with unit form, such as Microsoft Excel, Lotus1-2-3, Borland Quattro Pro, LinuxGnumeric, WPS form, Office of Yongzhong or the like.
Cell is the basic composition unit of spreadsheet, wherein can comprise computing formula, in order to calculate the numerical value of this element.Spreadsheet can also preestablish or provide some power functions by secondary development person, and these functions can be used in the unit formula, to be user-friendly to.
Traditional spreadsheet such as Microsoft Excel utilize the calculating of formula in the single calculating chain processing spreadsheet and rerun, and this calculating chain is the ordered list that is imported into the whole formula in the current all working table that is written into of Excel in itself.When formula was imported into electrical form, this formula was added to the beginning of global calculation chain.When (recalc) operation was reruned in the operation triggering of reruning by the interior perhaps manual request of the modification unit that formula relied on, Excel will cyclic access calculate in the chain, and recomputated any formula that is marked as " dirty " (that is, wait is reruned).As to unit C4=A4+B4, code is to first unit C4 evaluation, and when attempting formula "=A4+B4 " evaluation, Accounting Legend Code finds that this formula depends on unit A4, and unit A4 is " dirty ", that is to say still and will calculate.In this case, the formula of unit C4 "=A4+B4 " is called " dependence " formula, and unit C4 is called the dependence unit, and unit A4, B4 are called supporter, and the formula among the unit A4 is called " support " formula.Code stops formula=A4+B4 evaluation, the formula of unit A4 is pressed into the calculating chain, and is inserted into before the formula that abuts against unit C4.Then, Accounting Legend Code restarts its work from the formula of unit A4.Without a doubt, Accounting Legend Code is transferred to C4 to the A4 evaluation.When attempting formula=A4+B4 evaluation (for the second time), Accounting Legend Code learns that A4 has been calculated (no longer " dirty ") now, but finds that formula also depends on unit B 4, and B4 also is " dirty ".Like this, code stops once more to this formula evaluation, and the formula of B4 is moved on to before the formula that abuts against C4.Then, without a doubt, code is to the B4 evaluation, and transfers to C4 (being for the third time now).Can finish this process to the C4 evaluation now.
These described computing method can frequently move the node in the former calculating chain, and cause twice calculating of C4 formula redundancy.Especially, for C4=A4+B4+D4+E4+F4+G4+H4+I4, suppose unit A4, B4, D4, E4, F4, G4, H4, I4 is " dirty ", then earlier all cell nodes are moved on to C4 front, unit, calculate then, in computation process, whenever to the unit of " dirty ", recomputate C4 again after then this " dirty " unit calculating being finished, when running into the next one " dirty " unit, it is all useless that the portion C 4 of front is calculated, quote and find just when calculating I4 that I4 is " dirty ", adding up of front is useless, has calculated I4 earlier and has heavily come one time again, thereby caused redundant computation 8 times.If unit C4 relies on more unit, the mobile number of times of described node and the number of times of redundant computation are then more.For very complicated electronic data sheet, especially in large-scale financial planning scheme, finishing the calculating of long-chain formula in the above described manner needs a large amount of processing times, also can cause a large amount of wastes of resource for computer system.
Therefore, press for a kind of calculating chain and carry out improved method and system spreadsheet, utilize this chain to calculate or other when handling, do not need the node in the frequent mobile chain, reduce the number of times of redundant computation.
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.
Description of drawings
Fig. 1 is the process flow diagram that a kind of spreadsheet active cell of the embodiment of the invention calculates the generation method of chain;
Fig. 2 is the process flow diagram of the generation method of a kind of electronic data table calculation chain of the embodiment of the invention;
Fig. 3 is the process flow diagram of a kind of electronic data table calculation chain of embodiment of the invention generation method;
Fig. 4 is the structured flowchart that a kind of spreadsheet active cell of the embodiment of the invention calculates the chain generation system;
Fig. 5 is the structured flowchart of a kind of electronic data table calculation chain of embodiment of the invention generation system.
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.
In step 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 the step 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.
In step 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 the step 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 new interpolation 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 repeating step 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:
Parsing module 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.
Calculate chain 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.

Claims (16)

1, a kind of spreadsheet active cell calculates the generation method of chain, it is characterized in that, comprising:
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.
2, the method for claim 1 is characterized in that:
When in calculating chain, having had the unit that will add, no longer add this unit.
3, method as claimed in claim 2 is characterized in that, further comprises:
Finish the calculating of active cell and dependence unit thereof according to the calculating chain of this generation.
4, method as claimed in claim 2 is characterized in that, further comprises:
The calculating chain of described generation is with array or storage of linked list.
5, a kind of generation method of electronic data table calculation chain is characterized in that, 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.
6, a kind of generation method of electronic data table calculation chain is characterized in that, 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.
7, method as claimed in claim 6 is characterized in that:
When in calculating chain, having had the unit that will add, no longer add this unit.
8, method as claimed in claim 7 is characterized in that, further comprises:
Finish the calculating of spreadsheet according to the calculating chain of this generation.
9, method as claimed in claim 7 is characterized in that, further comprises:
The calculating chain of described generation is with array or storage of linked list.
10, a kind of spreadsheet active cell calculates the generation system of chain, it is characterized in that, 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.
11, system as claimed in claim 10 is characterized in that:
When in calculating chain, having had the unit that will add, then never call and insert module and add this unit.
12, system as claimed in claim 10 is characterized in that, further comprises:
Memory module is with the calculating chain of array or storage of linked list generation.
13, a kind of generation system of electronic data table calculation chain is characterized in that, 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.
14, system as claimed in claim 13 is characterized in that:
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.
15, system as claimed in claim 13 is characterized in that, further comprises:
Memory module is with the calculating chain of array or storage of linked list generation.
16, system as claimed in claim 15 is characterized in that, further comprises:
Computing module is finished the computing of spreadsheet according to the calculating chain that generates.
CNB2007101057098A 2007-05-25 2007-05-25 Electronic data table calculation chain generation method and device Active CN100483395C (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CNB2007101057098A CN100483395C (en) 2007-05-25 2007-05-25 Electronic data table calculation chain generation method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CNB2007101057098A CN100483395C (en) 2007-05-25 2007-05-25 Electronic data table calculation chain generation method and device

Publications (2)

Publication Number Publication Date
CN101055567A CN101055567A (en) 2007-10-17
CN100483395C true CN100483395C (en) 2009-04-29

Family

ID=38795406

Family Applications (1)

Application Number Title Priority Date Filing Date
CNB2007101057098A Active CN100483395C (en) 2007-05-25 2007-05-25 Electronic data table calculation chain generation method and device

Country Status (1)

Country Link
CN (1) CN100483395C (en)

Families Citing this family (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20110314365A1 (en) * 2010-06-17 2011-12-22 Microsoft Corporation Decompiling loops in a spreadsheet
CN102508990B (en) * 2011-09-28 2016-01-06 北京像素软件科技股份有限公司 A kind of data-updating method of online game
CN106445968B (en) * 2015-08-11 2020-08-04 阿里巴巴集团控股有限公司 Data merging method and device
CN106991101B (en) * 2016-01-21 2021-02-02 阿里巴巴集团控股有限公司 Data table analysis processing method and device
CN110059301A (en) * 2019-03-12 2019-07-26 北京字节跳动网络技术有限公司 Data processing method, device, electronic equipment and computer readable storage medium

Also Published As

Publication number Publication date
CN101055567A (en) 2007-10-17

Similar Documents

Publication Publication Date Title
Falgout et al. The design and implementation of hypre, a library of parallel high performance preconditioners
CN100483395C (en) Electronic data table calculation chain generation method and device
CN110351325B (en) Data processing method and related equipment
CN110597842B (en) Service data query method and system
CN111193603B (en) Network architecture generation method and device, readable storage medium and computer equipment
KR20180133375A (en) Data analysis and processing methods, devices, computer devices and storage media
CN112286934A (en) Database table importing method, device, equipment and medium
CN114676686B (en) Data dictionary processing method, translation method and related device
CN102855305B (en) Data upgrading method and device
CN108090000A (en) A kind of method and system for obtaining CPU register informations
CN102915344A (en) SQL (structured query language) statement processing method and device
CN100483397C (en) Function collection method and device of electronic data table
CN100483396C (en) Electronic data table calculation method and device
CN112926008B (en) Method, device, electronic equipment and storage medium for generating form page
CN105930354A (en) Storage model conversion method and device
CN110399124B (en) Code generation method, device, equipment and readable storage medium
CN107643892B (en) Interface processing method, device, storage medium and processor
CN113076365B (en) Data synchronization method, device, electronic equipment and storage medium
CN110888901B (en) System management method, device, computer equipment and storage medium
CN114328486A (en) Data quality checking method and device based on model
KR20130103912A (en) Method and apparatus for processing data
US10402391B2 (en) Processing method, device and system for data of distributed storage system
CN112148734A (en) Transaction data processing method, device, equipment and storage medium based on block chain
CN114328558B (en) List updating method, apparatus, device and storage medium
CN111597240A (en) Data export method, data export device, computer equipment and storage medium

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
C14 Grant of patent or utility model
GR01 Patent grant