CN101055569A - Function collection method and device of electronic data table - Google Patents

Function collection method and device of electronic data table Download PDF

Info

Publication number
CN101055569A
CN101055569A CN 200710105711 CN200710105711A CN101055569A CN 101055569 A CN101055569 A CN 101055569A CN 200710105711 CN200710105711 CN 200710105711 CN 200710105711 A CN200710105711 A CN 200710105711A CN 101055569 A CN101055569 A CN 101055569A
Authority
CN
China
Prior art keywords
function
parameter
eigenwert
storage unit
value
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.)
Granted
Application number
CN 200710105711
Other languages
Chinese (zh)
Other versions
CN100483397C (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 CNB2007101057115A priority Critical patent/CN100483397C/en
Publication of CN101055569A publication Critical patent/CN101055569A/en
Application granted granted Critical
Publication of CN100483397C publication Critical patent/CN100483397C/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Landscapes

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

Abstract

The invention provides a method for collecting the function of spreadsheet, comprising: analyzing a cell formula including the function and the parameter into a syntax tree, and determining each calling order of function in the cell formula; setting an characteristic value node adjacent to a function node in the analyzing process; executing in order the calculation according to the calling order, and collecting the function and parameter which accord with the predetermined condition; the collecting process including the step of looking up whether the corresponding executed result is stored according to the characteristic value; putting in the collected function and parameter in batch and completing the batch execution; storing the executed result ae well as the corresponding fuction and parameter and the characteristic value. The invention is able to unify a plurality of same characteristic value of batch funtion into a characteristic value, only characteristic value is determined for each group of function and parameter after first search, the sequent searches fully depend on the characteristic value, so that the efficiency for collecting the functionit is improved more obviously.

Description

A kind of function collection method of spreadsheet and device
Technical field
The present invention relates to field of computer data processing, particularly relate to a kind of function collection method and device of spreadsheet.
Background technology
Spreadsheet (Spreadsheet): be the computational tool software of organizing data and information with 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 lattice.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.
Such as SUM (number1, number2 ...) function, generally be used for data and add up to; AVERAGE (number1, number2 ...) function generally is used for the mean value (arithmetic mean) of return parameters; Spreadsheet can also preestablish more complicated function, for example: the DDB in Microsoft Excel (cost, salvage, life, period, factor) function; And the power function that secondary development person provides is generally more complicated, such as the ACCT function in the ERP spreadsheet system is used for extracting financial data from other information systems.
In a word, formula that cell can use in the spreadsheet or function are very many, but traditional spreadsheet program such as Microsoft Excel utilize single calculating chain to handle the calculating of formula in the electrical form 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.Be the wherein computation sequence of the unit formula of each cell of spreadsheet overall arrangement of the prior art, carry out the computing unit formula in turn in the mode of explaining or compiling is carried out, the function that is arranged in each unit formula is also called in turn, thereby finishes the data processing of whole spreadsheet successively.
But in actual applications, find that above-mentioned processing procedure is in the high finance data handling procedure, there is following technical matters: all need the same function in whole the spreadsheet is repeated to call, and the dispersion of same function repeats to call the optimization execution that is unfavorable for this function, causes inefficiency.
For example, in the spreadsheet that need to carry out calculates, comprise M function A, function A need call data in other tables of data or the data of other infosystems are finished calculating.Then prior art is carried out after all the formula overall arrangements in this spreadsheet are sorted in turn, and above-mentioned M function A disperses to be present in the formula sequence that obtains.Therefore, in the implementation of prior art, function A just independently, repeated M time, all need independently inquiry from other tables of data, mate and obtain corresponding data and carry out function A at every turn, finish calculating then, can't realize the optimization of function A is carried out, the waste system resources in computation, computation rate is lower.
Summary of the invention
Technical matters to be solved by this invention provides the function collection method and the device of a kind of spreadsheet and cell, can improve the collection efficiency of function in the spreadsheet greatly.
In order to address the above problem, according to embodiments of the invention, a kind of function collection method of spreadsheet is disclosed, comprising: the formula cell that will comprise function and parameter thereof resolves to syntax tree, each calling order of function in the determining unit lattice formula; And, in resolving, follow the function node closely one eigenwert node is set; Carry out computing successively according to the described order of calling, collect the function and the parameter thereof that meet prerequisite; Described collection process comprises the step that whether stores corresponding executed result according to the eigenwert inquiry; Collected function and parameter thereof are submitted in batches, finished in batches and carry out; Storage execution result and corresponding function and parameter and eigenwert.Preferably, described storing step can for: function positions inquiry with eigenwert after carrying out in batches, with execution result and function and parameter and eigenwert corresponding stored.
According to embodiments of the invention, a kind of function collection method of spreadsheet cells is also disclosed, it is characterized in that, comprise: a, the formula cell that will comprise function and parameter thereof resolve to syntax tree, determine in the current cell formula each calling order of function and determine function and non-batch function in batches; And, in resolving, follow the function node closely one eigenwert node is set; B, carry out computing successively, if right and wrong function in batches then calculates the result of calculation of this function according to the described order of calling; If batch function, then execution in step c; C, the eigenwert with this function and parameter thereof in the storage unit that presets are inquired about, and collect the batch function that does not have the accordingly result value, and return a undetermined value at this function; D, in batches carry out the batch function of being stored, obtain corresponding execution result, and this end value and function of corresponding stored and parameter thereof and eigenwert are to described storage unit; E, at function with undetermined value, repeated execution of steps d and e, the function that in this formula cell, does not have undetermined value.
Preferably, described step c is: with the eigenwert inquiry of this function and parameter thereof, if there be the result corresponding with this eigenwert in the described storage unit, then return this end value, otherwise inquire about with this function and parameter thereof in the storage unit that presets; If have identical function and parameter thereof in the storage unit, then the eigenwert in syntax tree replaces to the same functions of having stored and the eigenwert of parameter thereof with this function and parameter thereof, if do not have identical function and parameter thereof in the storage unit, store this function and parameter thereof and characteristic of correspondence value to storage unit, and return a undetermined value at this function, described storage unit is used to store function and the parameter and the characteristic of correspondence value of having collected, and corresponding execution result.
According to embodiments of the invention, a kind of function collection method of spreadsheet is also disclosed, comprising: a, determine the computation sequence of each formula cell in the spreadsheet; B, the formula cell that will comprise function and parameter thereof resolve to syntax tree, determine in the current cell formula each calling order of function and determine function and non-batch function in batches; And, in resolving, follow the function node closely one eigenwert node is set; C, carry out computing successively, if right and wrong function in batches then calculates the result of calculation of this function according to the described order of calling; If batch function, then execution in step d; D, the eigenwert with this function and parameter thereof in the storage unit that presets are inquired about, and collect the batch function that does not have the accordingly result value, and return a undetermined value at this function; E, at the next unit lattice, repeated execution of steps c and d are finished up to the formula cell of required execution; F, in batches carry out the batch function of being stored, obtain corresponding execution result, and with this end value and function and parameter thereof and eigenwert corresponding stored to described storage unit; G, at formula cell with undetermined value, repeated execution of steps d, e and f, the formula cell that in this spreadsheet, does not have undetermined value.
According to embodiments of the invention, a kind of function gathering-device of current cell of spreadsheet is also disclosed, comprise: resolution unit, the formula cell that is used for comprising function and parameter thereof resolves to syntax tree, and add an eigenwert node behind the function node in the syntax tree after parsing, as the eigenwert of this function and parameter thereof; Determining unit is used for each calling order of function of determining unit lattice formula, and batch function wherein and non-batch function; Arithmetic element is used for carrying out computing successively according to the described order of calling, if right and wrong function in batches then calculates the result of calculation of this function; If the batch function is then inquired about with the eigenwert of this function and parameter thereof in the storage unit that presets; The storage judging unit is used for judging whether the eigenwert of inquiring about in storage unit exists corresponding result, collects the batch function that does not have the accordingly result value, and returns a undetermined value at this function; Performance element is used for carrying out the batch function that storage unit is stored in batches, and returns execution result and give storage unit; Storage unit is used to store the corresponding execution result that function in batches and parameter thereof and eigenwert and performance element return; The undetermined value judging unit is used to judge whether also to exist the function with undetermined value, if exist, then calls storage judging unit and performance element once more, the function that does not have undetermined value in this formula cell.
According to embodiments of the invention, a kind of function gathering-device of spreadsheet is also disclosed, comprising: arrangement units, the computation sequence that is used for arranging each formula cell of spreadsheet; Resolution unit, the formula cell that is used for comprising function and parameter thereof resolves to syntax tree, and adds an eigenwert node behind the function node in the syntax tree after parsing, as the eigenwert of this function and parameter thereof; Determining unit is used for each calling order of function of determining unit lattice formula, and batch function wherein and non-batch function; Arithmetic element is used for carrying out computing successively according to the described order of calling, if right and wrong function in batches then calculates the result of calculation of this function; If the batch function is then inquired about with the eigenwert of this function and parameter thereof in the storage unit that presets; The storage judging unit is used for judging whether the eigenwert of inquiring about in storage unit exists corresponding result, collects the batch function that does not have the accordingly result value, and returns a undetermined value at this function; The cell judging unit is used to judge whether also to exist the formula cell that is not performed, if exist, then calls arithmetic element and storage judging unit once more at this formula cell; Performance element is used for carrying out the batch function that storage unit is stored in batches, and returns execution result and give storage unit; Storage unit is used to store the corresponding execution result that function in batches and parameter thereof and eigenwert and performance element return; The undetermined value judging unit, be used to judge whether also to exist formula cell with undetermined value, if exist, then call storage judging unit, cell judging unit and performance element once more, the formula cell that in this spreadsheet, does not have undetermined value.
Compared with prior art, the present invention has the following advantages:
The present invention proposes the function collection method and the device of a kind of spreadsheet and cell, be particularly useful for that described function need call other databases or tables of data is obtained data conditions, order by call function in the determining unit formula, and determine wherein batch function and non-batch function, when having non-batch function, directly calculate the result of this non-batch function, and to the batch function, then in batches function stores and carries out batch and optimize execution, need not disperse to repeat to call, thereby improve the computing velocity of electronic data sheet and cell greatly.
Further, this result who optimizes execution is in batches returned storage unit and function and parameter corresponding stored thereof,, thereby no longer need to carry out far call when the next time of direct return results value during this function call, conserve system resources improves computing velocity greatly.
Further, the present invention's characteristic of correspondence value that has been the function of formula cell and parameter-definition thereof, it is stored in as a node in the syntax tree of corresponding unit formula reuses, represent corresponding function and parameter thereof to carry out query manipulation with this eigenwert, therefore when needs in storage unit, be that object is when inquiring about to this function and parameter thereof, no longer originally inquire about as object with function and parameter thereof, replacing eigenwert inquires about, be that the object replacement is various promptly with a simple eigenwert, complicated function and parameter thereof are inquired about, improved the efficient of query function, particularly function and parameter thereof need be carried out remote inquiry, when repeatedly inquiring about, the raising of functional query efficient is more obvious, thereby has improved the efficient that function is collected greatly.
When having identical in a large number batch function in the formula cell, it is an eigenwert that the present invention further unifies the eigenwert of these functions, after the first pass inquiry, each group function and parameter thereof have all been determined unique eigenwert, the identical function and the eigenwert of parameter thereof are identical, follow-up inquiry relies on this eigenwert to get final product fully, and the raising of function collection efficiency is more obvious.
Description of drawings
Fig. 1 is a kind of spreadsheet functions flow chart of steps of Calculation Method in batches;
Fig. 2 a is a kind of flow chart of steps of function collection method of spreadsheet cells;
Fig. 2 b is the structural drawing after a unit formula resolves to syntax tree;
Fig. 3 is a kind of flow chart of steps of function collection method of spreadsheet;
Fig. 4 a is the function collection method flow chart of steps of a kind of spreadsheet cells of the embodiment of the invention;
Fig. 4 b is the structural drawing after a unit formula resolves to syntax tree and adds eigenwert
Fig. 5 is the flow chart of steps of the function collection method of a kind of spreadsheet of the embodiment of the invention;
Fig. 6 is the structured flowchart of the function gathering-device of a kind of spreadsheet cells of the embodiment of the invention;
Fig. 7 is the structured flowchart of the function gathering-device of a kind of spreadsheet of the embodiment of the invention.
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.
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.
With reference to Fig. 1, show a kind of spreadsheet functions flow chart of steps of Calculation Method in batches, may further comprise the steps:
Formula cell in step 101, the scanning electron tables of data is therefrom collected function and the parameter thereof that meets prerequisite.
Described function can be the arbitrary function in the practical application, but best situation, and described function need call external data source and carry out to finish function.
Described function calculates in batches and can be triggered by user's manual request, and perhaps, origin self-regulated automatically triggers with the request of routine.Described scanning can scan all formula cells in this spreadsheet, and certainly under the situation that has restrictive condition, the formula cell that scans a part in this spreadsheet also is feasible, and the present invention does not need this to be limited.
Described formula cell can only comprise a function that meets prerequisite of the present invention, also can be made up of a plurality of functions, comprising the function that meets prerequisite of the present invention.
Collection described in the step 101 meets the function of prerequisite and the process of parameter can adopt the method for direct string matching to collect function and parameter thereof, also can adopt the method for collecting, to satisfy the needs of the nested function in the formula cell while resolving.Function is nested to be meant the rreturn value of a function parameters for another function, if when having the situation of nested function, could continue calling of external function after needing at first the function call of inside is finished.
Step 102, described function and parameter thereof are submitted at least one performance element in batches.
The described function that meets prerequisite can be the whole functions in the described spreadsheet, and promptly all functions of batch collection will wherein can be used function of the present invention and submit at least one performance element in batches.
The performance element of described batch receiver function can be one or more, and the function that those skilled in the art carry out is as required determined to get final product.
Described batch is submitted to and can also can be submission in batches for once submitting to.For example, in batches bigger, the situation that performance element can't a batch processing just can be submitted to performance element in batches and carry out multi-batch processing.
The described function that meets prerequisite also can be some specific function, determines that by function name needing to collect which function gets final product in advance.
Step 103, performance element are optimized execution at the function and the parameter thereof of batch collection.
The scheme that optimization execution is wherein adopted can be different according to different functions, can't discuss one by one in this present invention.But the present invention is for the core contribution of technology: the mode of function and parameter batch collection, fundamentally changed the process that function is carried out in the spreadsheet, and feasible optimization at this function is carried out and is become possibility.Also can adopt certain optimization to carry into execution a plan for the execution of an independent function, and for the batch of function is carried out, not only can adopt original optimization to carry into execution a plan, can also adopt optimization implementation strategies such as more senior combination ordering, with the execution efficient of further raising function.
Preferably, when described function for inquiry other databases or tables of data when obtaining corresponding data, then described optimization is carried out and can be comprised: as execution parameter, inquiry corresponding database or tables of data are finished function and are carried out with the data acquisition of described parameter.
Further, for whole spreadsheet, above-mentioned steps has only been finished the calculating of part cell, even only finished the calculating of the part of formula cell, so method shown in Figure 1 can also comprise step 104: described performance element returns the execution result of described function in batches; According to described execution result, finish the calculating of whole Zhang Suoshu spreadsheet.
Described performance element can return execution result in batches to described spreadsheet, needs the part of computing to calculate by the performance element that is included in the described spreadsheet to other.Described performance element also can return execution result in batches to another or a plurality of performance element that are independent of outside the described spreadsheet.
Describe adopting direct matching method to collect function and finish calculation process in the step 101 below:
Directly the core concept of matching method is exactly to collect function and parameter thereof by the method for string matching.For example utilize Excel to finish: in the Excel cell, to import formula=SUM (ACCT (" 001 ") at form at certain ERP system, 100), the SUM function is that Excel can discern, the ACCT function is the spread function that is used for extracting data from ERP system, and the Excel system can not discern.At this time can use direct matching method.
Though can finish the collection of some functions and parameter thereof by this direct matching method, but because it is the coupling of function (parameter) directly being carried out character string, so it not can solve the problem of how to collect when function is nested in batches, (this function of ACCT (" 001 ") just can not be collected success as right=ACCT.Though can match suitable function, can't determine its parameter; The collection process of function and the computation process of spreadsheet better can't be combined simultaneously, with the integral operation speed of further raising spreadsheet.
So this has been proposed more preferred embodiment, to address the above problem.The core that this embodiment deals with problems is: calling order of function in the determining unit lattice formula at first, during function in call unit lattice formula, this function of inquiry and parameter thereof in the storage unit that sets in advance, if the result of this function and parameter thereof is arranged then directly return this end value, and continue to carry out; Otherwise this function of cell stores and parameter thereof are returned a undetermined value, and continue to carry out; The function of cell stores and parameter thereof are transferred to performance element carry out, and with this execution result and function that returns and parameter corresponding stored thereof in storage unit; Repeat above-mentioned steps, when not having undetermined value in this unit formula, show that all functions are all collected to finish, withdraw from the function collection process.Thereby solved the collection problem of nested function, and can provide the basis, thereby can improve the arithmetic speed of whole electronic data sheet for the batch execution of function.
With reference to Fig. 2 a, show a kind of flow chart of steps of function collection method of spreadsheet cells, may further comprise the steps:
Step 201, determine to call the order and batch function wherein and non-batch function.
Determine each calling order of function in the current cell formula, the method of function order has multiple in the determining unit lattice formula, for example, following dual mode all is feasible: a, unit formula is resolved to syntax tree, each function calls order is determined when carrying out syntax tree; B, the mode that adopts early stage Basic language to carry out by speech explanation, recursive call also can be determined the function calls order.
What the present invention preferentially adopted is that the current cell Formula Parsing that will comprise function becomes the mode of syntax tree, thereby determines wherein each calling order of function.
The method that resolves to syntax tree is often used in the computing machine compilation process.The compilation process of traditional computerese is probably as follows: read in document source → morphology syntax parsing → abstract syntax tree → semantic analysis → code and generate.
For the present invention the computing formula in the current cell is resolved to the process of syntax tree, can adopt and above-mentioned essentially identical principle.
For example for unit formula=10+SUM (1, ACCT (" 001 ")), with reference to Fig. 2 a, be the form after it resolves to syntax tree; With array data structure file layout be: (10,1, " 001 ", ACCT, SUM ,+).Can see that from the syntax tree of storage of array form the execution sequence of function, ACCT are to carry out earlier, ACCT function its rreturn value of complete back and " 1 " continue to carry out as the parameter of SUM, the rreturn value of SUM with " 10 " addition, whole formula calculates and finishes.
Definite mode of batch function and non-batch function has a variety of, and function name sign, configuration file, registration or the like mode is not crucial for the present invention, has not just been described in detail at this.
Carry out the efficient aspect from syntax tree and consider, the label that whether is function in batches directly can be identified on the function node of syntax tree, this finishes just passable in analytic formula in the lump.
Described batch function is can batch collection and the function carried out in batches, as ACCT (" 001 "), ACCT (" 002 "), because function can batch collection in batches, optimizes in batches and carries out, and can improve computing velocity.
If this function of step 202 is non-batch function, then directly calculate the result of this function.One of advantage of this step is, satisfies under the certain situation, in batches the situation of function parameters right and wrong batch function.
If this function of step 203 is the batch function, then in storage unit, inquire about.
If this function and CALCULATION OF PARAMETERS result thereof are arranged in step 204 storage unit, then directly return this end value, thereby save the invoked procedure of linear function.
If step 205 is this function and parameter thereof not, illustrate that then this function and parameter thereof are to call for the first time, then this function and parameter thereof are stored into storage unit, finish the collection of function and parameter, and returning a predefined undetermined value at this function, the remainder of unit formula continues to carry out.Like this, the unit formula that nested function is arranged has been collected the function of innermost layer.The formula cell that described undetermined value is used for showing this function and comprises this function is not finished calculating, its result of function who comprises undetermined value remains undetermined value, the formula cell result who comprises the undetermined value function also is undetermined value, certainly, also can adopt other mark to describe.
Further, in this storage unit, there are this function and parameter thereof, but when not have corresponding with it end value, illustrate that then this function and parameter thereof have been collected, the collection of then skipping function at this moment.
Function that step 206, storage unit are collected first pass and parameter thereof are given performance element and are carried out in batches, after performance element is finished this execution result are returned to storage unit, and storage unit is got up execution result and function and parameter corresponding stored thereof.Thereby can directly return the execution value of this function and parameter thereof when inquiring about this function and parameter thereof next time.
Repeating step 203,204,205,206 then, and the function with undetermined value is carried out the collection and the calculating of function, the collection that solves nested function by this repeating step, and when regathering less than new function, then overall calculation is finished.Further, begin next circulation again after the described repeating step function that preferably will all have a undetermined value repeats once.
Further, another kind of situation, concerning the function and formula that return undetermined value, in some cases, for example, when in batches the execution result of function is as non-batch function parameters, then just need calculate, promptly need repeating step 202,203,204,205,206, repeat above-mentioned steps always this non-batch function, the function that in this formula cell, does not have undetermined value, thus end is collected in explanation.
So far, the function in the formula cell is collected and is finished, and those skilled in the art can use the collection result and add up, analyze or the like operation, certainly, also can be used to finish the calculating of current cell, and for example, preferred, present embodiment can also comprise:
The execution result of each batch function that step 207, basis obtain is finished the calculating of current cell.
Can adopt the mode of buffer memory for the result of calculation of non-batch function, finish the calculating of current cell then with the execution result of batch function.For example, order is carried out this formula cell, runs into function in batches, and then inquiry obtains corresponding execution result, runs into non-batch function, and also inquiry obtains the corresponding calculated result, thereby finishes the calculating of whole unit lattice.
Certainly, if comparatively speaking, the resource consumption that calculates non-batch function is littler than the resource consumption of cache way, then also can adopt the mode of double counting to realize.For example, order is carried out this formula cell, runs into function in batches, and then inquiry obtains corresponding execution result, runs into non-batch function, then calculates its result, thereby finishes the calculating of whole unit lattice.
With reference to Fig. 3, show a kind of flow chart of steps of function collection method of spreadsheet, the difference of it and method shown in Figure 2 is, this method is at whole spreadsheet, this spreadsheet can comprise a lot of formula cells, the computing method of described spreadsheet can be used to calculate the calculating of whole spreadsheet, also can be used to finish the calculating to its subregion.Embodiment illustrated in fig. 3ly specifically can may further comprise the steps:
Step 301, determine the computation sequence of each unit formula in the spreadsheet.
For computation sequence how to determine each unit formula in the spreadsheet, those skilled in the art can adopt various feasible methods, main core concept is finished calculating earlier by the dependent, as C1=A1+B1, cell C1 relies on cell A1 and B1, then computation sequence is A1->B1->C1, and A1 and B1 have finished calculating before the assurance calculating C1.For example, in application number is 200510089360.4 patent publication, disclose a kind of method of arrangement units formula, no longer described in detail at this.
Step 302, determine to call order and wherein batch function and non-batch function.If this function of step 303 is non-batch function, then directly calculate the result of this function.If this function of step 304 is the batch function, then in storage unit, inquire about.If this function and CALCULATION OF PARAMETERS result thereof are arranged in step 305 storage unit, then directly return this end value.If step 306 is this function and parameter thereof not, then this function and parameter thereof are stored into storage unit, and return a predefined undetermined value at this function, the remainder of unit formula continues to carry out.Like this, the unit formula that nested function is arranged has been collected the function of innermost layer.Similar substantially to the step in the method shown in Figure 2, consider for length, be not described in detail in this.
So just finished calculating, the collection of first cell formula function in the electronic data sheet, judge whether to also have next cell then, if have, then repeating step 302,303,304,305,306, and next formula cell is carried out calculating the first time, collecting.After all formula cells in the electronic data sheet are all finished collection for the first time, enter step 307.
Certainly, also can just carry out function to all formula cells to be calculated in this spreadsheet in step 302 (for example determines in proper order, unified resolving and the buffered results of finishing syntax tree), then the step of above-mentioned repetitive cycling can only repeat 303,304,305,306, and next formula cell is once calculated, collects.
Function that step 307, storage unit are collected first pass and parameter thereof are given performance element and are carried out in batches, after performance element is finished this execution result is returned to storage unit, storage unit is got up execution result and function and parameter corresponding stored thereof, thereby can directly return the execution value of this function and parameter thereof when inquiring about this function and parameter thereof next time.
Repeating step 304,305,306,307 then, once more the formula cell with undetermined value carried out the collection and the calculating of function.When not having formula cell in the spreadsheet, then collect and finish with undetermined value.
Further, another kind of situation, concerning formula cell with undetermined value, if there is not the buffer memory syntax tree, then need to redefine calling order of function and redefine function and non-batch function in batches, at this moment just need repeating step 302,303,304,305,306,307, repeat above-mentioned steps always, do not have the formula cell with undetermined value in spreadsheet, then explanation is collected and is finished, and does not need to repeat once more.
After collection was finished, preferred, this embodiment can also comprise:
Step 308, according to the result of calculation of non-batch function in each unit formula and in batches the execution result of function finish the calculating of whole spreadsheet.
For the nested function of N layer arranged, needing to collect N+1 time could finish whole collection of the function of unit formula, after having collected N+1 time, does not have undetermined value in the unit formula, thereby the collection of function is finished in the unit formula, calculates like this that undetermined values all in the formation is all deleted to be fallen.To carry out N+2 altogether all over calculating the overall calculation that just can finish spreadsheet.
Still specify this method flow with an example below.
Suppose spreadsheet:
A1=sum(100,200);B1=ACCT(“001”);C1=ACCT(ACCT(“002”));D1=ACCT(“002”)。Wherein, A1=sum (100,200) is non-batch function; B1=ACCT (" 001 ") is the batch function; C1=ACCT (ACCT (" 002 ")) is a nested function; D1=ACCT (" 002 ") is the batch function.
The calculating formation is: and A1, B1, C1, D1} carries out according to above-mentioned circulation.
First pass
A1 is non-batch function, directly is finished, and the A1 value is 300.A1 is extractd from calculate formation;
B1 is the batch function, collects ACCT function and parameter " 001 " thereof, and the B1 value is a undetermined value;
Collect ACCT function and parameter " 002 " thereof in the C1 internal layer, the C1 value is a undetermined value;
D1 is the batch function, and ACCT function and parameter thereof " 002 " were collected by C1, and the D1 value is a undetermined value;
Epicycle is collected 2 of batch functions, be respectively ACCT (" 001 "), ACCT (" 002 "), these two functions are submitted to performance element to be carried out, carry out ACCT (" 001 ")=" 100 " in batches, ACCT (" 002 ")=" 200 " after being finished, returns this execution result and gives storage unit, the function collector unit is function and parameter A CCT (" 001 "), ACCT (" 002 ") and result 100,200 storages corresponding with it, so that utilize during next function call.
Second time
Only repeating of this step has B1, C1 and D1 to get final product at the formula cell with undetermined value.
Batch function ACCT function that B1 comprises and parameter " 001 " thereof have Query Result " 100 ", are finished, and the B1 value is " 100 ", and B1 is extractd from calculate formation;
Batch function ACCT function that C1 comprises and parameter " 002 " thereof have Query Result " 200 ", collect outer layer functions ACCT and parameter " 200 ", are converted into formula C1=ACCT (" 200 "), and the C1 value is a undetermined value;
Batch function ACCT function that D1 comprises and parameter " 002 " thereof have Query Result " 200 ", are finished, and the D1 value is " 200 ", and D1 is extractd from calculate formation;
Epicycle is collected 1 of batch function, be ACCT (" 200 "), these two functions are submitted to performance element to be carried out, carry out ACCT (" 200 ")=" 888 " in batches, after being finished, return this execution result and give storage unit, the function collector unit is with function and parameter A CCT (" 200 ") and result 888 storages corresponding with it.
The 3rd time
The formula cell that has undetermined value in the repeating of this step has had only C1.
Batch function ACCT function that C1 comprises and parameter " 002 " thereof have Query Result " 200 ", and outer layer functions ACCT and parameter " 200 " also have Query Result " 888 ", are finished, and the C1 value is " 100 ", and C1 is extractd from calculate formation;
Epicycle is collected 0 of batch function, withdraws from circulation, finishes the spreadsheet overall calculation according to the result of calculation of non-batch function and the execution result of batch function at last.
Though the function collection method that above-mentioned several embodiment provided has solved the collection problem of nested function, and can provide the basis, improve the collection efficiency of function in the whole electronic data sheet for the batch execution of function.But because the method that this function is collected will be that object is inquired about in storage unit with function and parameter thereof.Usually such inquiry can take place three times.That is: for the first time, carrying out first when comprising the unit formula of specified function, be that object inquires about to have collected this function and parameter thereof whether in storage unit with function and parameter thereof; For the second time, after function and parameter collection thereof finish, all functions in the storage unit and parameter thereof are packaged as a packet pass to performance element and carry out, comprise corresponding each function and CALCULATION OF PARAMETERS result thereof in the packet of the complete back of function.Needing when the result in this packet is imported storage unit is that object is inquired about the location with this function and parameter thereof once more, thereby makes this execution result and function and parameter thereof corresponding stored one by one; For the third time, once in batches function complete after, to collecting function just now, do not finish the cell node that unit formula calculates and calculate once more, needing be that object goes Query Result value in the storage unit with this function and parameter thereof once more.
Because the diversity of function and parameter thereof, be that object inquires about with function and parameter thereof be operation consuming time,, carried out identical time-consuming operation 3 times same group of function and parameter thereof, influenced the efficient that function is collected, and the unnecessary waste of computer resource has been arranged.
So the present invention has proposed more preferred embodiment to this, reducing with function and parameter thereof is that object is inquired about, to address the above problem.The core that this embodiment deals with problems is: for the function of formula cell and parameter-definition thereof a characteristic of correspondence value, it is stored in as a node in the syntax tree of corresponding unit formula reuses, represent corresponding function and parameter thereof to carry out query manipulation with this eigenwert, therefore when needs in storage unit, be that object is when inquiring about to this function and parameter thereof, no longer originally inquire about as object with function and parameter thereof, replacing eigenwert inquires about, be that the object replacement is various promptly with a simple eigenwert, complicated function and parameter thereof are inquired about, improved the efficient of query function, particularly function and parameter thereof need be carried out remote inquiry, when repeatedly inquiring about, the raising of functional query efficient is more obvious, thereby has improved the efficient that function is collected greatly.
When having identical in a large number batch function in the formula cell, it is an eigenwert that the present invention further unifies the eigenwert of these functions, after the first pass inquiry, each group function and parameter thereof have all been determined unique eigenwert, the identical function and the eigenwert of parameter thereof are identical, follow-up inquiry relies on this eigenwert to get final product fully, and the raising of function collection efficiency is more obvious.
With reference to Fig. 4 a, show the flow chart of steps of the function collection method of the another kind of spreadsheet cells of the present invention, may further comprise the steps:
Step 401, the formula cell that will comprise function and parameter thereof resolve to syntax tree, and increase an eigenwert node in syntax tree.
The method that resolves to syntax tree is often used in the computing machine compilation process.The compilation process of traditional computerese is probably as follows: read in document source → morphology syntax parsing → abstract syntax tree → semantic analysis → code and generate.
For the present invention the computing formula in the current cell is resolved to the process of syntax tree, can adopt and above-mentioned essentially identical principle.As for concrete resolving, described in detail in the embodiment shown in fig. 8, no longer described in detail at this.
This function and parameter thereof are respectively as the node of this syntax tree, and follow this function node closely and add an eigenwert node, eigenwert as corresponding this function and parameter thereof, thereby in the query steps afterwards, be that object carries out query manipulation no longer with complicated and diversified function and parameter thereof, and with to should function and the eigenwert of parameter carry out query manipulation, eigenwert function and the parameter thereof than corresponding usually is simply many, so can improve the efficient of inquiry, save computer resource.
For example for unit formula=10+SUM (1, ACCT (" 001 ")),, be its form that resolves to behind the syntax tree and function and parameter A CCT (" 001 ") thereof are added integer eigenwert node b1 (its value is " 10 ") with reference to Fig. 4 b.
Described syntax tree can also be used to determining each calling order of function in the current cell formula.Certainly, skilled in the art will recognize that the method that can also adopt other determines each calling order of function in the formula, as adopt early stage Basic language to determine the function calls order by the mode that speech is explained, recursive call is carried out.The present invention preferably adopts the syntax tree after the parsing to determine each calling order of function in the formula, can reuse the syntax tree after the parsing like this, improves the efficient that function is collected.
Described syntax tree also can be used for determining the batch function and the non-batch function of current cell formula, and is apparent, and those skilled in the art also can adopt other mode to come batch function and non-batch function in the determining unit lattice formula.As adopt modes such as function name sign, configuration file, registration, can discern batch function in the formula cell and non-batch function, not crucial for the present invention, just do not described in detail at this, the present invention preferably adopts the syntax tree after the parsing to come batch function and non-batch function in the determining unit lattice formula, be because can reuse syntax tree after the parsing equally, improve the efficient that function is collected.
Preferably, described eigenwert adopts a progressive whole number value, and it is in order to guarantee the uniqueness of eigenwert as eigenwert that employing increases progressively integer.Opposite extreme situations, when if this integer increases progressively trend integer maximal value in a large amount of resolving then can be later from the integer minimum value, obviously, be an integer limit function to occur in the normal spreadsheet, so can guarantee the uniqueness of this integer eigenwert.Can certainly adopt other mode to reach the purpose of eigenwert uniqueness, as adopting current system time etc. as eigenwert, but it is simply efficient all to be not so good as the integer increments eigenwert.The present invention is not limited this yet.
Because in the process of resolving syntax tree, be easy to just can identify batch function and non-batch function in the formula cell, non-batch function does not need to carry out query manipulation in a preferred embodiment of the invention, so in the further preferred embodiment of the present invention, do not need to non-batch function definition eigenwert, promptly only behind batch function node, add an eigenwert node, can save the integer eigenwert like this, save resource for computer system.
Step 402, the function call order of determining according to the syntax tree after resolving are carried out computing successively, if right and wrong are function in batches, then calculate the result of calculation of this function, one of advantage of this step is, satisfy under the certain situation, in batches the situation of function parameters right and wrong batch function.
Step 403 is if function in batches, then with the inquiry in the storage unit of the eigenwert of this function and parameter thereof.
If store the end value of this eigenwert correspondence in step 404 storage unit, then directly return this end value.So just saved the invoked procedure of linear function.Especially, this step is that object carries out query manipulation with function and parameter thereof no longer, but carries out query manipulation with a simple eigenwert, and efficient improved very obvious when this carried out the remote inquiry operation at needs.
If there be not the storage end value corresponding in step 405 storage unit with this eigenwert, illustrate that then this function and parameter thereof and characteristic of correspondence value were not collected, then this function and parameter thereof and characteristic of correspondence value are stored into storage unit, finish the collection of this function and parameter thereof and eigenwert.And return a undetermined value at this function.The remainder of unit formula continues to carry out.Like this, the unit formula that nested function is arranged has been collected the function of innermost layer.The formula cell that described undetermined value is used for showing this function and comprises this function is not finished calculating, its result of function who comprises undetermined value remains undetermined value, the formula cell result who comprises the undetermined value function also is undetermined value, certainly, also can adopt other mark to describe.Described in detail among the embodiment that acts on the front of described undetermined value, also no longer described in detail at this.
Function that step 406, storage unit are collected first pass and parameter thereof are given performance element and are carried out in batches, after performance element is finished this execution result is returned to storage unit, storage unit is got up execution result and function and parameter thereof and eigenwert corresponding stored.Thereby during this eigenwert of inquiry next time, can directly return the execution result of this eigenwert.
In this step, when after performance element is finished function, returning execution result to storage unit, can be that object is inquired about with function and parameter thereof, thereby execution result and function and parameter corresponding stored thereof are got up, but the present invention is that object is inquired about with the eigenwert of this function and parameter thereof preferably, thereby execution result and function and parameter thereof and eigenwert corresponding stored are got up.If performance element and storage unit be not in same system the time, the raising to search efficiency is very tangible like this.
Repeating step 403,404,405,406 then, and the function with undetermined value is collected and calculated, the collection that solves nested function by this repeating step, when regathering less than new function, then overall calculation is finished.Further, begin next circulation again after the described repeating step function that preferably will all have a undetermined value repeats once.
Further, another kind of situation, concerning the function and formula that return undetermined value, in some cases, for example, when in batches the execution result of function is as non-batch function parameters, then just need calculate, promptly need repeating step 402,403,404,405,406, repeat above-mentioned steps always this non-batch function, the function that in this formula cell, does not have undetermined value, thus end is collected in explanation.
So far, the function in the formula cell is collected and is finished, and those skilled in the art can use the collection result and add up, analyze or the like operation, certainly, also can be used to finish the calculating of current cell, and for example, preferred, present embodiment can also comprise:
The execution result of each batch function that step 407, basis obtain is finished the calculating of current cell.
Can adopt the mode of buffer memory for the result of calculation of non-batch function, finish the calculating of current cell then with the execution result of batch function.For example, order is carried out this formula cell, runs into function in batches, and then inquiry obtains corresponding execution result, runs into non-batch function, and also inquiry obtains the corresponding calculated result, thereby finishes the calculating of whole unit lattice.
Certainly, if comparatively speaking, the resource consumption that calculates non-batch function is littler than the resource consumption of cache way, then also can adopt the mode of double counting to realize.For example, order is carried out this formula cell, runs into function in batches, and then inquiry obtains corresponding execution result, runs into non-batch function, then calculates its result, thereby finishes the calculating of whole unit lattice.
Preferably, in step 405,, then inquire about with this function and parameter thereof if when not storing the end value of this eigenwert correspondence in the storage unit, if have identical function and parameter thereof in the storage unit, illustrate that then this function and parameter thereof were collected.Replace this query function and the eigenwert of parameter in syntax tree thereof with the same functions and the parameter characteristic of correspondence value thereof of having stored in the storage unit, after this replacement step, the eigenwert of same functions and parameter is exactly identical in syntax tree.Be that same functions and parameter characteristic of correspondence value node thereof are same.This in syntax tree eigenwert the replacement is very simply just can realize, as eigenwert node assignment is again got final product.If not this function and parameter thereof in the storage unit illustrate that then this function and parameter thereof are to collect for the first time, this function and parameter thereof and characteristic of correspondence value are stored in the storage unit.
After collecting through first pass, each group function and parameter thereof have all been determined unique eigenwert, identical function and improve parameter unification thereof eigenwert, follow-up query manipulation relies on this eigenwert to get final product fully, improved efficiency is obvious.
Further, batch in the described step 406 carry out to as if storage unit in do not store corresponding result's batch function, because store function and the parameter and the eigenwert of corresponding execution result in the storage unit, these functions are to be performed, in order to raise the efficiency, save computer resource, the function of having carried out has just no longer been carried out, and promptly only carries out the function that was not performed.
With reference to Fig. 5, show a kind of flow chart of steps of function collection method of spreadsheet, the difference of it and method shown in Figure 4 is, this method is at whole spreadsheet, this spreadsheet can comprise a lot of formula cells, the computing method of described spreadsheet can be used to calculate the calculating of whole spreadsheet, also can be used to finish the calculating to its subregion.Embodiment illustrated in fig. 4ly specifically can may further comprise the steps:
Step 501, determine the computation sequence of each unit formula in the spreadsheet.
For computation sequence how to determine each unit formula in the spreadsheet, those skilled in the art can adopt various feasible methods, main core concept is finished calculating earlier by the dependent, as C1=A1+B1, cell C1 relies on cell A1 and B1, then computation sequence is A1->B1->C1, and A1 and B1 have finished calculating before the assurance calculating C1.For example, in application number is 200510089360.4 patent publication, disclose a kind of method of arrangement units formula, no longer described in detail at this.
Step 502, the formula cell that will comprise function and parameter thereof resolve to syntax tree, and increase an eigenwert node in syntax tree.
This function and parameter thereof are respectively as the node of this syntax tree, and follow this function node closely and add an eigenwert node, eigenwert as corresponding this function and parameter thereof, thereby in the query steps afterwards, be that object carries out query manipulation no longer with complicated and diversified function and parameter thereof, and with to should function and the eigenwert of parameter carry out query manipulation, eigenwert function and the parameter thereof than corresponding usually is simply many, so can improve the efficient of inquiry, save computer resource.
Described syntax tree can also be used to determining each calling order of function in the current cell formula.Certainly, skilled in the art will recognize that the method that can also adopt other determines each calling order of function in the formula, as adopt early stage Basic language to determine the function calls order by the mode that speech is explained, recursive call is carried out.The present invention preferably adopts the syntax tree after the parsing to determine each calling order of function in the formula, can reuse the syntax tree after the parsing like this, improves the efficient that function is collected.
Described syntax tree also can be used for determining the batch function and the non-batch function of current cell formula, and is apparent, and those skilled in the art also can adopt other mode to come batch function and non-batch function in the determining unit lattice formula.As adopt modes such as function name sign, configuration file, registration, can discern batch function in the formula cell and non-batch function, not crucial for the present invention, just do not described in detail at this, the present invention preferably adopts the syntax tree after the parsing to come batch function and non-batch function in the determining unit lattice formula, be because can reuse syntax tree after the parsing equally, improve the efficient that function is collected.
Preferably, described eigenwert adopts a progressive whole number value, and it is in order to guarantee the uniqueness of eigenwert as eigenwert that employing increases progressively integer.Opposite extreme situations, when if this integer increases progressively trend integer maximal value in a large amount of resolving then can be later from the integer minimum value, obviously, be an integer limit function to occur in the normal spreadsheet, so can guarantee the uniqueness of this integer eigenwert.Can certainly adopt other mode to reach the purpose of eigenwert uniqueness, as adopting current system time etc. as eigenwert, but it is simply efficient all to be not so good as the integer increments eigenwert.The present invention is not limited this yet.
Because in the process of resolving syntax tree, be easy to just can identify batch function and non-batch function in the formula cell, non-batch function does not need to carry out query manipulation in a preferred embodiment of the invention, so in the further preferred embodiment of the present invention, do not need to non-batch function definition eigenwert, promptly only behind batch function node, add an eigenwert node, can save the integer eigenwert like this, save resource for computer system.
Step 503, the function call order of determining according to the syntax tree after resolving are carried out computing successively, if right and wrong are function in batches, then calculate the result of calculation of this function, one of advantage of this step is, satisfy under the certain situation, in batches the situation of function parameters right and wrong batch function.
Step 504 is if function in batches, then with the inquiry in the storage unit of the eigenwert of this function and parameter thereof.
If store the end value of this eigenwert correspondence in step 505 storage unit, then directly return this end value.So just saved the invoked procedure of linear function.Especially, this step is that object carries out query manipulation with function and parameter thereof no longer, but carries out query manipulation with a simple eigenwert, and efficient improved very obvious when this carried out the remote inquiry operation at needs.
If when not storing the end value of this eigenwert correspondence in step 506 storage unit, then inquire about with this function and parameter thereof, if having identical function and parameter thereof in the storage unit, illustrate that then this function and parameter thereof were collected.Replace this query function and the eigenwert of parameter in syntax tree thereof with the same functions and the parameter characteristic of correspondence value thereof of having stored in the storage unit, after this replacement step, the eigenwert of same functions and parameter is exactly identical in syntax tree.Be that same functions and parameter characteristic of correspondence value node thereof are same.This in syntax tree eigenwert the replacement is very simply just can realize, as eigenwert node assignment is again got final product.
If not this function and parameter thereof in the storage unit illustrate that then this function and parameter thereof are to collect for the first time, this function and parameter thereof and characteristic of correspondence value are stored in the storage unit.And return a undetermined value at this function.The remainder of unit formula continues to carry out.Like this, the unit formula that nested function is arranged has been collected the function of innermost layer.The formula cell that described undetermined value is used for showing this function and comprises this function is not finished calculating, its result of function who comprises undetermined value remains undetermined value, the formula cell result who comprises the undetermined value function also is undetermined value, certainly, also can adopt other mark to describe.Described in detail among the embodiment that acts on the front of described undetermined value, also no longer described in detail at this.
In another embodiment, in the storage unit that presets,, collect the batch function that does not have the accordingly result value, and return a undetermined value at this function with the eigenwert inquiry of this function and parameter thereof.
After collecting through first pass, each group function and parameter thereof have all been determined unique eigenwert, identical function and improve parameter unification thereof eigenwert, follow-up query manipulation relies on this eigenwert to get final product fully, improved efficiency is obvious.
So just finished calculating, the collection of first cell formula function in the electronic data sheet, judge whether to also have next cell then, if have, then repeating step 502,503,504,505,506, and next formula cell is carried out calculating the first time, collecting.After all formula cells in the electronic data sheet are all finished collection for the first time, enter step 507.
Certainly, also can just carry out function to all formula cells to be calculated in this spreadsheet in step 502 (for example determines in proper order, unified resolving and the buffered results of finishing syntax tree), then the step of above-mentioned repetitive cycling can only repeat 503,504,505,506, and next formula cell is once calculated, collects.
Function that step 507, storage unit are collected first pass and parameter thereof are given performance element and are carried out in batches, after performance element is finished this execution result is returned to storage unit, storage unit is got up execution result and function and parameter thereof and eigenwert corresponding stored, thereby during this feature of inquiry next time, can directly return the corresponding result of this eigenwert.
In this step, when after performance element is finished function, returning execution result to storage unit, can be that object is inquired about with function and parameter thereof, thereby execution result and function and parameter corresponding stored thereof are got up, but the present invention is that object is inquired about with the eigenwert of this function and parameter thereof preferably, thereby execution result and function and parameter thereof and eigenwert corresponding stored are got up.If performance element and storage unit be not in same system the time, the raising to search efficiency is very tangible like this.
Further, carry out in batches to as if storage unit in do not store corresponding result's batch function, because store function and the parameter and the eigenwert of corresponding execution result in the storage unit, these functions are to be performed, in order to raise the efficiency, save computer resource, the function of having carried out has just no longer been carried out, and promptly only carries out the function that was not performed.
Repeating step 504,505,506,507 then, once more the formula cell with undetermined value carried out the collection and the calculating of function.When not having formula cell in the spreadsheet, then collect and finish with undetermined value.
Further, another kind of situation, concerning formula cell with undetermined value, if there is not the buffer memory syntax tree, then need to redefine calling order of function and redefine function and non-batch function in batches, at this moment just need repeating step 502,503,504,505,506,507, repeat above-mentioned steps always, do not have the formula cell with undetermined value in spreadsheet, then explanation is collected and is finished, and does not need to repeat once more.
After collection was finished, those skilled in the art can use the collection result and add up, analyze or the like operation preferably, and this embodiment can also comprise:
Step 508, according to the result of calculation of non-batch function in each unit formula and in batches the execution result of function finish the calculating of whole spreadsheet.
With reference to Fig. 6, show a kind of structured flowchart of function gathering-device of spreadsheet cells, comprise with lower member:
Resolution unit 601, the formula cell that is used for comprising function and parameter thereof resolves to syntax tree, and increases an eigenwert node in syntax tree.
This function and parameter thereof are respectively as the node of this syntax tree, and follow this function node closely and add an eigenwert node, eigenwert as corresponding this function and parameter thereof, thereby in the query steps afterwards, be that object carries out query manipulation no longer with complicated and diversified function and parameter thereof, and with to should function and the eigenwert of parameter carry out query manipulation, eigenwert function and the parameter thereof than corresponding usually is simply many, so can improve the efficient of inquiry, save computer resource.
Described resolution unit can also comprise a determining unit, utilizes the described syntax tree after resolution unit is resolved to can also be used to determining each calling order of function in the current cell formula.Certainly, skilled in the art will recognize that the method that can also adopt other determines each calling order of function in the formula, as adopt early stage Basic language to determine the function calls order by the mode that speech is explained, recursive call is carried out, promptly resolution unit and determining unit are independently.The present invention preferably adopts the syntax tree after the parsing to determine each calling order of function in the formula, can reuse the syntax tree after the parsing like this, improves the efficient that function is collected.
Described determining unit utilizes the described syntax tree after resolution unit is resolved to determine the batch function and the non-batch function of current cell formula, obviously, those skilled in the art also can adopt other mode to come batch function and non-batch function in the determining unit lattice formula.As adopt modes such as function name sign, configuration file, registration, can discern batch function in the formula cell and non-batch function, not crucial for the present invention, just do not described in detail at this, promptly resolution unit and determining unit are independently.The present invention preferably adopts the syntax tree after the parsing to come batch function and non-batch function in the determining unit lattice formula, is because can reuse syntax tree after the parsing equally, improves the efficient that function is collected.
Preferably, described eigenwert adopts a progressive whole number value, and it is in order to guarantee the uniqueness of eigenwert as eigenwert that employing increases progressively integer.Opposite extreme situations, when if this integer increases progressively trend integer maximal value in a large amount of resolving then can be later from the integer minimum value, obviously, be an integer limit function to occur in the normal spreadsheet, so can guarantee the uniqueness of this integer eigenwert.Can certainly adopt other mode to reach the purpose of eigenwert uniqueness, as adopting current system time etc. as eigenwert, but it is simply efficient all to be not so good as the integer increments eigenwert.The present invention is not limited this yet.
Because in the process of resolving syntax tree, be easy to just can identify batch function and non-batch function in the formula cell, non-batch function does not need to carry out query manipulation in a preferred embodiment of the invention, so in the further preferred embodiment of the present invention, do not need to non-batch function definition eigenwert, promptly only behind batch function node, add an eigenwert node, can save the integer eigenwert like this, save resource for computer system.
Arithmetic element 602 is used for carrying out computing successively according to the described order of calling, if right and wrong function in batches then calculates the result of calculation of this function; If the batch function is then inquired about with the eigenwert of this function and parameter thereof in the storage unit that presets.
Storage judging unit 603 is used for judging whether the eigenwert of inquiring about in storage unit exists corresponding result, collects the batch function that does not have the accordingly result value, and returns a undetermined value at this function.
In another embodiment, described storage judging unit is used for judging whether the eigenwert of inquiring about in storage unit exists corresponding result, exists then to return this end value; If there is no Dui Ying result, then inquire about with this function and parameter thereof, if have identical function and parameter thereof in the storage unit, then the eigenwert in syntax tree replaces to the same functions of having stored and the eigenwert of parameter thereof with this function and parameter thereof; If do not have identical function and parameter thereof in the storage unit, then this function and parameter thereof and characteristic of correspondence value are stored in the storage unit, and return a undetermined value at this function.
Further, also comprise a function judging unit, be used for judging before storage function and parameter whether had identical function and parameter, if then skip this function in storage unit.This function and parameter thereof are arranged in the storage unit, illustrated that then this function and parameter thereof are not to be collected for the first time, be collected, do not need Reduplicated collection, thereby can raise the efficiency.
Performance element 604 is used for carrying out the batch function that storage unit is stored in batches, and returns execution result and give storage unit.Because store function and parameter thereof in the storage unit, what these functions and parameter thereof had is performed, the execution result that corresponding stored has been arranged, what have does not also carry out, though performance element can all be carried out once all functions and the parameter thereof that are stored in the storage unit, but undoubtedly, can waste a large amount of computer resources like this, so preferably only carry out function and the parameter thereof that was not performed in the storage unit.
Storage unit 605 is used to store the corresponding execution result that function in batches and parameter thereof and eigenwert and performance element return.
Undetermined value judging unit 606 is used to judge whether also to exist the function with undetermined value, if exist, then calls storage judging unit and performance element once more, the function that does not have undetermined value in this formula cell.
Further, another kind of situation, the undetermined value judging unit can repeat to call arithmetic element, storage judging unit and performance element, the function that does not have undetermined value in this formula cell.
Perhaps, another kind of performance, the undetermined value judging unit can also repeat to call determining unit, arithmetic element, storage judging unit and performance element, does not have the function of undetermined value in this formula cell.
Preferably, this gathering-device can also comprise cell computing unit 607, is used for finishing the calculating of current cell according to obtaining each execution result of function in batches.
With reference to Fig. 7, show a kind of structured flowchart of function gathering-device of spreadsheet, comprise with lower member:
Arrangement units 701, the computation sequence that is used for arranging each formula cell of spreadsheet.Its core concept is finished calculating earlier by the dependent, and as C1=A1+B1, formula cell C1 relies on formula cell A1 and B1, and then computation sequence is A1->B1->C1, and A1 and B1 have finished calculating before the assurance calculating C1.
In application number is 200510089360.4 patent publication, disclose a kind of method of arrangement units formula, no longer described in detail at this.
Resolution unit 702, the formula cell that is used for comprising function and parameter thereof resolves to syntax tree, determine each calling order of function and definite function and non-batch function in batches in the current cell formula, and eigenwert node of interpolation behind the function node in the syntax tree after parsing, eigenwert as this function and parameter thereof, the same with method shown in Figure 6, the described resolution unit of present embodiment can also comprise a determining unit, described determining unit also can be respectively independent with resolution unit, but the present invention preferably determining unit be arranged in described resolution unit.
Arithmetic element 703 is used for carrying out computing successively according to the described order of calling, if right and wrong function in batches then calculates the result of calculation of this function; If the batch function is then inquired about with the eigenwert of this function and parameter thereof in the storage unit that presets.
Storage judging unit 704 is used for judging whether the eigenwert of inquiring about in storage unit exists corresponding result, collects the batch function that does not have the accordingly result value, and returns a undetermined value at this function.
In another embodiment, described storage judging unit is used for judging whether the eigenwert of inquiring about in storage unit exists corresponding result, exists then to return this end value; If there is no Dui Ying result, then inquire about with this function and parameter thereof, if have identical function and parameter thereof in the storage unit, then the eigenwert in syntax tree replaces to the same functions of having stored and the eigenwert of parameter thereof with this function and parameter thereof; If do not have identical function and parameter thereof in the storage unit, then this function and parameter thereof and characteristic of correspondence value are stored in the storage unit, and return a undetermined value at this function.
Further, also comprise a function judging unit, be used for judging before storage function and parameter whether had identical function and parameter, if then skip this function in storage unit.This function and parameter thereof are arranged in the storage unit, illustrated that then this function and parameter thereof are not to be collected for the first time, be collected, do not need Reduplicated collection, thereby can raise the efficiency.
Storage unit 705 is used to store the corresponding execution result that function in batches and parameter thereof and eigenwert and performance element return.
Cell judging unit 706 is used to judge whether also to exist the formula cell that is not performed, if exist, then calls resolution unit, arithmetic element and storage judging unit once more at this formula cell;
Performance element 707 is used for carrying out the batch function that storage unit is stored in batches, and returns execution result and give storage unit.Because store function and parameter thereof in the storage unit, what these functions and parameter thereof had is performed, the execution result that corresponding stored has been arranged, what have does not also carry out, though performance element can all be carried out once all functions and the parameter thereof that are stored in the storage unit, but undoubtedly, can waste a large amount of computer resources like this, so preferably only carry out function and the parameter thereof that was not performed in the storage unit.
Undetermined value judging unit 708, be used to judge whether also to exist formula cell with undetermined value, if exist, then call storage judging unit, cell judging unit and performance element once more, the formula cell that in this spreadsheet, does not have undetermined value.
Further, another kind of situation, the undetermined value judging unit can repeat to call arithmetic element, storage judging unit, cell judging unit and performance element, the function that does not have undetermined value in this formula cell.
Perhaps, another kind of performance, the undetermined value judging unit can also repeat to call resolution unit, arithmetic element, storage judging unit, cell judging unit and performance element, does not have the function of undetermined value in this formula cell.
Preferably, this gathering-device can also comprise spreadsheet computing unit 709, is used for finishing the calculating of current spreadsheet according to the result of calculation of each the non-batch function that obtains and the execution result of each batch function.
The part that does not describe in detail in Fig. 6,7 shown devices can be considered for length referring to the relevant portion of method shown in Fig. 1,2,3,4,5, is not described in detail in this.
More than to the function collection method and the device of a kind of spreadsheet provided by the present invention and cell, 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 (25)

1, a kind of function collection method of spreadsheet is characterized in that, comprising:
The formula cell that will comprise function and parameter thereof resolves to syntax tree, each calling order of function in the determining unit lattice formula; And, in resolving, follow the function node closely one eigenwert node is set;
Carry out computing successively according to the described order of calling, collect the function and the parameter thereof that meet prerequisite; Described collection process comprises the step that whether stores corresponding executed result according to the eigenwert inquiry;
Collected function and parameter thereof are submitted in batches, finished in batches and carry out;
Storage execution result and corresponding function and parameter and eigenwert.
2, function collection method as claimed in claim 1 is characterized in that, described storing step is:
Function positions inquiry with eigenwert after carrying out in batches, with execution result and function and parameter and eigenwert corresponding stored.
3, a kind of function collection method of spreadsheet cells is characterized in that, comprising:
A, the formula cell that will comprise function and parameter thereof resolve to syntax tree, determine in the current cell formula each calling order of function and determine function and non-batch function in batches; And, in resolving, follow the function node closely one eigenwert node is set;
B, carry out computing successively, if right and wrong function in batches then calculates the result of calculation of this function according to the described order of calling; If batch function, then execution in step c;
C, the eigenwert with this function and parameter thereof in the storage unit that presets are inquired about, and collect the batch function that does not have the accordingly result value, and return a undetermined value at this function;
D, in batches carry out the batch function of being stored, obtain corresponding execution result, and this end value and function of corresponding stored and parameter thereof and eigenwert are to described storage unit;
E, at function with undetermined value, repeated execution of steps d and e, the function that in this formula cell, does not have undetermined value.
4, function collection method as claimed in claim 3 is characterized in that, described step c is:
In the storage unit that presets,,, then return this end value if there be the result corresponding in the described storage unit with this eigenwert with the eigenwert inquiry of this function and parameter thereof; Otherwise this function and parameter thereof and characteristic of correspondence value are stored in the storage unit, and return a undetermined value at this function, described storage unit is used to store function and the parameter and the characteristic of correspondence value of having collected, and corresponding execution result.
5, function collection method as claimed in claim 3 is characterized in that, described step c is:
In the storage unit that presets,,, then return this end value, otherwise inquire about with this function and parameter thereof if there be the result corresponding in the described storage unit with this eigenwert with the eigenwert inquiry of this function and parameter thereof; If have identical function and parameter thereof in the storage unit, then the eigenwert in syntax tree replaces to the same functions of having stored and the eigenwert of parameter thereof with this function and parameter thereof, if do not have identical function and parameter thereof in the storage unit, store this function and parameter thereof and characteristic of correspondence value to storage unit, and return a undetermined value at this function, described storage unit is used to store function and the parameter and the characteristic of correspondence value of having collected, and corresponding execution result.
6, as claim 3,4 or 5 described function collection methods, it is characterized in that storing process described in the steps d is:
After function is carried out in batches, position inquiry with eigenwert in storage unit, corresponding stored execution result and function and parameter thereof and eigenwert are to storage unit.
7, as claim 1 or 3 described function collection methods, it is characterized in that:
The eigenwert of described respective function and parameter thereof is a progressive whole number value.
8, function collection method as claimed in claim 3 is characterized in that, described in the step e at function with undetermined value, the process of repeated execution of steps c and steps d is:
Begin next circulation again after repeating whole functions once with undetermined value.
9, function collection method as claimed in claim 3 is characterized in that, described step e is:
At function with undetermined value, repeated execution of steps b, c and d, the function that in this formula cell, does not have undetermined value.
10, function collection method as claimed in claim 3 is characterized in that, also comprises:
According to the execution result of each the batch function that obtains, finish the calculating of cell.
11, as claim 1 or 3 described function collection methods, it is characterized in that:
The described respective function node that the eigenwert node is set is a batch function node.
12, a kind of function collection method of spreadsheet is characterized in that, comprising:
A, determine the computation sequence of each formula cell in the spreadsheet;
B, the formula cell that will comprise function and parameter thereof resolve to syntax tree, determine in the current cell formula each calling order of function and determine function and non-batch function in batches; And, in resolving, follow the function node closely one eigenwert node is set;
C, carry out computing successively, if right and wrong function in batches then calculates the result of calculation of this function according to the described order of calling; If batch function, then execution in step d;
D, the eigenwert with this function and parameter thereof in the storage unit that presets are inquired about, and collect the batch function that does not have the accordingly result value, and return a undetermined value at this function;
E, at the next unit lattice, repeated execution of steps c and d are finished up to the formula cell of required execution;
F, in batches carry out the batch function of being stored, obtain corresponding execution result, and with this end value and function and parameter thereof and eigenwert corresponding stored to described storage unit;
G, at formula cell with undetermined value, repeated execution of steps d, e and f, the formula cell that in this spreadsheet, does not have undetermined value.
13, function collection method as claimed in claim 12 is characterized in that, described steps d is:
In the storage unit that presets,,, then return this end value if there be the result corresponding in the described storage unit with this eigenwert with the eigenwert inquiry of this function and parameter thereof; Otherwise this function and parameter thereof and characteristic of correspondence value are stored in the storage unit, and return a undetermined value at this function; Described storage unit is used to store function and the parameter and the characteristic of correspondence value of having collected, and corresponding execution result.
14, function collection method as claimed in claim 12 is characterized in that, described steps d is:
In the storage unit that presets,,, then return this end value if there be the result corresponding in the described storage unit with this eigenwert with the eigenwert inquiry of this function and parameter thereof; Otherwise inquire about with this function and parameter thereof, if having identical function and parameter thereof in the storage unit, then the eigenwert in syntax tree replaces to the same functions of having stored and the eigenwert of parameter thereof with this function and parameter thereof; If do not have identical function and parameter thereof in the storage unit, store this function and parameter thereof and characteristic of correspondence value to storage unit, and return a undetermined value at this function; Described storage unit is used to store function and the parameter and the characteristic of correspondence value of having collected, and corresponding execution result.
15, function collection method as claimed in claim 12 is characterized in that, storing process described in the step f is:
Function is inquired about in storage unit with eigenwert after carrying out in batches, with execution result and function and parameter thereof and eigenwert corresponding stored in storage unit.
16, function collection method as claimed in claim 12 is characterized in that:
The eigenwert of described respective function and parameter thereof is a progressive whole number value.
17, function collection method as claimed in claim 12 is characterized in that, described step g is:
At formula cell with undetermined value, repeated execution of steps c, d, e and f, the formula cell that in this spreadsheet, does not have undetermined value.
18, function collection method as claimed in claim 12 is characterized in that, described step f is:
At next unit lattice formula, repeated execution of steps b, c and d are finished up to the formula cell of required execution.
19, a kind of function gathering-device of current cell of spreadsheet is characterized in that, comprising:
Resolution unit, the formula cell that is used for comprising function and parameter thereof resolves to syntax tree, and adds an eigenwert node behind the function node in the syntax tree after parsing, as the eigenwert of this function and parameter thereof;
Determining unit is used for each calling order of function of determining unit lattice formula, and batch function wherein and non-batch function;
Arithmetic element is used for carrying out computing successively according to the described order of calling, if right and wrong function in batches then calculates the result of calculation of this function; If the batch function is then inquired about with the eigenwert of this function and parameter thereof in the storage unit that presets;
The storage judging unit is used for judging whether the eigenwert of inquiring about in storage unit exists corresponding result, collects the batch function that does not have the accordingly result value, and returns a undetermined value at this function;
Performance element is used for carrying out the batch function that storage unit is stored in batches, and returns execution result and give storage unit;
Storage unit is used to store the corresponding execution result that function in batches and parameter thereof and eigenwert and performance element return;
The undetermined value judging unit is used to judge whether also to exist the function with undetermined value, if exist, then calls storage judging unit and performance element once more, the function that does not have undetermined value in this formula cell.
20, function gathering-device as claimed in claim 19 is characterized in that, the described judgement collection process of storage judging unit is:
Whether the eigenwert that judgement is inquired about in storage unit exists corresponding result, exists then to return this end value, and if there is no Dui Ying result then inquires about with this function and parameter thereof; If have identical function and parameter thereof in the storage unit, then the eigenwert in syntax tree replaces to the same functions of having stored and the eigenwert of parameter thereof with this function and parameter thereof, if do not have identical function and parameter thereof in the storage unit, then this function and parameter thereof and characteristic of correspondence value are stored in the storage unit, and return a undetermined value at this function.
21, function gathering-device as claimed in claim 19 is characterized in that:
Described undetermined value judging unit is used to judge whether also to exist the function with undetermined value, if exist, then calls arithmetic element, storage judging unit and performance element once more, the function that does not have undetermined value in this formula cell.
22, a kind of function gathering-device of spreadsheet is characterized in that, comprising:
Arrangement units, the computation sequence that is used for arranging each formula cell of spreadsheet;
Resolution unit, the formula cell that is used for comprising function and parameter thereof resolves to syntax tree, and adds an eigenwert node behind the function node in the syntax tree after parsing, as the eigenwert of this function and parameter thereof;
Determining unit is used for each calling order of function of determining unit lattice formula, and batch function wherein and non-batch function;
Arithmetic element is used for carrying out computing successively according to the described order of calling, if right and wrong function in batches then calculates the result of calculation of this function; If the batch function is then inquired about with the eigenwert of this function and parameter thereof in the storage unit that presets;
The storage judging unit is used for judging whether the eigenwert of inquiring about in storage unit exists corresponding result, collects the batch function that does not have the accordingly result value, and returns a undetermined value at this function;
The cell judging unit is used to judge whether also to exist the formula cell that is not performed, if exist, then calls arithmetic element and storage judging unit once more at this formula cell;
Performance element is used for carrying out the batch function that storage unit is stored in batches, and returns execution result and give storage unit;
Storage unit is used to store the corresponding execution result that function in batches and parameter thereof and eigenwert and performance element return;
The undetermined value judging unit, be used to judge whether also to exist formula cell with undetermined value, if exist, then call storage judging unit, cell judging unit and performance element once more, the formula cell that in this spreadsheet, does not have undetermined value.
23, function gathering-device as claimed in claim 22 is characterized in that, the described judgement collection process of storage judging unit is:
Whether the eigenwert that judgement is inquired about in storage unit exists corresponding result, exists then to return this end value, and if there is no Dui Ying result then inquires about with this function and parameter thereof; If have identical function and parameter thereof in the storage unit, then the eigenwert in syntax tree replaces to the same functions of having stored and the eigenwert of parameter thereof with this function and parameter thereof, if do not have identical function and parameter thereof in the storage unit, then this function and parameter thereof and characteristic of correspondence value are stored in the storage unit, and return a undetermined value at this function.
24, function gathering-device as claimed in claim 22 is characterized in that:
Described undetermined value judging unit, be used to judge whether also to exist formula cell with undetermined value, if exist, then call arithmetic element, storage judging unit, cell judging unit and performance element once more, the formula cell that in this spreadsheet, does not have undetermined value.
25, function gathering-device as claimed in claim 22 is characterized in that:
The cell judging unit is used to judge whether also to exist the formula cell that is not performed, if exist, then calls resolution unit, determining unit, arithmetic element and storage judging unit once more at this formula cell.
CNB2007101057115A 2007-05-25 2007-05-25 Function collection method and device of electronic data table Active CN100483397C (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CNB2007101057115A CN100483397C (en) 2007-05-25 2007-05-25 Function collection method and device of electronic data table

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CNB2007101057115A CN100483397C (en) 2007-05-25 2007-05-25 Function collection method and device of electronic data table

Publications (2)

Publication Number Publication Date
CN101055569A true CN101055569A (en) 2007-10-17
CN100483397C CN100483397C (en) 2009-04-29

Family

ID=38795408

Family Applications (1)

Application Number Title Priority Date Filing Date
CNB2007101057115A Active CN100483397C (en) 2007-05-25 2007-05-25 Function collection method and device of electronic data table

Country Status (1)

Country Link
CN (1) CN100483397C (en)

Cited By (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102289429A (en) * 2010-06-17 2011-12-21 微软公司 Decompiling loops in a spreadsheet
CN102622336A (en) * 2012-02-28 2012-08-01 上海万得信息技术股份有限公司 System and method for Excel plug-in data batch extraction and based on Internet
CN102981856A (en) * 2012-11-28 2013-03-20 南开大学 Method and system for storing and searching program calculation results based on network
CN103500157A (en) * 2013-09-02 2014-01-08 用友软件股份有限公司 Device and method for filling form based on dynamic formula
CN107004034A (en) * 2015-02-12 2017-08-01 华为技术有限公司 Row and function is associated into the method performed with Optimizing Queries and query optimization server
CN104778043B (en) * 2015-04-02 2017-11-10 浪潮集团有限公司 A kind of group financial form computational methods preposition based on computation sequence processing
CN108268437A (en) * 2016-12-30 2018-07-10 航天信息股份有限公司 The method and device of formula manipulation

Cited By (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102289429A (en) * 2010-06-17 2011-12-21 微软公司 Decompiling loops in a spreadsheet
CN102622336A (en) * 2012-02-28 2012-08-01 上海万得信息技术股份有限公司 System and method for Excel plug-in data batch extraction and based on Internet
CN102981856A (en) * 2012-11-28 2013-03-20 南开大学 Method and system for storing and searching program calculation results based on network
CN102981856B (en) * 2012-11-28 2015-08-12 南开大学 Network program calculated result storage and retrieval method and system
CN103500157A (en) * 2013-09-02 2014-01-08 用友软件股份有限公司 Device and method for filling form based on dynamic formula
CN107004034A (en) * 2015-02-12 2017-08-01 华为技术有限公司 Row and function is associated into the method performed with Optimizing Queries and query optimization server
CN104778043B (en) * 2015-04-02 2017-11-10 浪潮集团有限公司 A kind of group financial form computational methods preposition based on computation sequence processing
CN108268437A (en) * 2016-12-30 2018-07-10 航天信息股份有限公司 The method and device of formula manipulation

Also Published As

Publication number Publication date
CN100483397C (en) 2009-04-29

Similar Documents

Publication Publication Date Title
CN101055569A (en) Function collection method and device of electronic data table
CN1134741C (en) Network system, printer and information storage media
CN1284095C (en) Task allocation method in multiprocessor system, and multiprocessor system
CN1152305C (en) Virtual machine system
CN101055566A (en) Function collection method and device of electronic data table
CN101030157A (en) Method and system for updating user vocabulary synchronouslly
CN1517869A (en) Processor, arithmetic processing method and priority decision method
CN101046812A (en) Method of data base table recording structure and detection and its device
CN1647076A (en) Method and apparatus for querying relational databases
CN1122216C (en) Optimizer
CN1667609A (en) Document information management system and document information management method
CN1925462A (en) Cache system
CN1924858A (en) Method and device for fetching new words and input method system
CN1920825A (en) Method and system for displaying performance constraints in a flow design tool
CN1967485A (en) Method and system for realizing J2EE application
CN1859359A (en) Realizing method and its device for communication protocol described by abstract grammar rule
CN1870028A (en) Work flow system, work flow processing method and work flow processing program
CN1731402A (en) Method and apparatus for accelerating file system operation by using coprocessor
CN1851700A (en) Inquiry method and system, and inquiry switching device
CN1156779C (en) Method and apparatus for document retrieval
CN101080077A (en) Maintenance method of device management tree and terminal device
CN101047555A (en) Detection method for quality of equipment
CN1801745A (en) Method for building network fault diagnosis rule base
CN101031884A (en) Processor
CN1194295C (en) Program changing device, method and computer program for treating program changing

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